├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .rustfmt.toml ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── assets └── deno_swc.png ├── compress.ts ├── deno.jsonc ├── examples ├── parse.ts ├── print.ts └── transform.ts ├── lib ├── deno_swc.generated.js └── deno_swc_bg.wasm ├── mod.ts ├── swc_wasm ├── Cargo.toml ├── build.js └── lib.rs ├── tests ├── deps.ts ├── parse.test.ts ├── print.test.ts └── transform.test.ts └── version.ts /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | fmt: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@master 14 | - uses: denolib/setup-deno@master 15 | with: 16 | deno-version: 1.12.2 17 | - name: Format Check 18 | run: deno fmt --check --ignore=swc_wasm 19 | 20 | swc-deno-test: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@master 24 | - uses: denolib/setup-deno@master 25 | with: 26 | deno-version: 1.23.0 27 | - uses: hecrj/setup-rust-action@v1 28 | with: 29 | rust-version: nightly 30 | 31 | - name: Install wasm32-unknown-unknown target 32 | run: rustup target add wasm32-unknown-unknown 33 | 34 | - name: Install wasm-bindgen 35 | run: cargo install --version 0.2.72 wasm-bindgen-cli 36 | 37 | - name: Cache Cargo home 38 | uses: actions/cache@v2 39 | with: 40 | # See https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci 41 | path: | 42 | ~/.cargo/registry/index 43 | ~/.cargo/registry/cache 44 | ~/.cargo/git/db 45 | key: f-cargo-home-${{ matrix.os }}-${{ hashFiles('Cargo.lock') }} 46 | 47 | - name: Cache build output 48 | uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b 49 | with: 50 | path: target 51 | key: | 52 | f-cargo-target-${{ matrix.os }}-${{ matrix.profile }}- 53 | 54 | - name: Build 55 | run: deno task build 56 | 57 | - name: Test 58 | run: deno task test 59 | 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | swc_wasm/pkg 3 | builds/ 4 | *.exe 5 | config.toml 6 | .vscode/settings.json 7 | -------------------------------------------------------------------------------- /.rustfmt.toml: -------------------------------------------------------------------------------- 1 | max_width = 80 2 | tab_spaces = 2 3 | edition = "2021" -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "Inflector" 7 | version = "0.11.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" 10 | dependencies = [ 11 | "lazy_static", 12 | "regex", 13 | ] 14 | 15 | [[package]] 16 | name = "addr2line" 17 | version = "0.17.0" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" 20 | dependencies = [ 21 | "gimli", 22 | ] 23 | 24 | [[package]] 25 | name = "adler" 26 | version = "1.0.2" 27 | source = "registry+https://github.com/rust-lang/crates.io-index" 28 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 29 | 30 | [[package]] 31 | name = "ahash" 32 | version = "0.7.6" 33 | source = "registry+https://github.com/rust-lang/crates.io-index" 34 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 35 | dependencies = [ 36 | "getrandom", 37 | "once_cell", 38 | "serde", 39 | "version_check", 40 | ] 41 | 42 | [[package]] 43 | name = "aho-corasick" 44 | version = "0.7.18" 45 | source = "registry+https://github.com/rust-lang/crates.io-index" 46 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" 47 | dependencies = [ 48 | "memchr", 49 | ] 50 | 51 | [[package]] 52 | name = "anyhow" 53 | version = "1.0.58" 54 | source = "registry+https://github.com/rust-lang/crates.io-index" 55 | checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" 56 | 57 | [[package]] 58 | name = "arrayvec" 59 | version = "0.7.2" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" 62 | 63 | [[package]] 64 | name = "ast_node" 65 | version = "0.7.7" 66 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 67 | dependencies = [ 68 | "darling", 69 | "pmutil", 70 | "proc-macro2", 71 | "quote", 72 | "swc_macros_common", 73 | "syn", 74 | ] 75 | 76 | [[package]] 77 | name = "atty" 78 | version = "0.2.14" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 81 | dependencies = [ 82 | "hermit-abi", 83 | "libc", 84 | "winapi", 85 | ] 86 | 87 | [[package]] 88 | name = "auto_impl" 89 | version = "0.5.0" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4" 92 | dependencies = [ 93 | "proc-macro-error", 94 | "proc-macro2", 95 | "quote", 96 | "syn", 97 | ] 98 | 99 | [[package]] 100 | name = "autocfg" 101 | version = "1.1.0" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 104 | 105 | [[package]] 106 | name = "backtrace" 107 | version = "0.3.65" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" 110 | dependencies = [ 111 | "addr2line", 112 | "cc", 113 | "cfg-if 1.0.0", 114 | "libc", 115 | "miniz_oxide", 116 | "object", 117 | "rustc-demangle", 118 | ] 119 | 120 | [[package]] 121 | name = "base64" 122 | version = "0.11.0" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" 125 | 126 | [[package]] 127 | name = "base64" 128 | version = "0.13.0" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 131 | 132 | [[package]] 133 | name = "better_scoped_tls" 134 | version = "0.1.0" 135 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 136 | dependencies = [ 137 | "scoped-tls", 138 | ] 139 | 140 | [[package]] 141 | name = "bitflags" 142 | version = "1.3.2" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 145 | 146 | [[package]] 147 | name = "block-buffer" 148 | version = "0.10.2" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" 151 | dependencies = [ 152 | "generic-array", 153 | ] 154 | 155 | [[package]] 156 | name = "browserslist-rs" 157 | version = "0.10.0" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | checksum = "e55d9cadf66efd56338797ada06140423bd87f290eac200027265d79d621a266" 160 | dependencies = [ 161 | "ahash", 162 | "anyhow", 163 | "chrono", 164 | "either", 165 | "itertools", 166 | "js-sys", 167 | "nom", 168 | "once_cell", 169 | "quote", 170 | "serde", 171 | "serde-wasm-bindgen", 172 | "serde_json", 173 | "string_cache", 174 | "string_cache_codegen", 175 | "thiserror", 176 | "wasm-bindgen", 177 | ] 178 | 179 | [[package]] 180 | name = "bumpalo" 181 | version = "3.10.0" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" 184 | 185 | [[package]] 186 | name = "cc" 187 | version = "1.0.73" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" 190 | 191 | [[package]] 192 | name = "cfg-if" 193 | version = "0.1.10" 194 | source = "registry+https://github.com/rust-lang/crates.io-index" 195 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 196 | 197 | [[package]] 198 | name = "cfg-if" 199 | version = "1.0.0" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 202 | 203 | [[package]] 204 | name = "chrono" 205 | version = "0.4.19" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" 208 | dependencies = [ 209 | "js-sys", 210 | "libc", 211 | "num-integer", 212 | "num-traits", 213 | "time", 214 | "wasm-bindgen", 215 | "winapi", 216 | ] 217 | 218 | [[package]] 219 | name = "console_error_panic_hook" 220 | version = "0.1.7" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" 223 | dependencies = [ 224 | "cfg-if 1.0.0", 225 | "wasm-bindgen", 226 | ] 227 | 228 | [[package]] 229 | name = "cpufeatures" 230 | version = "0.2.2" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" 233 | dependencies = [ 234 | "libc", 235 | ] 236 | 237 | [[package]] 238 | name = "crossbeam-channel" 239 | version = "0.5.5" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" 242 | dependencies = [ 243 | "cfg-if 1.0.0", 244 | "crossbeam-utils", 245 | ] 246 | 247 | [[package]] 248 | name = "crossbeam-deque" 249 | version = "0.8.1" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" 252 | dependencies = [ 253 | "cfg-if 1.0.0", 254 | "crossbeam-epoch", 255 | "crossbeam-utils", 256 | ] 257 | 258 | [[package]] 259 | name = "crossbeam-epoch" 260 | version = "0.9.9" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" 263 | dependencies = [ 264 | "autocfg", 265 | "cfg-if 1.0.0", 266 | "crossbeam-utils", 267 | "memoffset", 268 | "once_cell", 269 | "scopeguard", 270 | ] 271 | 272 | [[package]] 273 | name = "crossbeam-utils" 274 | version = "0.8.9" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978" 277 | dependencies = [ 278 | "cfg-if 1.0.0", 279 | "once_cell", 280 | ] 281 | 282 | [[package]] 283 | name = "crypto-common" 284 | version = "0.1.3" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" 287 | dependencies = [ 288 | "generic-array", 289 | "typenum", 290 | ] 291 | 292 | [[package]] 293 | name = "darling" 294 | version = "0.13.4" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" 297 | dependencies = [ 298 | "darling_core", 299 | "darling_macro", 300 | ] 301 | 302 | [[package]] 303 | name = "darling_core" 304 | version = "0.13.4" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" 307 | dependencies = [ 308 | "fnv", 309 | "ident_case", 310 | "proc-macro2", 311 | "quote", 312 | "strsim", 313 | "syn", 314 | ] 315 | 316 | [[package]] 317 | name = "darling_macro" 318 | version = "0.13.4" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" 321 | dependencies = [ 322 | "darling_core", 323 | "quote", 324 | "syn", 325 | ] 326 | 327 | [[package]] 328 | name = "dashmap" 329 | version = "5.3.4" 330 | source = "registry+https://github.com/rust-lang/crates.io-index" 331 | checksum = "3495912c9c1ccf2e18976439f4443f3fee0fd61f424ff99fde6a66b15ecb448f" 332 | dependencies = [ 333 | "cfg-if 1.0.0", 334 | "hashbrown 0.12.1", 335 | "lock_api", 336 | "parking_lot_core", 337 | ] 338 | 339 | [[package]] 340 | name = "debug_unreachable" 341 | version = "0.1.1" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3" 344 | dependencies = [ 345 | "unreachable", 346 | ] 347 | 348 | [[package]] 349 | name = "deno_swc" 350 | version = "0.0.1" 351 | dependencies = [ 352 | "anyhow", 353 | "console_error_panic_hook", 354 | "once_cell", 355 | "path-clean", 356 | "serde", 357 | "serde_json", 358 | "swc", 359 | "swc_common", 360 | "swc_ecmascript", 361 | "syn", 362 | "url", 363 | "wasm-bindgen", 364 | "wasm-bindgen-futures", 365 | "wee_alloc", 366 | ] 367 | 368 | [[package]] 369 | name = "digest" 370 | version = "0.10.3" 371 | source = "registry+https://github.com/rust-lang/crates.io-index" 372 | checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" 373 | dependencies = [ 374 | "block-buffer", 375 | "crypto-common", 376 | ] 377 | 378 | [[package]] 379 | name = "either" 380 | version = "1.6.1" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" 383 | 384 | [[package]] 385 | name = "enum_kind" 386 | version = "0.2.1" 387 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 388 | dependencies = [ 389 | "pmutil", 390 | "proc-macro2", 391 | "swc_macros_common", 392 | "syn", 393 | ] 394 | 395 | [[package]] 396 | name = "fnv" 397 | version = "1.0.7" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 400 | 401 | [[package]] 402 | name = "form_urlencoded" 403 | version = "1.0.1" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 406 | dependencies = [ 407 | "matches", 408 | "percent-encoding", 409 | ] 410 | 411 | [[package]] 412 | name = "from_variant" 413 | version = "0.1.3" 414 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 415 | dependencies = [ 416 | "pmutil", 417 | "proc-macro2", 418 | "swc_macros_common", 419 | "syn", 420 | ] 421 | 422 | [[package]] 423 | name = "generic-array" 424 | version = "0.14.5" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" 427 | dependencies = [ 428 | "typenum", 429 | "version_check", 430 | ] 431 | 432 | [[package]] 433 | name = "getrandom" 434 | version = "0.2.7" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" 437 | dependencies = [ 438 | "cfg-if 1.0.0", 439 | "libc", 440 | "wasi 0.11.0+wasi-snapshot-preview1", 441 | ] 442 | 443 | [[package]] 444 | name = "gimli" 445 | version = "0.26.1" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" 448 | 449 | [[package]] 450 | name = "hashbrown" 451 | version = "0.11.2" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 454 | dependencies = [ 455 | "ahash", 456 | ] 457 | 458 | [[package]] 459 | name = "hashbrown" 460 | version = "0.12.1" 461 | source = "registry+https://github.com/rust-lang/crates.io-index" 462 | checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" 463 | 464 | [[package]] 465 | name = "hermit-abi" 466 | version = "0.1.19" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 469 | dependencies = [ 470 | "libc", 471 | ] 472 | 473 | [[package]] 474 | name = "ident_case" 475 | version = "1.0.1" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 478 | 479 | [[package]] 480 | name = "idna" 481 | version = "0.2.3" 482 | source = "registry+https://github.com/rust-lang/crates.io-index" 483 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 484 | dependencies = [ 485 | "matches", 486 | "unicode-bidi", 487 | "unicode-normalization", 488 | ] 489 | 490 | [[package]] 491 | name = "if_chain" 492 | version = "1.0.2" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" 495 | 496 | [[package]] 497 | name = "indexmap" 498 | version = "1.9.0" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" 501 | dependencies = [ 502 | "autocfg", 503 | "hashbrown 0.12.1", 504 | "serde", 505 | ] 506 | 507 | [[package]] 508 | name = "is-macro" 509 | version = "0.2.1" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "1c068d4c6b922cd6284c609cfa6dec0e41615c9c5a1a4ba729a970d8daba05fb" 512 | dependencies = [ 513 | "Inflector", 514 | "pmutil", 515 | "proc-macro2", 516 | "quote", 517 | "syn", 518 | ] 519 | 520 | [[package]] 521 | name = "is_ci" 522 | version = "1.1.1" 523 | source = "registry+https://github.com/rust-lang/crates.io-index" 524 | checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" 525 | 526 | [[package]] 527 | name = "itertools" 528 | version = "0.10.3" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" 531 | dependencies = [ 532 | "either", 533 | ] 534 | 535 | [[package]] 536 | name = "itoa" 537 | version = "1.0.2" 538 | source = "registry+https://github.com/rust-lang/crates.io-index" 539 | checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" 540 | 541 | [[package]] 542 | name = "js-sys" 543 | version = "0.3.58" 544 | source = "registry+https://github.com/rust-lang/crates.io-index" 545 | checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" 546 | dependencies = [ 547 | "wasm-bindgen", 548 | ] 549 | 550 | [[package]] 551 | name = "json_comments" 552 | version = "0.2.1" 553 | source = "registry+https://github.com/rust-lang/crates.io-index" 554 | checksum = "41ee439ee368ba4a77ac70d04f14015415af8600d6c894dc1f11bd79758c57d5" 555 | 556 | [[package]] 557 | name = "lazy_static" 558 | version = "1.4.0" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 561 | 562 | [[package]] 563 | name = "lexical" 564 | version = "6.1.1" 565 | source = "registry+https://github.com/rust-lang/crates.io-index" 566 | checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6" 567 | dependencies = [ 568 | "lexical-core", 569 | ] 570 | 571 | [[package]] 572 | name = "lexical-core" 573 | version = "0.8.5" 574 | source = "registry+https://github.com/rust-lang/crates.io-index" 575 | checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" 576 | dependencies = [ 577 | "lexical-parse-float", 578 | "lexical-parse-integer", 579 | "lexical-util", 580 | "lexical-write-float", 581 | "lexical-write-integer", 582 | ] 583 | 584 | [[package]] 585 | name = "lexical-parse-float" 586 | version = "0.8.5" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" 589 | dependencies = [ 590 | "lexical-parse-integer", 591 | "lexical-util", 592 | "static_assertions", 593 | ] 594 | 595 | [[package]] 596 | name = "lexical-parse-integer" 597 | version = "0.8.6" 598 | source = "registry+https://github.com/rust-lang/crates.io-index" 599 | checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" 600 | dependencies = [ 601 | "lexical-util", 602 | "static_assertions", 603 | ] 604 | 605 | [[package]] 606 | name = "lexical-util" 607 | version = "0.8.5" 608 | source = "registry+https://github.com/rust-lang/crates.io-index" 609 | checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" 610 | dependencies = [ 611 | "static_assertions", 612 | ] 613 | 614 | [[package]] 615 | name = "lexical-write-float" 616 | version = "0.8.5" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" 619 | dependencies = [ 620 | "lexical-util", 621 | "lexical-write-integer", 622 | "static_assertions", 623 | ] 624 | 625 | [[package]] 626 | name = "lexical-write-integer" 627 | version = "0.8.5" 628 | source = "registry+https://github.com/rust-lang/crates.io-index" 629 | checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" 630 | dependencies = [ 631 | "lexical-util", 632 | "static_assertions", 633 | ] 634 | 635 | [[package]] 636 | name = "libc" 637 | version = "0.2.126" 638 | source = "registry+https://github.com/rust-lang/crates.io-index" 639 | checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" 640 | 641 | [[package]] 642 | name = "lock_api" 643 | version = "0.4.7" 644 | source = "registry+https://github.com/rust-lang/crates.io-index" 645 | checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" 646 | dependencies = [ 647 | "autocfg", 648 | "scopeguard", 649 | ] 650 | 651 | [[package]] 652 | name = "log" 653 | version = "0.4.17" 654 | source = "registry+https://github.com/rust-lang/crates.io-index" 655 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 656 | dependencies = [ 657 | "cfg-if 1.0.0", 658 | ] 659 | 660 | [[package]] 661 | name = "lru" 662 | version = "0.7.7" 663 | source = "registry+https://github.com/rust-lang/crates.io-index" 664 | checksum = "c84e6fe5655adc6ce00787cf7dcaf8dc4f998a0565d23eafc207a8b08ca3349a" 665 | dependencies = [ 666 | "hashbrown 0.11.2", 667 | ] 668 | 669 | [[package]] 670 | name = "matches" 671 | version = "0.1.9" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 674 | 675 | [[package]] 676 | name = "memchr" 677 | version = "2.5.0" 678 | source = "registry+https://github.com/rust-lang/crates.io-index" 679 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 680 | 681 | [[package]] 682 | name = "memoffset" 683 | version = "0.6.5" 684 | source = "registry+https://github.com/rust-lang/crates.io-index" 685 | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" 686 | dependencies = [ 687 | "autocfg", 688 | ] 689 | 690 | [[package]] 691 | name = "memory_units" 692 | version = "0.4.0" 693 | source = "registry+https://github.com/rust-lang/crates.io-index" 694 | checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" 695 | 696 | [[package]] 697 | name = "miette" 698 | version = "4.7.1" 699 | source = "registry+https://github.com/rust-lang/crates.io-index" 700 | checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" 701 | dependencies = [ 702 | "atty", 703 | "backtrace", 704 | "miette-derive", 705 | "once_cell", 706 | "owo-colors", 707 | "supports-color", 708 | "supports-hyperlinks", 709 | "supports-unicode", 710 | "terminal_size", 711 | "textwrap", 712 | "thiserror", 713 | "unicode-width", 714 | ] 715 | 716 | [[package]] 717 | name = "miette-derive" 718 | version = "4.7.1" 719 | source = "registry+https://github.com/rust-lang/crates.io-index" 720 | checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c" 721 | dependencies = [ 722 | "proc-macro2", 723 | "quote", 724 | "syn", 725 | ] 726 | 727 | [[package]] 728 | name = "minimal-lexical" 729 | version = "0.2.1" 730 | source = "registry+https://github.com/rust-lang/crates.io-index" 731 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 732 | 733 | [[package]] 734 | name = "miniz_oxide" 735 | version = "0.5.3" 736 | source = "registry+https://github.com/rust-lang/crates.io-index" 737 | checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" 738 | dependencies = [ 739 | "adler", 740 | ] 741 | 742 | [[package]] 743 | name = "new_debug_unreachable" 744 | version = "1.0.4" 745 | source = "registry+https://github.com/rust-lang/crates.io-index" 746 | checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" 747 | 748 | [[package]] 749 | name = "nom" 750 | version = "7.1.1" 751 | source = "registry+https://github.com/rust-lang/crates.io-index" 752 | checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" 753 | dependencies = [ 754 | "memchr", 755 | "minimal-lexical", 756 | ] 757 | 758 | [[package]] 759 | name = "normpath" 760 | version = "0.2.0" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "2a9da8c9922c35a1033d76f7272dfc2e7ee20392083d75aeea6ced23c6266578" 763 | dependencies = [ 764 | "winapi", 765 | ] 766 | 767 | [[package]] 768 | name = "num-bigint" 769 | version = "0.4.3" 770 | source = "registry+https://github.com/rust-lang/crates.io-index" 771 | checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" 772 | dependencies = [ 773 | "autocfg", 774 | "num-integer", 775 | "num-traits", 776 | "serde", 777 | ] 778 | 779 | [[package]] 780 | name = "num-integer" 781 | version = "0.1.45" 782 | source = "registry+https://github.com/rust-lang/crates.io-index" 783 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 784 | dependencies = [ 785 | "autocfg", 786 | "num-traits", 787 | ] 788 | 789 | [[package]] 790 | name = "num-traits" 791 | version = "0.2.15" 792 | source = "registry+https://github.com/rust-lang/crates.io-index" 793 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 794 | dependencies = [ 795 | "autocfg", 796 | ] 797 | 798 | [[package]] 799 | name = "num_cpus" 800 | version = "1.13.1" 801 | source = "registry+https://github.com/rust-lang/crates.io-index" 802 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 803 | dependencies = [ 804 | "hermit-abi", 805 | "libc", 806 | ] 807 | 808 | [[package]] 809 | name = "object" 810 | version = "0.28.4" 811 | source = "registry+https://github.com/rust-lang/crates.io-index" 812 | checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" 813 | dependencies = [ 814 | "memchr", 815 | ] 816 | 817 | [[package]] 818 | name = "once_cell" 819 | version = "1.12.0" 820 | source = "registry+https://github.com/rust-lang/crates.io-index" 821 | checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" 822 | 823 | [[package]] 824 | name = "ordered-float" 825 | version = "2.10.0" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" 828 | dependencies = [ 829 | "num-traits", 830 | ] 831 | 832 | [[package]] 833 | name = "owo-colors" 834 | version = "3.4.0" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b" 837 | 838 | [[package]] 839 | name = "parking_lot" 840 | version = "0.12.1" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 843 | dependencies = [ 844 | "lock_api", 845 | "parking_lot_core", 846 | ] 847 | 848 | [[package]] 849 | name = "parking_lot_core" 850 | version = "0.9.3" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" 853 | dependencies = [ 854 | "cfg-if 1.0.0", 855 | "libc", 856 | "redox_syscall", 857 | "smallvec", 858 | "windows-sys", 859 | ] 860 | 861 | [[package]] 862 | name = "path-clean" 863 | version = "0.1.0" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" 866 | 867 | [[package]] 868 | name = "pathdiff" 869 | version = "0.2.1" 870 | source = "registry+https://github.com/rust-lang/crates.io-index" 871 | checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" 872 | 873 | [[package]] 874 | name = "percent-encoding" 875 | version = "2.1.0" 876 | source = "registry+https://github.com/rust-lang/crates.io-index" 877 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 878 | 879 | [[package]] 880 | name = "phf" 881 | version = "0.10.1" 882 | source = "registry+https://github.com/rust-lang/crates.io-index" 883 | checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" 884 | dependencies = [ 885 | "phf_macros", 886 | "phf_shared", 887 | "proc-macro-hack", 888 | ] 889 | 890 | [[package]] 891 | name = "phf_generator" 892 | version = "0.10.0" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" 895 | dependencies = [ 896 | "phf_shared", 897 | "rand", 898 | ] 899 | 900 | [[package]] 901 | name = "phf_macros" 902 | version = "0.10.0" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" 905 | dependencies = [ 906 | "phf_generator", 907 | "phf_shared", 908 | "proc-macro-hack", 909 | "proc-macro2", 910 | "quote", 911 | "syn", 912 | ] 913 | 914 | [[package]] 915 | name = "phf_shared" 916 | version = "0.10.0" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" 919 | dependencies = [ 920 | "siphasher", 921 | ] 922 | 923 | [[package]] 924 | name = "pin-project-lite" 925 | version = "0.2.9" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 928 | 929 | [[package]] 930 | name = "pmutil" 931 | version = "0.5.3" 932 | source = "registry+https://github.com/rust-lang/crates.io-index" 933 | checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004" 934 | dependencies = [ 935 | "proc-macro2", 936 | "quote", 937 | "syn", 938 | ] 939 | 940 | [[package]] 941 | name = "ppv-lite86" 942 | version = "0.2.16" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 945 | 946 | [[package]] 947 | name = "precomputed-hash" 948 | version = "0.1.1" 949 | source = "registry+https://github.com/rust-lang/crates.io-index" 950 | checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" 951 | 952 | [[package]] 953 | name = "preset_env_base" 954 | version = "0.2.3" 955 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 956 | dependencies = [ 957 | "ahash", 958 | "anyhow", 959 | "browserslist-rs", 960 | "dashmap", 961 | "from_variant", 962 | "once_cell", 963 | "semver 1.0.10", 964 | "serde", 965 | "st-map", 966 | "tracing", 967 | ] 968 | 969 | [[package]] 970 | name = "proc-macro-error" 971 | version = "1.0.4" 972 | source = "registry+https://github.com/rust-lang/crates.io-index" 973 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 974 | dependencies = [ 975 | "proc-macro-error-attr", 976 | "proc-macro2", 977 | "quote", 978 | "syn", 979 | "version_check", 980 | ] 981 | 982 | [[package]] 983 | name = "proc-macro-error-attr" 984 | version = "1.0.4" 985 | source = "registry+https://github.com/rust-lang/crates.io-index" 986 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 987 | dependencies = [ 988 | "proc-macro2", 989 | "quote", 990 | "version_check", 991 | ] 992 | 993 | [[package]] 994 | name = "proc-macro-hack" 995 | version = "0.5.19" 996 | source = "registry+https://github.com/rust-lang/crates.io-index" 997 | checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" 998 | 999 | [[package]] 1000 | name = "proc-macro2" 1001 | version = "1.0.39" 1002 | source = "registry+https://github.com/rust-lang/crates.io-index" 1003 | checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" 1004 | dependencies = [ 1005 | "unicode-ident", 1006 | ] 1007 | 1008 | [[package]] 1009 | name = "quote" 1010 | version = "1.0.19" 1011 | source = "registry+https://github.com/rust-lang/crates.io-index" 1012 | checksum = "f53dc8cf16a769a6f677e09e7ff2cd4be1ea0f48754aac39520536962011de0d" 1013 | dependencies = [ 1014 | "proc-macro2", 1015 | ] 1016 | 1017 | [[package]] 1018 | name = "rand" 1019 | version = "0.8.5" 1020 | source = "registry+https://github.com/rust-lang/crates.io-index" 1021 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1022 | dependencies = [ 1023 | "libc", 1024 | "rand_chacha", 1025 | "rand_core", 1026 | ] 1027 | 1028 | [[package]] 1029 | name = "rand_chacha" 1030 | version = "0.3.1" 1031 | source = "registry+https://github.com/rust-lang/crates.io-index" 1032 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1033 | dependencies = [ 1034 | "ppv-lite86", 1035 | "rand_core", 1036 | ] 1037 | 1038 | [[package]] 1039 | name = "rand_core" 1040 | version = "0.6.3" 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" 1042 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 1043 | dependencies = [ 1044 | "getrandom", 1045 | ] 1046 | 1047 | [[package]] 1048 | name = "rayon" 1049 | version = "1.5.3" 1050 | source = "registry+https://github.com/rust-lang/crates.io-index" 1051 | checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" 1052 | dependencies = [ 1053 | "autocfg", 1054 | "crossbeam-deque", 1055 | "either", 1056 | "rayon-core", 1057 | ] 1058 | 1059 | [[package]] 1060 | name = "rayon-core" 1061 | version = "1.9.3" 1062 | source = "registry+https://github.com/rust-lang/crates.io-index" 1063 | checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" 1064 | dependencies = [ 1065 | "crossbeam-channel", 1066 | "crossbeam-deque", 1067 | "crossbeam-utils", 1068 | "num_cpus", 1069 | ] 1070 | 1071 | [[package]] 1072 | name = "redox_syscall" 1073 | version = "0.2.13" 1074 | source = "registry+https://github.com/rust-lang/crates.io-index" 1075 | checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" 1076 | dependencies = [ 1077 | "bitflags", 1078 | ] 1079 | 1080 | [[package]] 1081 | name = "regex" 1082 | version = "1.5.6" 1083 | source = "registry+https://github.com/rust-lang/crates.io-index" 1084 | checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" 1085 | dependencies = [ 1086 | "aho-corasick", 1087 | "memchr", 1088 | "regex-syntax", 1089 | ] 1090 | 1091 | [[package]] 1092 | name = "regex-syntax" 1093 | version = "0.6.26" 1094 | source = "registry+https://github.com/rust-lang/crates.io-index" 1095 | checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" 1096 | 1097 | [[package]] 1098 | name = "retain_mut" 1099 | version = "0.1.9" 1100 | source = "registry+https://github.com/rust-lang/crates.io-index" 1101 | checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" 1102 | 1103 | [[package]] 1104 | name = "rustc-demangle" 1105 | version = "0.1.21" 1106 | source = "registry+https://github.com/rust-lang/crates.io-index" 1107 | checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" 1108 | 1109 | [[package]] 1110 | name = "rustc-hash" 1111 | version = "1.1.0" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 1114 | 1115 | [[package]] 1116 | name = "rustc_version" 1117 | version = "0.2.3" 1118 | source = "registry+https://github.com/rust-lang/crates.io-index" 1119 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 1120 | dependencies = [ 1121 | "semver 0.9.0", 1122 | ] 1123 | 1124 | [[package]] 1125 | name = "ryu" 1126 | version = "1.0.10" 1127 | source = "registry+https://github.com/rust-lang/crates.io-index" 1128 | checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" 1129 | 1130 | [[package]] 1131 | name = "scoped-tls" 1132 | version = "1.0.0" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" 1135 | 1136 | [[package]] 1137 | name = "scopeguard" 1138 | version = "1.1.0" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1141 | 1142 | [[package]] 1143 | name = "semver" 1144 | version = "0.9.0" 1145 | source = "registry+https://github.com/rust-lang/crates.io-index" 1146 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 1147 | dependencies = [ 1148 | "semver-parser", 1149 | ] 1150 | 1151 | [[package]] 1152 | name = "semver" 1153 | version = "1.0.10" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" 1156 | dependencies = [ 1157 | "serde", 1158 | ] 1159 | 1160 | [[package]] 1161 | name = "semver-parser" 1162 | version = "0.7.0" 1163 | source = "registry+https://github.com/rust-lang/crates.io-index" 1164 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 1165 | 1166 | [[package]] 1167 | name = "serde" 1168 | version = "1.0.137" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" 1171 | dependencies = [ 1172 | "serde_derive", 1173 | ] 1174 | 1175 | [[package]] 1176 | name = "serde-wasm-bindgen" 1177 | version = "0.3.1" 1178 | source = "registry+https://github.com/rust-lang/crates.io-index" 1179 | checksum = "618365e8e586c22123d692b72a7d791d5ee697817b65a218cdf12a98870af0f7" 1180 | dependencies = [ 1181 | "fnv", 1182 | "js-sys", 1183 | "serde", 1184 | "wasm-bindgen", 1185 | ] 1186 | 1187 | [[package]] 1188 | name = "serde_derive" 1189 | version = "1.0.137" 1190 | source = "registry+https://github.com/rust-lang/crates.io-index" 1191 | checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" 1192 | dependencies = [ 1193 | "proc-macro2", 1194 | "quote", 1195 | "syn", 1196 | ] 1197 | 1198 | [[package]] 1199 | name = "serde_json" 1200 | version = "1.0.81" 1201 | source = "registry+https://github.com/rust-lang/crates.io-index" 1202 | checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" 1203 | dependencies = [ 1204 | "itoa", 1205 | "ryu", 1206 | "serde", 1207 | ] 1208 | 1209 | [[package]] 1210 | name = "sha-1" 1211 | version = "0.10.0" 1212 | source = "registry+https://github.com/rust-lang/crates.io-index" 1213 | checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" 1214 | dependencies = [ 1215 | "cfg-if 1.0.0", 1216 | "cpufeatures", 1217 | "digest", 1218 | ] 1219 | 1220 | [[package]] 1221 | name = "siphasher" 1222 | version = "0.3.10" 1223 | source = "registry+https://github.com/rust-lang/crates.io-index" 1224 | checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" 1225 | 1226 | [[package]] 1227 | name = "smallvec" 1228 | version = "1.8.0" 1229 | source = "registry+https://github.com/rust-lang/crates.io-index" 1230 | checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" 1231 | 1232 | [[package]] 1233 | name = "smawk" 1234 | version = "0.3.1" 1235 | source = "registry+https://github.com/rust-lang/crates.io-index" 1236 | checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" 1237 | 1238 | [[package]] 1239 | name = "sourcemap" 1240 | version = "6.0.2" 1241 | source = "registry+https://github.com/rust-lang/crates.io-index" 1242 | checksum = "a2ca89636b276071e7276488131f531dbf43ad1c19bc4bd5a04f6a0ce1ddc138" 1243 | dependencies = [ 1244 | "base64 0.11.0", 1245 | "if_chain", 1246 | "lazy_static", 1247 | "regex", 1248 | "rustc_version", 1249 | "serde", 1250 | "serde_json", 1251 | "url", 1252 | ] 1253 | 1254 | [[package]] 1255 | name = "st-map" 1256 | version = "0.1.6" 1257 | source = "registry+https://github.com/rust-lang/crates.io-index" 1258 | checksum = "bc9c9f3a1df5f73b7392bd9773108fef41ad9126f0282412fd5904389f0c0c4f" 1259 | dependencies = [ 1260 | "arrayvec", 1261 | "static-map-macro", 1262 | ] 1263 | 1264 | [[package]] 1265 | name = "static-map-macro" 1266 | version = "0.2.3" 1267 | source = "registry+https://github.com/rust-lang/crates.io-index" 1268 | checksum = "752564de9cd8937fdbc1c55d47ac391758c352ab3755607cc391b659fe87d56b" 1269 | dependencies = [ 1270 | "pmutil", 1271 | "proc-macro2", 1272 | "quote", 1273 | "syn", 1274 | ] 1275 | 1276 | [[package]] 1277 | name = "static_assertions" 1278 | version = "1.1.0" 1279 | source = "registry+https://github.com/rust-lang/crates.io-index" 1280 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1281 | 1282 | [[package]] 1283 | name = "string_cache" 1284 | version = "0.8.4" 1285 | source = "registry+https://github.com/rust-lang/crates.io-index" 1286 | checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" 1287 | dependencies = [ 1288 | "new_debug_unreachable", 1289 | "once_cell", 1290 | "parking_lot", 1291 | "phf_shared", 1292 | "precomputed-hash", 1293 | "serde", 1294 | ] 1295 | 1296 | [[package]] 1297 | name = "string_cache_codegen" 1298 | version = "0.5.2" 1299 | source = "registry+https://github.com/rust-lang/crates.io-index" 1300 | checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" 1301 | dependencies = [ 1302 | "phf_generator", 1303 | "phf_shared", 1304 | "proc-macro2", 1305 | "quote", 1306 | ] 1307 | 1308 | [[package]] 1309 | name = "string_enum" 1310 | version = "0.3.1" 1311 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1312 | dependencies = [ 1313 | "pmutil", 1314 | "proc-macro2", 1315 | "quote", 1316 | "swc_macros_common", 1317 | "syn", 1318 | ] 1319 | 1320 | [[package]] 1321 | name = "strsim" 1322 | version = "0.10.0" 1323 | source = "registry+https://github.com/rust-lang/crates.io-index" 1324 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1325 | 1326 | [[package]] 1327 | name = "supports-color" 1328 | version = "1.3.0" 1329 | source = "registry+https://github.com/rust-lang/crates.io-index" 1330 | checksum = "4872ced36b91d47bae8a214a683fe54e7078875b399dfa251df346c9b547d1f9" 1331 | dependencies = [ 1332 | "atty", 1333 | "is_ci", 1334 | ] 1335 | 1336 | [[package]] 1337 | name = "supports-hyperlinks" 1338 | version = "1.2.0" 1339 | source = "registry+https://github.com/rust-lang/crates.io-index" 1340 | checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406" 1341 | dependencies = [ 1342 | "atty", 1343 | ] 1344 | 1345 | [[package]] 1346 | name = "supports-unicode" 1347 | version = "1.0.2" 1348 | source = "registry+https://github.com/rust-lang/crates.io-index" 1349 | checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2" 1350 | dependencies = [ 1351 | "atty", 1352 | ] 1353 | 1354 | [[package]] 1355 | name = "swc" 1356 | version = "0.183.0" 1357 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1358 | dependencies = [ 1359 | "ahash", 1360 | "anyhow", 1361 | "base64 0.13.0", 1362 | "dashmap", 1363 | "either", 1364 | "indexmap", 1365 | "json_comments", 1366 | "lru", 1367 | "once_cell", 1368 | "parking_lot", 1369 | "pathdiff", 1370 | "regex", 1371 | "rustc-hash", 1372 | "serde", 1373 | "serde_json", 1374 | "sourcemap", 1375 | "swc_atoms", 1376 | "swc_cached", 1377 | "swc_common", 1378 | "swc_config", 1379 | "swc_ecma_ast", 1380 | "swc_ecma_codegen", 1381 | "swc_ecma_ext_transforms", 1382 | "swc_ecma_lints", 1383 | "swc_ecma_loader", 1384 | "swc_ecma_minifier", 1385 | "swc_ecma_parser", 1386 | "swc_ecma_preset_env", 1387 | "swc_ecma_transforms", 1388 | "swc_ecma_transforms_base", 1389 | "swc_ecma_transforms_compat", 1390 | "swc_ecma_transforms_optimization", 1391 | "swc_ecma_utils", 1392 | "swc_ecma_visit", 1393 | "swc_ecmascript", 1394 | "swc_error_reporters", 1395 | "swc_node_comments", 1396 | "swc_timer", 1397 | "swc_visit", 1398 | "tracing", 1399 | ] 1400 | 1401 | [[package]] 1402 | name = "swc_atoms" 1403 | version = "0.2.11" 1404 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1405 | dependencies = [ 1406 | "string_cache", 1407 | "string_cache_codegen", 1408 | ] 1409 | 1410 | [[package]] 1411 | name = "swc_cached" 1412 | version = "0.1.1" 1413 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1414 | dependencies = [ 1415 | "ahash", 1416 | "anyhow", 1417 | "dashmap", 1418 | "once_cell", 1419 | "regex", 1420 | "serde", 1421 | "swc_atoms", 1422 | ] 1423 | 1424 | [[package]] 1425 | name = "swc_common" 1426 | version = "0.18.7" 1427 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1428 | dependencies = [ 1429 | "ahash", 1430 | "ast_node", 1431 | "better_scoped_tls", 1432 | "cfg-if 1.0.0", 1433 | "debug_unreachable", 1434 | "either", 1435 | "from_variant", 1436 | "num-bigint", 1437 | "once_cell", 1438 | "parking_lot", 1439 | "rustc-hash", 1440 | "serde", 1441 | "siphasher", 1442 | "sourcemap", 1443 | "string_cache", 1444 | "swc_eq_ignore_macros", 1445 | "swc_visit", 1446 | "tracing", 1447 | "unicode-width", 1448 | "url", 1449 | ] 1450 | 1451 | [[package]] 1452 | name = "swc_config" 1453 | version = "0.1.1" 1454 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1455 | dependencies = [ 1456 | "anyhow", 1457 | "indexmap", 1458 | "serde", 1459 | "serde_json", 1460 | "swc_config_macro", 1461 | ] 1462 | 1463 | [[package]] 1464 | name = "swc_config_macro" 1465 | version = "0.1.0" 1466 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1467 | dependencies = [ 1468 | "pmutil", 1469 | "proc-macro2", 1470 | "quote", 1471 | "swc_macros_common", 1472 | "syn", 1473 | ] 1474 | 1475 | [[package]] 1476 | name = "swc_ecma_ast" 1477 | version = "0.78.1" 1478 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1479 | dependencies = [ 1480 | "is-macro", 1481 | "num-bigint", 1482 | "scoped-tls", 1483 | "serde", 1484 | "string_enum", 1485 | "swc_atoms", 1486 | "swc_common", 1487 | "unicode-id", 1488 | ] 1489 | 1490 | [[package]] 1491 | name = "swc_ecma_codegen" 1492 | version = "0.108.6" 1493 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1494 | dependencies = [ 1495 | "bitflags", 1496 | "memchr", 1497 | "num-bigint", 1498 | "once_cell", 1499 | "rustc-hash", 1500 | "sourcemap", 1501 | "swc_atoms", 1502 | "swc_common", 1503 | "swc_ecma_ast", 1504 | "swc_ecma_codegen_macros", 1505 | "tracing", 1506 | ] 1507 | 1508 | [[package]] 1509 | name = "swc_ecma_codegen_macros" 1510 | version = "0.7.0" 1511 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1512 | dependencies = [ 1513 | "pmutil", 1514 | "proc-macro2", 1515 | "quote", 1516 | "swc_macros_common", 1517 | "syn", 1518 | ] 1519 | 1520 | [[package]] 1521 | name = "swc_ecma_ext_transforms" 1522 | version = "0.71.0" 1523 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1524 | dependencies = [ 1525 | "phf", 1526 | "swc_atoms", 1527 | "swc_common", 1528 | "swc_ecma_ast", 1529 | "swc_ecma_utils", 1530 | "swc_ecma_visit", 1531 | ] 1532 | 1533 | [[package]] 1534 | name = "swc_ecma_lints" 1535 | version = "0.42.0" 1536 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1537 | dependencies = [ 1538 | "ahash", 1539 | "auto_impl", 1540 | "dashmap", 1541 | "parking_lot", 1542 | "rayon", 1543 | "regex", 1544 | "serde", 1545 | "swc_atoms", 1546 | "swc_common", 1547 | "swc_config", 1548 | "swc_ecma_ast", 1549 | "swc_ecma_utils", 1550 | "swc_ecma_visit", 1551 | ] 1552 | 1553 | [[package]] 1554 | name = "swc_ecma_loader" 1555 | version = "0.30.2" 1556 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1557 | dependencies = [ 1558 | "ahash", 1559 | "anyhow", 1560 | "dashmap", 1561 | "lru", 1562 | "normpath", 1563 | "once_cell", 1564 | "parking_lot", 1565 | "path-clean", 1566 | "pathdiff", 1567 | "serde", 1568 | "serde_json", 1569 | "swc_cached", 1570 | "swc_common", 1571 | "tracing", 1572 | ] 1573 | 1574 | [[package]] 1575 | name = "swc_ecma_minifier" 1576 | version = "0.116.4" 1577 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1578 | dependencies = [ 1579 | "ahash", 1580 | "arrayvec", 1581 | "indexmap", 1582 | "once_cell", 1583 | "parking_lot", 1584 | "rayon", 1585 | "regex", 1586 | "retain_mut", 1587 | "rustc-hash", 1588 | "serde", 1589 | "serde_json", 1590 | "swc_atoms", 1591 | "swc_cached", 1592 | "swc_common", 1593 | "swc_config", 1594 | "swc_ecma_ast", 1595 | "swc_ecma_codegen", 1596 | "swc_ecma_parser", 1597 | "swc_ecma_transforms_base", 1598 | "swc_ecma_transforms_optimization", 1599 | "swc_ecma_utils", 1600 | "swc_ecma_visit", 1601 | "swc_timer", 1602 | "tracing", 1603 | "unicode-id", 1604 | ] 1605 | 1606 | [[package]] 1607 | name = "swc_ecma_parser" 1608 | version = "0.104.2" 1609 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1610 | dependencies = [ 1611 | "either", 1612 | "enum_kind", 1613 | "lexical", 1614 | "num-bigint", 1615 | "serde", 1616 | "smallvec", 1617 | "swc_atoms", 1618 | "swc_common", 1619 | "swc_ecma_ast", 1620 | "tracing", 1621 | "typed-arena", 1622 | ] 1623 | 1624 | [[package]] 1625 | name = "swc_ecma_preset_env" 1626 | version = "0.131.0" 1627 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1628 | dependencies = [ 1629 | "ahash", 1630 | "anyhow", 1631 | "dashmap", 1632 | "indexmap", 1633 | "once_cell", 1634 | "preset_env_base", 1635 | "semver 1.0.10", 1636 | "serde", 1637 | "serde_json", 1638 | "st-map", 1639 | "string_enum", 1640 | "swc_atoms", 1641 | "swc_common", 1642 | "swc_ecma_ast", 1643 | "swc_ecma_transforms", 1644 | "swc_ecma_utils", 1645 | "swc_ecma_visit", 1646 | ] 1647 | 1648 | [[package]] 1649 | name = "swc_ecma_transforms" 1650 | version = "0.156.0" 1651 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1652 | dependencies = [ 1653 | "swc_atoms", 1654 | "swc_common", 1655 | "swc_ecma_ast", 1656 | "swc_ecma_transforms_base", 1657 | "swc_ecma_transforms_compat", 1658 | "swc_ecma_transforms_module", 1659 | "swc_ecma_transforms_optimization", 1660 | "swc_ecma_transforms_proposal", 1661 | "swc_ecma_transforms_react", 1662 | "swc_ecma_transforms_typescript", 1663 | "swc_ecma_utils", 1664 | "swc_ecma_visit", 1665 | ] 1666 | 1667 | [[package]] 1668 | name = "swc_ecma_transforms_base" 1669 | version = "0.86.0" 1670 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1671 | dependencies = [ 1672 | "better_scoped_tls", 1673 | "once_cell", 1674 | "phf", 1675 | "rustc-hash", 1676 | "serde", 1677 | "smallvec", 1678 | "swc_atoms", 1679 | "swc_common", 1680 | "swc_ecma_ast", 1681 | "swc_ecma_parser", 1682 | "swc_ecma_utils", 1683 | "swc_ecma_visit", 1684 | "tracing", 1685 | ] 1686 | 1687 | [[package]] 1688 | name = "swc_ecma_transforms_classes" 1689 | version = "0.74.0" 1690 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1691 | dependencies = [ 1692 | "swc_atoms", 1693 | "swc_common", 1694 | "swc_ecma_ast", 1695 | "swc_ecma_transforms_base", 1696 | "swc_ecma_utils", 1697 | "swc_ecma_visit", 1698 | ] 1699 | 1700 | [[package]] 1701 | name = "swc_ecma_transforms_compat" 1702 | version = "0.101.1" 1703 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1704 | dependencies = [ 1705 | "ahash", 1706 | "arrayvec", 1707 | "indexmap", 1708 | "is-macro", 1709 | "num-bigint", 1710 | "ordered-float", 1711 | "serde", 1712 | "smallvec", 1713 | "swc_atoms", 1714 | "swc_common", 1715 | "swc_config", 1716 | "swc_ecma_ast", 1717 | "swc_ecma_transforms_base", 1718 | "swc_ecma_transforms_classes", 1719 | "swc_ecma_transforms_macros", 1720 | "swc_ecma_utils", 1721 | "swc_ecma_visit", 1722 | "swc_trace_macro", 1723 | "tracing", 1724 | ] 1725 | 1726 | [[package]] 1727 | name = "swc_ecma_transforms_macros" 1728 | version = "0.4.0" 1729 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1730 | dependencies = [ 1731 | "pmutil", 1732 | "proc-macro2", 1733 | "quote", 1734 | "swc_macros_common", 1735 | "syn", 1736 | ] 1737 | 1738 | [[package]] 1739 | name = "swc_ecma_transforms_module" 1740 | version = "0.114.0" 1741 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1742 | dependencies = [ 1743 | "Inflector", 1744 | "ahash", 1745 | "anyhow", 1746 | "indexmap", 1747 | "path-clean", 1748 | "pathdiff", 1749 | "serde", 1750 | "swc_atoms", 1751 | "swc_cached", 1752 | "swc_common", 1753 | "swc_ecma_ast", 1754 | "swc_ecma_loader", 1755 | "swc_ecma_parser", 1756 | "swc_ecma_transforms_base", 1757 | "swc_ecma_utils", 1758 | "swc_ecma_visit", 1759 | "tracing", 1760 | ] 1761 | 1762 | [[package]] 1763 | name = "swc_ecma_transforms_optimization" 1764 | version = "0.126.0" 1765 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1766 | dependencies = [ 1767 | "ahash", 1768 | "dashmap", 1769 | "indexmap", 1770 | "once_cell", 1771 | "rustc-hash", 1772 | "serde_json", 1773 | "swc_atoms", 1774 | "swc_common", 1775 | "swc_ecma_ast", 1776 | "swc_ecma_parser", 1777 | "swc_ecma_transforms_base", 1778 | "swc_ecma_transforms_macros", 1779 | "swc_ecma_utils", 1780 | "swc_ecma_visit", 1781 | "tracing", 1782 | ] 1783 | 1784 | [[package]] 1785 | name = "swc_ecma_transforms_proposal" 1786 | version = "0.109.0" 1787 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1788 | dependencies = [ 1789 | "either", 1790 | "serde", 1791 | "smallvec", 1792 | "swc_atoms", 1793 | "swc_common", 1794 | "swc_ecma_ast", 1795 | "swc_ecma_transforms_base", 1796 | "swc_ecma_transforms_classes", 1797 | "swc_ecma_transforms_macros", 1798 | "swc_ecma_utils", 1799 | "swc_ecma_visit", 1800 | ] 1801 | 1802 | [[package]] 1803 | name = "swc_ecma_transforms_react" 1804 | version = "0.116.0" 1805 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1806 | dependencies = [ 1807 | "ahash", 1808 | "base64 0.13.0", 1809 | "dashmap", 1810 | "indexmap", 1811 | "once_cell", 1812 | "regex", 1813 | "serde", 1814 | "sha-1", 1815 | "string_enum", 1816 | "swc_atoms", 1817 | "swc_common", 1818 | "swc_config", 1819 | "swc_ecma_ast", 1820 | "swc_ecma_parser", 1821 | "swc_ecma_transforms_base", 1822 | "swc_ecma_transforms_macros", 1823 | "swc_ecma_utils", 1824 | "swc_ecma_visit", 1825 | ] 1826 | 1827 | [[package]] 1828 | name = "swc_ecma_transforms_typescript" 1829 | version = "0.119.0" 1830 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1831 | dependencies = [ 1832 | "serde", 1833 | "swc_atoms", 1834 | "swc_common", 1835 | "swc_ecma_ast", 1836 | "swc_ecma_transforms_base", 1837 | "swc_ecma_transforms_react", 1838 | "swc_ecma_utils", 1839 | "swc_ecma_visit", 1840 | ] 1841 | 1842 | [[package]] 1843 | name = "swc_ecma_utils" 1844 | version = "0.85.1" 1845 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1846 | dependencies = [ 1847 | "indexmap", 1848 | "once_cell", 1849 | "swc_atoms", 1850 | "swc_common", 1851 | "swc_ecma_ast", 1852 | "swc_ecma_visit", 1853 | "tracing", 1854 | ] 1855 | 1856 | [[package]] 1857 | name = "swc_ecma_visit" 1858 | version = "0.64.0" 1859 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1860 | dependencies = [ 1861 | "num-bigint", 1862 | "swc_atoms", 1863 | "swc_common", 1864 | "swc_ecma_ast", 1865 | "swc_visit", 1866 | "tracing", 1867 | ] 1868 | 1869 | [[package]] 1870 | name = "swc_ecmascript" 1871 | version = "0.159.0" 1872 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1873 | dependencies = [ 1874 | "swc_ecma_ast", 1875 | "swc_ecma_parser", 1876 | ] 1877 | 1878 | [[package]] 1879 | name = "swc_eq_ignore_macros" 1880 | version = "0.1.0" 1881 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1882 | dependencies = [ 1883 | "pmutil", 1884 | "proc-macro2", 1885 | "quote", 1886 | "syn", 1887 | ] 1888 | 1889 | [[package]] 1890 | name = "swc_error_reporters" 1891 | version = "0.2.0" 1892 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1893 | dependencies = [ 1894 | "anyhow", 1895 | "miette", 1896 | "once_cell", 1897 | "parking_lot", 1898 | "swc_common", 1899 | ] 1900 | 1901 | [[package]] 1902 | name = "swc_macros_common" 1903 | version = "0.3.5" 1904 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1905 | dependencies = [ 1906 | "pmutil", 1907 | "proc-macro2", 1908 | "quote", 1909 | "syn", 1910 | ] 1911 | 1912 | [[package]] 1913 | name = "swc_node_comments" 1914 | version = "0.5.0" 1915 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1916 | dependencies = [ 1917 | "ahash", 1918 | "dashmap", 1919 | "swc_common", 1920 | ] 1921 | 1922 | [[package]] 1923 | name = "swc_timer" 1924 | version = "0.6.0" 1925 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1926 | dependencies = [ 1927 | "tracing", 1928 | ] 1929 | 1930 | [[package]] 1931 | name = "swc_trace_macro" 1932 | version = "0.1.1" 1933 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1934 | dependencies = [ 1935 | "proc-macro2", 1936 | "quote", 1937 | "syn", 1938 | ] 1939 | 1940 | [[package]] 1941 | name = "swc_visit" 1942 | version = "0.3.0" 1943 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1944 | dependencies = [ 1945 | "either", 1946 | "swc_visit_macros", 1947 | ] 1948 | 1949 | [[package]] 1950 | name = "swc_visit_macros" 1951 | version = "0.3.1" 1952 | source = "git+https://github.com/swc-project/swc?rev=fd3501b#fd3501bf87f4e711e72e9e8fd12f64f4cfa08157" 1953 | dependencies = [ 1954 | "Inflector", 1955 | "pmutil", 1956 | "proc-macro2", 1957 | "quote", 1958 | "swc_macros_common", 1959 | "syn", 1960 | ] 1961 | 1962 | [[package]] 1963 | name = "syn" 1964 | version = "1.0.98" 1965 | source = "registry+https://github.com/rust-lang/crates.io-index" 1966 | checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" 1967 | dependencies = [ 1968 | "proc-macro2", 1969 | "quote", 1970 | "unicode-ident", 1971 | ] 1972 | 1973 | [[package]] 1974 | name = "terminal_size" 1975 | version = "0.1.17" 1976 | source = "registry+https://github.com/rust-lang/crates.io-index" 1977 | checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" 1978 | dependencies = [ 1979 | "libc", 1980 | "winapi", 1981 | ] 1982 | 1983 | [[package]] 1984 | name = "textwrap" 1985 | version = "0.15.0" 1986 | source = "registry+https://github.com/rust-lang/crates.io-index" 1987 | checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" 1988 | dependencies = [ 1989 | "smawk", 1990 | "unicode-linebreak", 1991 | "unicode-width", 1992 | ] 1993 | 1994 | [[package]] 1995 | name = "thiserror" 1996 | version = "1.0.31" 1997 | source = "registry+https://github.com/rust-lang/crates.io-index" 1998 | checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" 1999 | dependencies = [ 2000 | "thiserror-impl", 2001 | ] 2002 | 2003 | [[package]] 2004 | name = "thiserror-impl" 2005 | version = "1.0.31" 2006 | source = "registry+https://github.com/rust-lang/crates.io-index" 2007 | checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" 2008 | dependencies = [ 2009 | "proc-macro2", 2010 | "quote", 2011 | "syn", 2012 | ] 2013 | 2014 | [[package]] 2015 | name = "time" 2016 | version = "0.1.44" 2017 | source = "registry+https://github.com/rust-lang/crates.io-index" 2018 | checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" 2019 | dependencies = [ 2020 | "libc", 2021 | "wasi 0.10.0+wasi-snapshot-preview1", 2022 | "winapi", 2023 | ] 2024 | 2025 | [[package]] 2026 | name = "tinyvec" 2027 | version = "1.6.0" 2028 | source = "registry+https://github.com/rust-lang/crates.io-index" 2029 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 2030 | dependencies = [ 2031 | "tinyvec_macros", 2032 | ] 2033 | 2034 | [[package]] 2035 | name = "tinyvec_macros" 2036 | version = "0.1.0" 2037 | source = "registry+https://github.com/rust-lang/crates.io-index" 2038 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 2039 | 2040 | [[package]] 2041 | name = "tracing" 2042 | version = "0.1.35" 2043 | source = "registry+https://github.com/rust-lang/crates.io-index" 2044 | checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" 2045 | dependencies = [ 2046 | "cfg-if 1.0.0", 2047 | "pin-project-lite", 2048 | "tracing-attributes", 2049 | "tracing-core", 2050 | ] 2051 | 2052 | [[package]] 2053 | name = "tracing-attributes" 2054 | version = "0.1.21" 2055 | source = "registry+https://github.com/rust-lang/crates.io-index" 2056 | checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" 2057 | dependencies = [ 2058 | "proc-macro2", 2059 | "quote", 2060 | "syn", 2061 | ] 2062 | 2063 | [[package]] 2064 | name = "tracing-core" 2065 | version = "0.1.27" 2066 | source = "registry+https://github.com/rust-lang/crates.io-index" 2067 | checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921" 2068 | dependencies = [ 2069 | "once_cell", 2070 | ] 2071 | 2072 | [[package]] 2073 | name = "typed-arena" 2074 | version = "2.0.1" 2075 | source = "registry+https://github.com/rust-lang/crates.io-index" 2076 | checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" 2077 | 2078 | [[package]] 2079 | name = "typenum" 2080 | version = "1.15.0" 2081 | source = "registry+https://github.com/rust-lang/crates.io-index" 2082 | checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" 2083 | 2084 | [[package]] 2085 | name = "unicode-bidi" 2086 | version = "0.3.8" 2087 | source = "registry+https://github.com/rust-lang/crates.io-index" 2088 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" 2089 | 2090 | [[package]] 2091 | name = "unicode-id" 2092 | version = "0.3.2" 2093 | source = "registry+https://github.com/rust-lang/crates.io-index" 2094 | checksum = "69fe8d9274f490a36442acb4edfd0c4e473fdfc6a8b5cd32f28a0235761aedbe" 2095 | 2096 | [[package]] 2097 | name = "unicode-ident" 2098 | version = "1.0.1" 2099 | source = "registry+https://github.com/rust-lang/crates.io-index" 2100 | checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" 2101 | 2102 | [[package]] 2103 | name = "unicode-linebreak" 2104 | version = "0.1.2" 2105 | source = "registry+https://github.com/rust-lang/crates.io-index" 2106 | checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f" 2107 | dependencies = [ 2108 | "regex", 2109 | ] 2110 | 2111 | [[package]] 2112 | name = "unicode-normalization" 2113 | version = "0.1.19" 2114 | source = "registry+https://github.com/rust-lang/crates.io-index" 2115 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 2116 | dependencies = [ 2117 | "tinyvec", 2118 | ] 2119 | 2120 | [[package]] 2121 | name = "unicode-width" 2122 | version = "0.1.9" 2123 | source = "registry+https://github.com/rust-lang/crates.io-index" 2124 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 2125 | 2126 | [[package]] 2127 | name = "unreachable" 2128 | version = "0.1.1" 2129 | source = "registry+https://github.com/rust-lang/crates.io-index" 2130 | checksum = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" 2131 | dependencies = [ 2132 | "void", 2133 | ] 2134 | 2135 | [[package]] 2136 | name = "url" 2137 | version = "2.2.2" 2138 | source = "registry+https://github.com/rust-lang/crates.io-index" 2139 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 2140 | dependencies = [ 2141 | "form_urlencoded", 2142 | "idna", 2143 | "matches", 2144 | "percent-encoding", 2145 | ] 2146 | 2147 | [[package]] 2148 | name = "version_check" 2149 | version = "0.9.4" 2150 | source = "registry+https://github.com/rust-lang/crates.io-index" 2151 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 2152 | 2153 | [[package]] 2154 | name = "void" 2155 | version = "1.0.2" 2156 | source = "registry+https://github.com/rust-lang/crates.io-index" 2157 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 2158 | 2159 | [[package]] 2160 | name = "wasi" 2161 | version = "0.10.0+wasi-snapshot-preview1" 2162 | source = "registry+https://github.com/rust-lang/crates.io-index" 2163 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 2164 | 2165 | [[package]] 2166 | name = "wasi" 2167 | version = "0.11.0+wasi-snapshot-preview1" 2168 | source = "registry+https://github.com/rust-lang/crates.io-index" 2169 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2170 | 2171 | [[package]] 2172 | name = "wasm-bindgen" 2173 | version = "0.2.81" 2174 | source = "registry+https://github.com/rust-lang/crates.io-index" 2175 | checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" 2176 | dependencies = [ 2177 | "cfg-if 1.0.0", 2178 | "serde", 2179 | "serde_json", 2180 | "wasm-bindgen-macro", 2181 | ] 2182 | 2183 | [[package]] 2184 | name = "wasm-bindgen-backend" 2185 | version = "0.2.81" 2186 | source = "registry+https://github.com/rust-lang/crates.io-index" 2187 | checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" 2188 | dependencies = [ 2189 | "bumpalo", 2190 | "lazy_static", 2191 | "log", 2192 | "proc-macro2", 2193 | "quote", 2194 | "syn", 2195 | "wasm-bindgen-shared", 2196 | ] 2197 | 2198 | [[package]] 2199 | name = "wasm-bindgen-futures" 2200 | version = "0.4.31" 2201 | source = "registry+https://github.com/rust-lang/crates.io-index" 2202 | checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" 2203 | dependencies = [ 2204 | "cfg-if 1.0.0", 2205 | "js-sys", 2206 | "wasm-bindgen", 2207 | "web-sys", 2208 | ] 2209 | 2210 | [[package]] 2211 | name = "wasm-bindgen-macro" 2212 | version = "0.2.81" 2213 | source = "registry+https://github.com/rust-lang/crates.io-index" 2214 | checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" 2215 | dependencies = [ 2216 | "quote", 2217 | "wasm-bindgen-macro-support", 2218 | ] 2219 | 2220 | [[package]] 2221 | name = "wasm-bindgen-macro-support" 2222 | version = "0.2.81" 2223 | source = "registry+https://github.com/rust-lang/crates.io-index" 2224 | checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" 2225 | dependencies = [ 2226 | "proc-macro2", 2227 | "quote", 2228 | "syn", 2229 | "wasm-bindgen-backend", 2230 | "wasm-bindgen-shared", 2231 | ] 2232 | 2233 | [[package]] 2234 | name = "wasm-bindgen-shared" 2235 | version = "0.2.81" 2236 | source = "registry+https://github.com/rust-lang/crates.io-index" 2237 | checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" 2238 | 2239 | [[package]] 2240 | name = "web-sys" 2241 | version = "0.3.58" 2242 | source = "registry+https://github.com/rust-lang/crates.io-index" 2243 | checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" 2244 | dependencies = [ 2245 | "js-sys", 2246 | "wasm-bindgen", 2247 | ] 2248 | 2249 | [[package]] 2250 | name = "wee_alloc" 2251 | version = "0.4.5" 2252 | source = "registry+https://github.com/rust-lang/crates.io-index" 2253 | checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" 2254 | dependencies = [ 2255 | "cfg-if 0.1.10", 2256 | "libc", 2257 | "memory_units", 2258 | "winapi", 2259 | ] 2260 | 2261 | [[package]] 2262 | name = "winapi" 2263 | version = "0.3.9" 2264 | source = "registry+https://github.com/rust-lang/crates.io-index" 2265 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2266 | dependencies = [ 2267 | "winapi-i686-pc-windows-gnu", 2268 | "winapi-x86_64-pc-windows-gnu", 2269 | ] 2270 | 2271 | [[package]] 2272 | name = "winapi-i686-pc-windows-gnu" 2273 | version = "0.4.0" 2274 | source = "registry+https://github.com/rust-lang/crates.io-index" 2275 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2276 | 2277 | [[package]] 2278 | name = "winapi-x86_64-pc-windows-gnu" 2279 | version = "0.4.0" 2280 | source = "registry+https://github.com/rust-lang/crates.io-index" 2281 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2282 | 2283 | [[package]] 2284 | name = "windows-sys" 2285 | version = "0.36.1" 2286 | source = "registry+https://github.com/rust-lang/crates.io-index" 2287 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" 2288 | dependencies = [ 2289 | "windows_aarch64_msvc", 2290 | "windows_i686_gnu", 2291 | "windows_i686_msvc", 2292 | "windows_x86_64_gnu", 2293 | "windows_x86_64_msvc", 2294 | ] 2295 | 2296 | [[package]] 2297 | name = "windows_aarch64_msvc" 2298 | version = "0.36.1" 2299 | source = "registry+https://github.com/rust-lang/crates.io-index" 2300 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" 2301 | 2302 | [[package]] 2303 | name = "windows_i686_gnu" 2304 | version = "0.36.1" 2305 | source = "registry+https://github.com/rust-lang/crates.io-index" 2306 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" 2307 | 2308 | [[package]] 2309 | name = "windows_i686_msvc" 2310 | version = "0.36.1" 2311 | source = "registry+https://github.com/rust-lang/crates.io-index" 2312 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" 2313 | 2314 | [[package]] 2315 | name = "windows_x86_64_gnu" 2316 | version = "0.36.1" 2317 | source = "registry+https://github.com/rust-lang/crates.io-index" 2318 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" 2319 | 2320 | [[package]] 2321 | name = "windows_x86_64_msvc" 2322 | version = "0.36.1" 2323 | source = "registry+https://github.com/rust-lang/crates.io-index" 2324 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 2325 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "swc_wasm/" 4 | ] 5 | 6 | [profile.release] 7 | lto = true 8 | opt-level = "s" -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-22 Divy Srivastava 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 | deno_swc logo 5 | 6 |

deno_swc

7 | 8 |

9 | The SWC compiler for Deno. 10 |

11 |

12 | 13 | ![ci](https://github.com/littledivy/deno_swc/workflows/ci/badge.svg) 14 | ![](https://img.shields.io/github/v/release/littledivy/deno_swc?style=plastic) 15 | 16 | # Usage 17 | 18 | `parse()` 19 | 20 | ```typescript 21 | import { parse, print } from "https://deno.land/x/swc@0.2.1/mod.ts"; 22 | 23 | const code = `const x: string = "Hello, Deno SWC!"`; 24 | 25 | const ast = parse(code, { 26 | target: "es2019", 27 | syntax: "typescript", 28 | comments: false, 29 | }); 30 | 31 | // { 32 | // type: "Module", 33 | // span: { start: 0, end: 36, ctxt: 0 }, 34 | // body: [ 35 | // { 36 | // type: "VariableDeclaration", 37 | // span: [Object], 38 | // kind: "const", 39 | // declare: false, 40 | // declarations: [Array] 41 | // } 42 | // ], 43 | // interpreter: null 44 | // } 45 | ``` 46 | 47 | `print()` 48 | 49 | ```typescript 50 | const { code } = print(ast, { 51 | minify: true, 52 | module: { 53 | type: "commonjs", 54 | }, 55 | }); 56 | 57 | // const x = "Hello, Deno SWC!" 58 | ``` 59 | 60 | ...and `transform()` 61 | 62 | ```typescript 63 | const { code } = transform("const x: number = 2;", { 64 | jsc: { 65 | target: "es2016", 66 | parser: { 67 | syntax: "typescript", 68 | }, 69 | }, 70 | }); 71 | 72 | // const x = 2; 73 | ``` 74 | 75 | ## Copyright 76 | 77 | deno_swc is licensed under the MIT license. Please see the [LICENSE](LICENSE) 78 | file. 79 | -------------------------------------------------------------------------------- /assets/deno_swc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littledivy/deno_swc/f86f9bf90ee9ca1baabee8a090a352e960656c14/assets/deno_swc.png -------------------------------------------------------------------------------- /compress.ts: -------------------------------------------------------------------------------- 1 | import { compress } from "https://deno.land/x/lz4@v0.1.2/mod.ts"; 2 | 3 | const name = "./lib/deno_swc_bg.wasm"; 4 | Deno.writeFileSync(name, compress(Deno.readFileSync(name))); 5 | -------------------------------------------------------------------------------- /deno.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": { 3 | "build": "deno run -A --unstable https://raw.githubusercontent.com/denoland/wasmbuild/0e62b100df246567bee43eea227456222b7fc1dd/main.ts && deno task build:compress", 4 | // Use a canary / local version of wasmbuild 5 | "build:local": "deno run -A --unstable ../wasmbuild/main.ts && deno task build:compress", 6 | "build:compress": "deno run --allow-read --allow-write compress.ts", 7 | "fmt": "deno fmt --ignore=swc_wasm,lib,target --unstable && cargo fmt", 8 | "test": "deno test -A --no-check tests/" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/parse.ts: -------------------------------------------------------------------------------- 1 | import { parse } from "../mod.ts"; 2 | 3 | const start = performance.now(); 4 | console.log(parse( 5 | ` 6 | import * as a from "./a.ts"; 7 | `, 8 | { 9 | syntax: "ecmascript", 10 | }, 11 | )); 12 | const end = performance.now() - start; 13 | console.log(`parse time: ${end}ms`); 14 | -------------------------------------------------------------------------------- /examples/print.ts: -------------------------------------------------------------------------------- 1 | import { parse, print } from "../mod.ts"; 2 | 3 | const code = ` 4 | interface H { 5 | h: string; 6 | } 7 | 8 | const x: string = \`Hello, $\{"Hello"} Deno SWC!\`; 9 | 10 | switch (x) { 11 | case "value": 12 | console.log(x); 13 | break; 14 | 15 | default: 16 | break; 17 | } 18 | `; 19 | 20 | const ast = parse(code, { 21 | target: "es2019", 22 | syntax: "typescript", 23 | comments: false, 24 | }); 25 | const regeneratedCode = print(ast, { 26 | minify: true, 27 | module: { 28 | type: "commonjs", 29 | }, 30 | }).code; 31 | 32 | console.log(regeneratedCode); 33 | -------------------------------------------------------------------------------- /examples/transform.ts: -------------------------------------------------------------------------------- 1 | import { transform } from "../mod.ts"; 2 | 3 | const { code } = transform("const x: number = 2;", { 4 | // @ts-ignore: TransformConfig typings for swc_wasm and node_swc are different 5 | "jsc": { 6 | "target": "es2016", 7 | "parser": { 8 | "syntax": "typescript", 9 | }, 10 | }, 11 | }); 12 | 13 | console.log(code); 14 | -------------------------------------------------------------------------------- /lib/deno_swc.generated.js: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. 2 | // @generated file from build script, do not edit 3 | // deno-lint-ignore-file 4 | // source-hash: cd615b66c9fc26758ad0fac7a225b8fdeeb8cc3f 5 | let wasm; 6 | 7 | const heap = new Array(32).fill(undefined); 8 | 9 | heap.push(undefined, null, true, false); 10 | 11 | function getObject(idx) { 12 | return heap[idx]; 13 | } 14 | 15 | let heap_next = heap.length; 16 | 17 | function dropObject(idx) { 18 | if (idx < 36) return; 19 | heap[idx] = heap_next; 20 | heap_next = idx; 21 | } 22 | 23 | function takeObject(idx) { 24 | const ret = getObject(idx); 25 | dropObject(idx); 26 | return ret; 27 | } 28 | 29 | const cachedTextDecoder = new TextDecoder("utf-8", { 30 | ignoreBOM: true, 31 | fatal: true, 32 | }); 33 | 34 | cachedTextDecoder.decode(); 35 | 36 | let cachedUint8Memory0; 37 | function getUint8Memory0() { 38 | if (cachedUint8Memory0.byteLength === 0) { 39 | cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); 40 | } 41 | return cachedUint8Memory0; 42 | } 43 | 44 | function getStringFromWasm0(ptr, len) { 45 | return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); 46 | } 47 | 48 | function addHeapObject(obj) { 49 | if (heap_next === heap.length) heap.push(heap.length + 1); 50 | const idx = heap_next; 51 | heap_next = heap[idx]; 52 | 53 | heap[idx] = obj; 54 | return idx; 55 | } 56 | 57 | let WASM_VECTOR_LEN = 0; 58 | 59 | const cachedTextEncoder = new TextEncoder("utf-8"); 60 | 61 | const encodeString = function (arg, view) { 62 | return cachedTextEncoder.encodeInto(arg, view); 63 | }; 64 | 65 | function passStringToWasm0(arg, malloc, realloc) { 66 | if (realloc === undefined) { 67 | const buf = cachedTextEncoder.encode(arg); 68 | const ptr = malloc(buf.length); 69 | getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); 70 | WASM_VECTOR_LEN = buf.length; 71 | return ptr; 72 | } 73 | 74 | let len = arg.length; 75 | let ptr = malloc(len); 76 | 77 | const mem = getUint8Memory0(); 78 | 79 | let offset = 0; 80 | 81 | for (; offset < len; offset++) { 82 | const code = arg.charCodeAt(offset); 83 | if (code > 0x7F) break; 84 | mem[ptr + offset] = code; 85 | } 86 | 87 | if (offset !== len) { 88 | if (offset !== 0) { 89 | arg = arg.slice(offset); 90 | } 91 | ptr = realloc(ptr, len, len = offset + arg.length * 3); 92 | const view = getUint8Memory0().subarray(ptr + offset, ptr + len); 93 | const ret = encodeString(arg, view); 94 | 95 | offset += ret.written; 96 | } 97 | 98 | WASM_VECTOR_LEN = offset; 99 | return ptr; 100 | } 101 | 102 | let cachedInt32Memory0; 103 | function getInt32Memory0() { 104 | if (cachedInt32Memory0.byteLength === 0) { 105 | cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); 106 | } 107 | return cachedInt32Memory0; 108 | } 109 | /** 110 | * @param {string} s 111 | * @param {any} opts 112 | * @returns {any} 113 | */ 114 | export function minifySync(s, opts) { 115 | try { 116 | const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 117 | const ptr0 = passStringToWasm0( 118 | s, 119 | wasm.__wbindgen_malloc, 120 | wasm.__wbindgen_realloc, 121 | ); 122 | const len0 = WASM_VECTOR_LEN; 123 | wasm.minifySync(retptr, ptr0, len0, addHeapObject(opts)); 124 | var r0 = getInt32Memory0()[retptr / 4 + 0]; 125 | var r1 = getInt32Memory0()[retptr / 4 + 1]; 126 | var r2 = getInt32Memory0()[retptr / 4 + 2]; 127 | if (r2) { 128 | throw takeObject(r1); 129 | } 130 | return takeObject(r0); 131 | } finally { 132 | wasm.__wbindgen_add_to_stack_pointer(16); 133 | } 134 | } 135 | 136 | /** 137 | * @param {string} s 138 | * @param {any} opts 139 | * @returns {any} 140 | */ 141 | export function parseSync(s, opts) { 142 | try { 143 | const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 144 | const ptr0 = passStringToWasm0( 145 | s, 146 | wasm.__wbindgen_malloc, 147 | wasm.__wbindgen_realloc, 148 | ); 149 | const len0 = WASM_VECTOR_LEN; 150 | wasm.parseSync(retptr, ptr0, len0, addHeapObject(opts)); 151 | var r0 = getInt32Memory0()[retptr / 4 + 0]; 152 | var r1 = getInt32Memory0()[retptr / 4 + 1]; 153 | var r2 = getInt32Memory0()[retptr / 4 + 2]; 154 | if (r2) { 155 | throw takeObject(r1); 156 | } 157 | return takeObject(r0); 158 | } finally { 159 | wasm.__wbindgen_add_to_stack_pointer(16); 160 | } 161 | } 162 | 163 | /** 164 | * @param {any} s 165 | * @param {any} opts 166 | * @returns {any} 167 | */ 168 | export function printSync(s, opts) { 169 | try { 170 | const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 171 | wasm.printSync(retptr, addHeapObject(s), addHeapObject(opts)); 172 | var r0 = getInt32Memory0()[retptr / 4 + 0]; 173 | var r1 = getInt32Memory0()[retptr / 4 + 1]; 174 | var r2 = getInt32Memory0()[retptr / 4 + 2]; 175 | if (r2) { 176 | throw takeObject(r1); 177 | } 178 | return takeObject(r0); 179 | } finally { 180 | wasm.__wbindgen_add_to_stack_pointer(16); 181 | } 182 | } 183 | 184 | /** 185 | * @param {string} s 186 | * @param {any} opts 187 | * @returns {any} 188 | */ 189 | export function transformSync(s, opts) { 190 | try { 191 | const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 192 | const ptr0 = passStringToWasm0( 193 | s, 194 | wasm.__wbindgen_malloc, 195 | wasm.__wbindgen_realloc, 196 | ); 197 | const len0 = WASM_VECTOR_LEN; 198 | wasm.transformSync(retptr, ptr0, len0, addHeapObject(opts)); 199 | var r0 = getInt32Memory0()[retptr / 4 + 0]; 200 | var r1 = getInt32Memory0()[retptr / 4 + 1]; 201 | var r2 = getInt32Memory0()[retptr / 4 + 2]; 202 | if (r2) { 203 | throw takeObject(r1); 204 | } 205 | return takeObject(r0); 206 | } finally { 207 | wasm.__wbindgen_add_to_stack_pointer(16); 208 | } 209 | } 210 | 211 | const imports = { 212 | __wbindgen_placeholder__: { 213 | __wbg_new0_6b49a1fca8534d39: function () { 214 | const ret = new Date(); 215 | return addHeapObject(ret); 216 | }, 217 | __wbg_getTimezoneOffset_d7a89256f8181a06: function (arg0) { 218 | const ret = getObject(arg0).getTimezoneOffset(); 219 | return ret; 220 | }, 221 | __wbindgen_object_drop_ref: function (arg0) { 222 | takeObject(arg0); 223 | }, 224 | __wbg_getTime_7c8d3b79f51e2b87: function (arg0) { 225 | const ret = getObject(arg0).getTime(); 226 | return ret; 227 | }, 228 | __wbg_new_693216e109162396: function () { 229 | const ret = new Error(); 230 | return addHeapObject(ret); 231 | }, 232 | __wbg_stack_0ddaca5d1abfb52f: function (arg0, arg1) { 233 | const ret = getObject(arg1).stack; 234 | const ptr0 = passStringToWasm0( 235 | ret, 236 | wasm.__wbindgen_malloc, 237 | wasm.__wbindgen_realloc, 238 | ); 239 | const len0 = WASM_VECTOR_LEN; 240 | getInt32Memory0()[arg0 / 4 + 1] = len0; 241 | getInt32Memory0()[arg0 / 4 + 0] = ptr0; 242 | }, 243 | __wbg_error_09919627ac0992f5: function (arg0, arg1) { 244 | try { 245 | console.error(getStringFromWasm0(arg0, arg1)); 246 | } finally { 247 | wasm.__wbindgen_free(arg0, arg1); 248 | } 249 | }, 250 | __wbindgen_string_new: function (arg0, arg1) { 251 | const ret = getStringFromWasm0(arg0, arg1); 252 | return addHeapObject(ret); 253 | }, 254 | __wbindgen_json_serialize: function (arg0, arg1) { 255 | const obj = getObject(arg1); 256 | const ret = JSON.stringify(obj === undefined ? null : obj); 257 | const ptr0 = passStringToWasm0( 258 | ret, 259 | wasm.__wbindgen_malloc, 260 | wasm.__wbindgen_realloc, 261 | ); 262 | const len0 = WASM_VECTOR_LEN; 263 | getInt32Memory0()[arg0 / 4 + 1] = len0; 264 | getInt32Memory0()[arg0 / 4 + 0] = ptr0; 265 | }, 266 | __wbindgen_json_parse: function (arg0, arg1) { 267 | const ret = JSON.parse(getStringFromWasm0(arg0, arg1)); 268 | return addHeapObject(ret); 269 | }, 270 | __wbindgen_throw: function (arg0, arg1) { 271 | throw new Error(getStringFromWasm0(arg0, arg1)); 272 | }, 273 | }, 274 | }; 275 | 276 | const wasm_url = new URL("deno_swc_bg.wasm", import.meta.url); 277 | 278 | /** 279 | * Decompression callback 280 | * 281 | * @callback decompressCallback 282 | * @param {Uint8Array} compressed 283 | * @return {Uint8Array} decompressed 284 | */ 285 | 286 | /** Instantiates an instance of the Wasm module returning its functions. 287 | * @remarks It is safe to call this multiple times and once successfully 288 | * loaded it will always return a reference to the same object. 289 | * @param {decompressCallback=} transform 290 | */ 291 | export async function instantiate(transform) { 292 | return (await instantiateWithInstance(transform)).exports; 293 | } 294 | 295 | let instanceWithExports; 296 | let lastLoadPromise; 297 | 298 | /** Instantiates an instance of the Wasm module along with its exports. 299 | * @remarks It is safe to call this multiple times and once successfully 300 | * loaded it will always return a reference to the same object. 301 | * @param {decompressCallback=} transform 302 | * @returns {Promise<{ 303 | * instance: WebAssembly.Instance; 304 | * exports: { minifySync: typeof minifySync; parseSync: typeof parseSync; printSync: typeof printSync; transformSync: typeof transformSync } 305 | * }>} 306 | */ 307 | export function instantiateWithInstance(transform) { 308 | if (instanceWithExports != null) { 309 | return Promise.resolve(instanceWithExports); 310 | } 311 | if (lastLoadPromise == null) { 312 | lastLoadPromise = (async () => { 313 | try { 314 | const instance = (await instantiateModule(transform)).instance; 315 | wasm = instance.exports; 316 | cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); 317 | cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); 318 | instanceWithExports = { 319 | instance, 320 | exports: { minifySync, parseSync, printSync, transformSync }, 321 | }; 322 | return instanceWithExports; 323 | } finally { 324 | lastLoadPromise = null; 325 | } 326 | })(); 327 | } 328 | return lastLoadPromise; 329 | } 330 | 331 | /** Gets if the Wasm module has been instantiated. */ 332 | export function isInstantiated() { 333 | return instanceWithExports != null; 334 | } 335 | 336 | async function instantiateModule(transform) { 337 | switch (wasm_url.protocol) { 338 | case "file:": { 339 | if (typeof Deno !== "object") { 340 | throw new Error("file urls are not supported in this environment"); 341 | } 342 | 343 | if ("permissions" in Deno) { 344 | Deno.permissions.request({ name: "read", path: wasm_url }); 345 | } 346 | const wasmCode = await Deno.readFile(wasm_url); 347 | return WebAssembly.instantiate( 348 | !transform ? wasmCode : transform(wasmCode), 349 | imports, 350 | ); 351 | } 352 | case "https:": 353 | case "http:": { 354 | if (typeof Deno === "object" && "permissions" in Deno) { 355 | Deno.permissions.request({ name: "net", host: wasm_url.host }); 356 | } 357 | const wasmResponse = await fetch(wasm_url); 358 | if (transform) { 359 | const wasmCode = new Uint8Array(await wasmResponse.arrayBuffer()); 360 | return WebAssembly.instantiate(transform(wasmCode), imports); 361 | } 362 | if ( 363 | wasmResponse.headers.get("content-type")?.toLowerCase().startsWith( 364 | "application/wasm", 365 | ) 366 | ) { 367 | return WebAssembly.instantiateStreaming(wasmResponse, imports); 368 | } else { 369 | return WebAssembly.instantiate( 370 | await wasmResponse.arrayBuffer(), 371 | imports, 372 | ); 373 | } 374 | } 375 | default: 376 | throw new Error(`Unsupported protocol: ${wasm_url.protocol}`); 377 | } 378 | } 379 | -------------------------------------------------------------------------------- /lib/deno_swc_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/littledivy/deno_swc/f86f9bf90ee9ca1baabee8a090a352e960656c14/lib/deno_swc_bg.wasm -------------------------------------------------------------------------------- /mod.ts: -------------------------------------------------------------------------------- 1 | import { decompress } from "https://deno.land/x/lz4@v0.1.2/mod.ts"; 2 | import type { 3 | Config, 4 | ParseOptions, 5 | Program, 6 | } from "https://esm.sh/@swc/core@1.2.212/types.d.ts"; 7 | import { instantiate } from "./lib/deno_swc.generated.js"; 8 | 9 | const { parseSync, printSync, transformSync } = await instantiate(decompress); 10 | 11 | export function parse(source: string, opts: ParseOptions): Program { 12 | return parseSync(source, opts); 13 | } 14 | 15 | export function print(program: Program, opts?: Config): { code: string } { 16 | return printSync(program, opts || {}); 17 | } 18 | 19 | export function transform(source: string, opts: Config): { code: string } { 20 | return transformSync(source, opts); 21 | } 22 | -------------------------------------------------------------------------------- /swc_wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "deno_swc" 3 | version = "0.0.1" 4 | authors = ["Divy Srivastava "] 5 | edition = "2018" 6 | publish = false 7 | 8 | [lib] 9 | crate_type = ["cdylib"] 10 | path = "lib.rs" 11 | 12 | [dependencies] 13 | anyhow = "1.0.42" 14 | wee_alloc = { version = "0.4.5", optional = true } 15 | console_error_panic_hook = "0.1.6" 16 | once_cell = "1.3.1" 17 | path-clean = "0.1" 18 | serde = {version = "1", features = ["derive"]} 19 | serde_json = "1" 20 | swc = { git = "https://github.com/swc-project/swc", rev = "fd3501b" } 21 | swc_ecmascript = { git = "https://github.com/swc-project/swc", rev = "fd3501b" } 22 | swc_common = { git = "https://github.com/swc-project/swc", rev = "fd3501b" } 23 | wasm-bindgen = {version = "0.2", features = ["serde-serialize"]} 24 | wasm-bindgen-futures = "0.4.8" 25 | syn = "1.0.65" 26 | url = "2.2.2" 27 | 28 | [features] 29 | default = ["wee_alloc"] 30 | 31 | -------------------------------------------------------------------------------- /swc_wasm/build.js: -------------------------------------------------------------------------------- 1 | import { encode } from "https://deno.land/std@0.103.0/encoding/base64.ts"; 2 | import Terser from "https://esm.sh/terser@4.8.0"; 3 | import * as lz4 from "https://deno.land/x/lz4@v0.1.2/mod.ts"; 4 | 5 | const name = "deno_swc"; 6 | 7 | const encoder = new TextEncoder(); 8 | 9 | async function requires(...executables) { 10 | const where = Deno.build.os === "windows" ? "where" : "which"; 11 | 12 | for (const executable of executables) { 13 | const process = Deno.run({ 14 | cmd: [where, executable], 15 | stderr: "null", 16 | stdin: "null", 17 | stdout: "null", 18 | }); 19 | 20 | if (!(await process.status()).success) { 21 | err(`Could not find required build tool ${executable}`); 22 | } 23 | } 24 | } 25 | 26 | async function run(msg, cmd) { 27 | log(msg); 28 | 29 | const process = Deno.run({ cmd }); 30 | 31 | if (!(await process.status()).success) { 32 | err(`${msg} failed`); 33 | } 34 | } 35 | 36 | function log(text) { 37 | console.log(`[log] ${text}`); 38 | } 39 | 40 | function err(text) { 41 | console.log(`[err] ${text}`); 42 | return Deno.exit(1); 43 | } 44 | 45 | await requires("rustup", "rustc", "cargo", "wasm-bindgen"); 46 | 47 | if (!(await Deno.stat("Cargo.toml")).isFile) { 48 | err(`the build script should be executed in the "${name}" root`); 49 | } 50 | 51 | await run("building wasm", ["cargo", "build", "--release", "--target", "wasm32-unknown-unknown"]); 52 | 53 | await run( 54 | "building using wasm-pack", 55 | ["wasm-bindgen", "target/wasm32-unknown-unknown/release/deno_swc.wasm" , "--target", "deno", "--weak-refs", "--out-dir", "pkg/"], 56 | ); 57 | 58 | const wasm = await Deno.readFile(`pkg/${name}_bg.wasm`); 59 | 60 | const compressed = lz4.compress(wasm); 61 | console.log( 62 | `compressed wasm using lz4 (reduction: ${wasm.length - 63 | compressed.length} bytes, size: ${compressed.length} bytes)`, 64 | ); 65 | 66 | const encoded = encode(compressed); 67 | 68 | log( 69 | `encoded wasm using base64, size increase: ${encoded.length - 70 | wasm.length} bytes`, 71 | ); 72 | 73 | log("inlining wasm in js"); 74 | const source = `import * as lz4 from "https://deno.land/x/lz4@v0.1.2/mod.ts";export const source=lz4.decompress(Uint8Array.from(atob("${encoded}"),c=>c.charCodeAt(0)));`; 75 | 76 | let init = await Deno.readTextFile(`pkg/${name}.js`); 77 | let lines = init.split('\n'); 78 | // We want to replace this code. 79 | for (let i = 1; i < 4; i++) lines.splice(-i); 80 | init = lines.join('\n'); 81 | init += `\nconst wasmModule = new WebAssembly.Module(source);\nconst wasmInstance = new WebAssembly.Instance(wasmModule, imports);\nconst wasm = wasmInstance.exports;\n`; 82 | console.log(init) 83 | 84 | log("minifying js"); 85 | const output = Terser.minify(`${source}\n${init}`, { 86 | mangle: { module: true }, 87 | output: { 88 | preamble: "//deno-fmt-ignore-file", 89 | }, 90 | }); 91 | 92 | if (output.error) { 93 | err(`encountered error when minifying: ${output.error}`); 94 | } 95 | 96 | const reduction = new Blob([(`${source}\n${init}`)]).size - 97 | new Blob([output.code]).size; 98 | log(`minified js, size reduction: ${reduction} bytes`); 99 | 100 | log(`writing output to file ("wasm.js")`); 101 | await Deno.writeFile("wasm.js", encoder.encode(output.code)); 102 | 103 | const outputFile = await Deno.stat("wasm.js"); 104 | log( 105 | `output file ("wasm.js"), final size is: ${outputFile.size} bytes`, 106 | ); 107 | -------------------------------------------------------------------------------- /swc_wasm/lib.rs: -------------------------------------------------------------------------------- 1 | // From https://github.com/swc-project/swc/blob/main/crates/binding_core_wasm/src/lib.rs 2 | 3 | use anyhow::{Context, Error}; 4 | use once_cell::sync::Lazy; 5 | use std::sync::Arc; 6 | use swc::{ 7 | config::{ 8 | ErrorFormat, JsMinifyOptions, Options, ParseOptions, SourceMapsConfig, 9 | }, 10 | try_with_handler, Compiler, 11 | }; 12 | use swc_common::{comments::Comments, FileName, FilePathMapping, SourceMap}; 13 | use swc_ecmascript::ast::{EsVersion, Program}; 14 | use wasm_bindgen::prelude::*; 15 | 16 | fn convert_err(err: Error, error_format: ErrorFormat) -> JsValue { 17 | error_format.format(&err).into() 18 | } 19 | 20 | #[wasm_bindgen(js_name = "minifySync")] 21 | pub fn minify_sync(s: &str, opts: JsValue) -> Result { 22 | console_error_panic_hook::set_once(); 23 | 24 | let c = compiler(); 25 | 26 | try_with_handler( 27 | c.cm.clone(), 28 | swc::HandlerOpts { 29 | ..Default::default() 30 | }, 31 | |handler| { 32 | c.run(|| { 33 | let opts: JsMinifyOptions = 34 | opts.into_serde().context("failed to parse options")?; 35 | 36 | let fm = c.cm.new_source_file(FileName::Anon, s.into()); 37 | let program = c 38 | .minify(fm, handler, &opts) 39 | .context("failed to minify file")?; 40 | 41 | JsValue::from_serde(&program).context("failed to serialize json") 42 | }) 43 | }, 44 | ) 45 | .map_err(|e| convert_err(e, ErrorFormat::Normal)) 46 | } 47 | 48 | #[wasm_bindgen(js_name = "parseSync")] 49 | pub fn parse_sync(s: &str, opts: JsValue) -> Result { 50 | console_error_panic_hook::set_once(); 51 | 52 | let c = compiler(); 53 | 54 | try_with_handler( 55 | c.cm.clone(), 56 | swc::HandlerOpts { 57 | ..Default::default() 58 | }, 59 | |handler| { 60 | c.run(|| { 61 | let opts: ParseOptions = 62 | opts.into_serde().context("failed to parse options")?; 63 | 64 | let fm = c.cm.new_source_file(FileName::Anon, s.into()); 65 | 66 | let cmts = c.comments().clone(); 67 | let comments = if opts.comments { 68 | Some(&cmts as &dyn Comments) 69 | } else { 70 | None 71 | }; 72 | 73 | let program = c 74 | .parse_js( 75 | fm, 76 | handler, 77 | opts.target, 78 | opts.syntax, 79 | opts.is_module, 80 | comments, 81 | ) 82 | .context("failed to parse code")?; 83 | 84 | JsValue::from_serde(&program).context("failed to serialize json") 85 | }) 86 | }, 87 | ) 88 | .map_err(|e| convert_err(e, ErrorFormat::Normal)) 89 | } 90 | 91 | #[wasm_bindgen(js_name = "printSync")] 92 | pub fn print_sync(s: JsValue, opts: JsValue) -> Result { 93 | console_error_panic_hook::set_once(); 94 | 95 | let c = compiler(); 96 | 97 | try_with_handler( 98 | c.cm.clone(), 99 | swc::HandlerOpts { 100 | ..Default::default() 101 | }, 102 | |_handler| { 103 | c.run(|| { 104 | let opts: Options = 105 | opts.into_serde().context("failed to parse options")?; 106 | 107 | let program: Program = 108 | s.into_serde().context("failed to deserialize program")?; 109 | 110 | let s = c 111 | .print( 112 | &program, 113 | None, 114 | None, 115 | true, 116 | opts.codegen_target().unwrap_or(EsVersion::Es2020), 117 | opts 118 | .source_maps 119 | .clone() 120 | .unwrap_or(SourceMapsConfig::Bool(false)), 121 | &Default::default(), 122 | None, 123 | opts.config.minify.into(), 124 | None, 125 | opts.config.emit_source_map_columns.into_bool(), 126 | false, 127 | ) 128 | .context("failed to print code")?; 129 | 130 | JsValue::from_serde(&s).context("failed to serialize json") 131 | }) 132 | }, 133 | ) 134 | .map_err(|e| convert_err(e, ErrorFormat::Normal)) 135 | } 136 | 137 | #[wasm_bindgen(js_name = "transformSync")] 138 | pub fn transform_sync(s: &str, opts: JsValue) -> Result { 139 | console_error_panic_hook::set_once(); 140 | 141 | let c = compiler(); 142 | let opts: Options = opts 143 | .into_serde() 144 | .context("failed to parse options") 145 | .map_err(|e| convert_err(e, ErrorFormat::Normal))?; 146 | 147 | let error_format = opts.experimental.error_format.unwrap_or_default(); 148 | 149 | try_with_handler( 150 | c.cm.clone(), 151 | swc::HandlerOpts { 152 | ..Default::default() 153 | }, 154 | |handler| { 155 | c.run(|| { 156 | let fm = c.cm.new_source_file( 157 | if opts.filename.is_empty() { 158 | FileName::Anon 159 | } else { 160 | FileName::Real(opts.filename.clone().into()) 161 | }, 162 | s.into(), 163 | ); 164 | let out = c 165 | .process_js_file(fm, handler, &opts) 166 | .context("failed to process input file")?; 167 | 168 | JsValue::from_serde(&out).context("failed to serialize json") 169 | }) 170 | }, 171 | ) 172 | .map_err(|e| convert_err(e, error_format)) 173 | } 174 | 175 | /// Get global sourcemap 176 | fn compiler() -> Arc { 177 | static C: Lazy> = Lazy::new(|| { 178 | let cm = Arc::new(SourceMap::new(FilePathMapping::empty())); 179 | 180 | Arc::new(Compiler::new(cm)) 181 | }); 182 | 183 | C.clone() 184 | } 185 | -------------------------------------------------------------------------------- /tests/deps.ts: -------------------------------------------------------------------------------- 1 | export { assert, assertEquals } from "https://deno.land/std/testing/asserts.ts"; 2 | -------------------------------------------------------------------------------- /tests/parse.test.ts: -------------------------------------------------------------------------------- 1 | import { parse } from "../mod.ts"; 2 | import { assertEquals } from "./deps.ts"; 3 | 4 | Deno.test("parse (no error)", () => { 5 | const result = parse("const x: number = 2;", { 6 | "syntax": "typescript", 7 | }); 8 | assertEquals(result, { 9 | type: "Module", 10 | body: [ 11 | { 12 | declarations: [ 13 | { 14 | definite: false, 15 | id: { 16 | optional: false, 17 | span: { ctxt: 0, end: 8, start: 7 }, 18 | type: "Identifier", 19 | typeAnnotation: { 20 | span: { ctxt: 0, end: 16, start: 8 }, 21 | type: "TsTypeAnnotation", 22 | typeAnnotation: { 23 | kind: "number", 24 | span: { ctxt: 0, end: 16, start: 10 }, 25 | type: "TsKeywordType", 26 | }, 27 | }, 28 | value: "x", 29 | }, 30 | init: { 31 | raw: "2", 32 | span: { ctxt: 0, end: 20, start: 19 }, 33 | type: "NumericLiteral", 34 | value: 2, 35 | }, 36 | span: { ctxt: 0, end: 20, start: 7 }, 37 | type: "VariableDeclarator", 38 | }, 39 | ], 40 | declare: false, 41 | kind: "const", 42 | span: { ctxt: 0, end: 21, start: 1 }, 43 | type: "VariableDeclaration", 44 | }, 45 | ], 46 | interpreter: null, 47 | span: { ctxt: 0, end: 21, start: 1 }, 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /tests/print.test.ts: -------------------------------------------------------------------------------- 1 | import { print } from "../mod.ts"; 2 | import { assertEquals } from "./deps.ts"; 3 | 4 | Deno.test("print (no error)", () => { 5 | const result = print({ 6 | "type": "Module", 7 | "span": { "start": 21, "end": 33, "ctxt": 0 }, 8 | "body": [{ 9 | "type": "ClassDeclaration", 10 | "identifier": { 11 | "type": "Identifier", 12 | "span": { "start": 27, "end": 28, "ctxt": 0 }, 13 | "value": "X", 14 | "optional": false, 15 | }, 16 | "declare": false, 17 | "span": { "start": 21, "end": 32, "ctxt": 0 }, 18 | "decorators": [], 19 | "body": [], 20 | "superClass": null, 21 | "isAbstract": false, 22 | "typeParams": null, 23 | "superTypeParams": null, 24 | "implements": [], 25 | }, { 26 | "type": "EmptyStatement", 27 | "span": { "start": 32, "end": 33, "ctxt": 0 }, 28 | }], 29 | "interpreter": null, 30 | }, {}); 31 | assertEquals(result.code.trim(), "class X {\n}\n;"); 32 | }); 33 | -------------------------------------------------------------------------------- /tests/transform.test.ts: -------------------------------------------------------------------------------- 1 | import { transform } from "../mod.ts"; 2 | import { assertEquals } from "./deps.ts"; 3 | 4 | Deno.test("transform (no error)", () => { 5 | const result = transform("const x: number = 2; console.log(x);", { 6 | // deno-lint-ignore ban-ts-comment 7 | // @ts-ignore 8 | "jsc": { 9 | "target": "es2016", 10 | "parser": { 11 | "syntax": "typescript", 12 | }, 13 | }, 14 | }); 15 | assertEquals(result.code.trim(), "const x = 2;\nconsole.log(x);"); 16 | }); 17 | -------------------------------------------------------------------------------- /version.ts: -------------------------------------------------------------------------------- 1 | export const version = "0.2.1"; 2 | --------------------------------------------------------------------------------