diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1b559df611cc..3e221d1de643 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -247,11 +247,6 @@ jobs: target: wasm32-wasip1 components: rustfmt - - uses: denoland/setup-deno@11b63cf76cfcafb4e43f97b6cad24d8e8438f62d # v1.5.2 - if: matrix.settings.crate != '__noop__' && matrix.settings.crate == 'swc_bundler' - with: - deno-version: v1.x - - name: Install node dependencies if: matrix.settings.crate != '__noop__' shell: bash @@ -528,11 +523,6 @@ jobs: # (cd tests/integration/redux/repo && pnpm install) # TODO # (cd tests/integration/redux/repo && npx jest '.*.js' --modulePathIgnorePatterns 'typescript') - - name: (swcpack) example react app - run: | - export NODE_OPTIONS="--unhandled-rejections=warn" - (cd crates/swc_node_bundler/tests/integration/react && npm install && npx spack) - done: needs: - cargo-fmt diff --git a/.github/workflows/publish-npm-package.yml b/.github/workflows/publish-npm-package.yml index 2d978891335e..7caa98e4f13d 100644 --- a/.github/workflows/publish-npm-package.yml +++ b/.github/workflows/publish-npm-package.yml @@ -121,7 +121,7 @@ jobs: if [[ ${{ inputs.package }} == "core" ]]; then cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --target i686-pc-windows-msvc cp ../../target/i686-pc-windows-msvc/release/swc . - pnpm build --target i686-pc-windows-msvc --no-default-features --features swc_v1 + pnpm build --target i686-pc-windows-msvc --no-default-features else pnpm build --target i686-pc-windows-msvc fi @@ -135,7 +135,7 @@ jobs: rm -rf ../../target/target/x86_64-unknown-linux-gnu/release/.cargo-lock && cp ../../target/x86_64-unknown-linux-gnu/release/swc . && chmod +x ./swc && if [[ ${{ inputs.package }} == "core" ]]; then - pnpm build --target x86_64-unknown-linux-gnu --no-default-features --features swc_v1,plugin + pnpm build --target x86_64-unknown-linux-gnu --no-default-features --features plugin else pnpm build --target x86_64-unknown-linux-gnu fi @@ -196,7 +196,7 @@ jobs: if [[ ${{ inputs.package }} == "core" ]]; then pnpm exec napi build --bin swc --release --target armv7-unknown-linux-gnueabihf --manifest-path ../../bindings/swc_cli/Cargo.toml -x --target-dir ../release -o . chmod +x ./swc - pnpm build --target armv7-unknown-linux-gnueabihf --no-default-features --features swc_v1 --use-napi-cross + pnpm build --target armv7-unknown-linux-gnueabihf --no-default-features --use-napi-cross else pnpm build --target armv7-unknown-linux-gnueabihf --use-napi-cross fi @@ -207,7 +207,7 @@ jobs: if [[ ${{ inputs.package }} == "core" ]]; then pnpm exec napi build --bin swc --release --target powerpc64le-unknown-linux-gnu --manifest-path ../../bindings/swc_cli/Cargo.toml -x --target-dir ../release -o . chmod +x ./swc - pnpm build --target powerpc64le-unknown-linux-gnu --no-default-features --features swc_v1 --use-napi-cross + pnpm build --target powerpc64le-unknown-linux-gnu --no-default-features --use-napi-cross else pnpm build --target powerpc64le-unknown-linux-gnu --use-napi-cross fi @@ -218,7 +218,7 @@ jobs: if [[ ${{ inputs.package }} == "core" ]]; then pnpm exec napi build --bin swc --release --target s390x-unknown-linux-gnu --manifest-path ../../bindings/swc_cli/Cargo.toml -x --target-dir ../release -o . chmod +x ./swc - pnpm build --target s390x-unknown-linux-gnu --no-default-features --features swc_v1 --use-napi-cross + pnpm build --target s390x-unknown-linux-gnu --no-default-features --use-napi-cross else pnpm build --target s390x-unknown-linux-gnu --use-napi-cross fi @@ -301,7 +301,7 @@ jobs: if [[ ${{ inputs.package }} == "core" ]]; then cargo build --manifest-path ../../bindings/swc_cli/Cargo.toml --release --target aarch64-pc-windows-msvc cp ../../target/aarch64-pc-windows-msvc/release/swc.exe . - pnpm build --target aarch64-pc-windows-msvc --no-default-features --features swc_v1 + pnpm build --target aarch64-pc-windows-msvc --no-default-features else pnpm build --target aarch64-pc-windows-msvc fi diff --git a/Cargo.lock b/Cargo.lock index ecd1048306b9..2e8a2cdc25ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -307,12 +307,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -1231,16 +1225,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -1496,21 +1480,6 @@ version = "0.125.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "718efe674f3df645462677e22a3128e890d88ba55821bb091083d257707be76c" -[[package]] -name = "crc" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" - [[package]] name = "crc32fast" version = "1.5.0" @@ -2066,15 +2035,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -2207,21 +2167,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -2481,25 +2426,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.12.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "half" version = "2.4.1" @@ -2652,17 +2578,6 @@ dependencies = [ "triomphe", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.1.0" @@ -2674,29 +2589,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "humansize" version = "2.1.3" @@ -2706,43 +2598,6 @@ dependencies = [ "libm", ] -[[package]] -name = "hyper" -version = "0.14.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.7", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "iana-time-zone" version = "0.1.64" @@ -3021,7 +2876,6 @@ checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", "hashbrown 0.16.0", - "rayon", "serde", "serde_core", ] @@ -3639,12 +3493,6 @@ dependencies = [ "libmimalloc-sys", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -3757,24 +3605,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -3855,47 +3685,6 @@ dependencies = [ "bitflags 2.10.0", ] -[[package]] -name = "ntest" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c544e496c816f0a59645c0bb69097e453df203954ae2ed4b3ac4251fad69d44" -dependencies = [ - "ntest_proc_macro_helper", - "ntest_test_cases", - "ntest_timeout", -] - -[[package]] -name = "ntest_proc_macro_helper" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f52e34b414605b77efc95c3f0ecef01df0c324bcc7f68d9a9cb7a7552777e52" - -[[package]] -name = "ntest_test_cases" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a81eb400abc87063f829560bc5c5c835177703b83d1cd991960db0b2a00abe" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ntest_timeout" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10db009e117aca57cbfb70ac332348f9a89d09ff7204497c283c0f7a0c96323" -dependencies = [ - "ntest_proc_macro_helper", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "nu-ansi-term" version = "0.50.1" @@ -4028,50 +3817,6 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "openssl" -version = "0.10.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" -dependencies = [ - "bitflags 2.10.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "os_str_bytes" version = "6.6.1" @@ -4321,12 +4066,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" - [[package]] name = "plotters" version = "0.3.5" @@ -4880,46 +4619,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51743d3e274e2b18df81c4dc6caf8a5b8e15dbe799e0dca05c7617380094e884" -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - [[package]] name = "rkyv" version = "0.7.45" @@ -5047,15 +4746,6 @@ dependencies = [ "rustix 1.1.2", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustversion" version = "1.0.17" @@ -5129,15 +4819,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "schemars" version = "0.8.21" @@ -5202,29 +4883,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "security-framework" -version = "2.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "self_cell" version = "1.0.4" @@ -5329,18 +4987,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_yml" version = "0.0.12" @@ -5517,26 +5163,6 @@ dependencies = [ "managed", ] -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "socket2" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - [[package]] name = "st-map" version = "0.2.4" @@ -5756,48 +5382,6 @@ dependencies = [ "shrink-to-fit", ] -[[package]] -name = "swc_bundler" -version = "51.0.0" -dependencies = [ - "anyhow", - "crc", - "dashmap 6.1.0", - "hex", - "indexmap 2.12.0", - "is-macro", - "ntest", - "once_cell", - "par-core", - "path-clean", - "petgraph", - "radix_fmt", - "rayon", - "relative-path", - "reqwest", - "rustc-hash 2.1.1", - "sha1", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_codegen", - "swc_ecma_loader", - "swc_ecma_minifier", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_transforms_optimization", - "swc_ecma_transforms_proposal", - "swc_ecma_transforms_react", - "swc_ecma_transforms_typescript", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_graph_analyzer", - "swc_malloc", - "tempfile", - "testing", - "tracing", -] - [[package]] name = "swc_cli" version = "0.113.2" @@ -5823,6 +5407,7 @@ dependencies = [ "pathdiff", "serde_json", "swc_core", + "tempfile", "tracing", "tracing-chrome", "tracing-subscriber", @@ -5928,7 +5513,6 @@ dependencies = [ "swc", "swc_allocator", "swc_atoms", - "swc_bundler", "swc_common", "swc_config", "swc_css_ast", @@ -5960,7 +5544,6 @@ dependencies = [ "swc_ecma_utils", "swc_ecma_visit", "swc_malloc", - "swc_node_bundler", "swc_nodejs_common", "swc_plugin", "swc_plugin_macro", @@ -6584,6 +6167,7 @@ dependencies = [ name = "swc_ecma_quote" version = "41.0.0" dependencies = [ + "swc_atoms", "swc_common", "swc_ecma_ast", "swc_ecma_quote_macros", @@ -7193,30 +6777,6 @@ dependencies = [ "tikv-jemallocator", ] -[[package]] -name = "swc_node_bundler" -version = "67.0.0" -dependencies = [ - "anyhow", - "rustc-hash 2.1.1", - "serde", - "string_enum", - "swc", - "swc_atoms", - "swc_bundler", - "swc_common", - "swc_ecma_ast", - "swc_ecma_codegen", - "swc_ecma_loader", - "swc_ecma_parser", - "swc_ecma_transforms", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_malloc", - "testing", - "tracing", -] - [[package]] name = "swc_node_comments" version = "24.0.0" @@ -7537,12 +7097,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "synstructure" version = "0.13.2" @@ -7554,27 +7108,6 @@ dependencies = [ "syn 2.0.110", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "system-interface" version = "0.27.3" @@ -7876,12 +7409,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ "bytes", - "libc", - "mio", "pin-project-lite", - "socket2 0.6.1", "tokio-macros", - "windows-sys 0.61.2", ] [[package]] @@ -7895,16 +7424,6 @@ dependencies = [ "syn 2.0.110", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.15" @@ -7928,7 +7447,6 @@ dependencies = [ "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -7977,12 +7495,6 @@ dependencies = [ "winnow 0.6.18", ] -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - [[package]] name = "tracing" version = "0.1.41" @@ -8065,12 +7577,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "twox-hash" version = "1.6.3" @@ -8210,12 +7716,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "vergen" version = "9.0.0" @@ -8424,15 +7924,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -8823,7 +8314,7 @@ dependencies = [ "getrandom 0.2.15", "heapless", "hex", - "http 1.1.0", + "http", "js-sys", "libc", "linked_hash_set", @@ -9619,16 +9110,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "winx" version = "0.36.4" diff --git a/Cargo.toml b/Cargo.toml index 2f655dd3d41f..3cd0c2874ac8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,6 @@ codspeed-criterion-compat = "3.0.4" compact_str = "0.7.1" console_error_panic_hook = "0.1.7" copyless = "0.1.5" -crc = "2.1.0" criterion = "0.5.1" dashmap = "6.1.0" dialoguer = "0.10.2" @@ -76,7 +75,6 @@ napi-build = "2" napi-derive = { version = "3", default-features = false } new_debug_unreachable = "1.0.6" nom = "7.1.3" -ntest = "0.7.2" notify = "8.0.0" num-bigint = "0.4.3" num_cpus = "1.13.1" @@ -99,7 +97,6 @@ rayon = "1.7.0" regex = "1.5.4" regress = "0.10.3" relative-path = "1.6.1" -reqwest = "0.11.14" rustc-hash = "2" ryu-js = "1.0.0" scoped-tls = "1.0.1" @@ -321,9 +318,6 @@ opt-level = "s" [profile.release.package.miette] opt-level = "s" -[profile.release.package.swc_bundler] -opt-level = "s" - [profile.release.package.swc_ecma_compat_es3] opt-level = "s" diff --git a/bindings/binding_core_node/Cargo.toml b/bindings/binding_core_node/Cargo.toml index 6385bfd20bc9..dac3ca6448a6 100644 --- a/bindings/binding_core_node/Cargo.toml +++ b/bindings/binding_core_node/Cargo.toml @@ -13,14 +13,12 @@ bench = false crate-type = ["cdylib"] [features] -default = ["swc_v1", "plugin"] +default = ["plugin"] plugin = [ "swc_core/plugin_backend_wasmer", "swc_core/plugin_transform_host_native", "swc_core/plugin_transform_host_native_filesystem_cache", ] -swc_v1 = ["swc_core/bundler_node_v1"] -swc_v2 = ["swc_core/bundler_node_v2"] # Internal flag for testing purpose only. __plugin_transform_vtest = [ @@ -54,7 +52,6 @@ swc_core = { path = "../../crates/swc_core", features = [ "ecma_codegen", "ecma_ast_serde", "common_concurrent", - "bundler", "ecma_loader", "ecma_helpers_inline", "ecma_transforms", diff --git a/bindings/binding_core_node/build.rs b/bindings/binding_core_node/build.rs index a6220cd0337c..133bbd5c8740 100644 --- a/bindings/binding_core_node/build.rs +++ b/bindings/binding_core_node/build.rs @@ -7,12 +7,6 @@ use std::{ extern crate napi_build; -#[cfg(all(not(feature = "swc_v1"), not(feature = "swc_v2")))] -compile_error!("Please enable swc_v1 or swc_v2 feature"); - -#[cfg(all(feature = "swc_v1", feature = "swc_v2"))] -compile_error!("Features swc_v1 and swc_v2 are incompatible"); - fn main() { let out_dir = env::var("OUT_DIR").expect("Outdir should exist"); let dest_path = Path::new(&out_dir).join("triple.txt"); diff --git a/bindings/binding_core_node/src/bundle.rs b/bindings/binding_core_node/src/bundle.rs deleted file mode 100644 index 0cad294c0260..000000000000 --- a/bindings/binding_core_node/src/bundle.rs +++ /dev/null @@ -1,303 +0,0 @@ -use std::{ - panic::{catch_unwind, AssertUnwindSafe}, - sync::Arc, -}; - -use anyhow::{bail, Error}; -use napi::{ - bindgen_prelude::{AbortSignal, AsyncTask, Buffer}, - Env, Status, Task, -}; -use rustc_hash::FxHashMap; -use serde::Deserialize; -use swc_core::{ - atoms::Atom, - base::{ - config::SourceMapsConfig, - resolver::{environment_resolver, paths_resolver}, - Compiler, PrintArgs, TransformOutput, - }, - bundler::{BundleKind, Bundler, Load, ModuleRecord, Resolve}, - common::{Globals, Span, GLOBALS}, - ecma::{ - ast::{ - Bool, Expr, IdentName, KeyValueProp, Lit, MemberExpr, MemberProp, MetaPropExpr, - MetaPropKind, PropName, Str, - }, - loader::{TargetEnv, NODE_BUILTINS}, - }, - node::{get_deserialized, MapErr}, -}; - -use crate::get_compiler; - -struct ConfigItem { - loader: Box, - resolver: Box, - static_items: StaticConfigItem, -} - -#[derive(Debug, Deserialize)] -#[serde(rename_all = "camelCase")] -struct StaticConfigItem { - #[cfg(feature = "swc_v1")] - #[serde(flatten)] - config: swc_core::bundler::node::v1::Config, -} - -pub(crate) struct BundleTask { - swc: Arc, - config: ConfigItem, -} - -#[cfg(feature = "swc_v1")] -#[napi] -impl Task for BundleTask { - type JsValue = FxHashMap; - type Output = FxHashMap; - - fn compute(&mut self) -> napi::Result { - let builtins = if let TargetEnv::Node = self.config.static_items.config.target { - NODE_BUILTINS - .iter() - .copied() - .map(Atom::from) - .collect::>() - } else { - Vec::new() - }; - - // Defaults to es3 - let codegen_target = self - .config - .static_items - .config - .codegen_target() - .unwrap_or_default(); - - let globals = Globals::default(); - GLOBALS.set(&globals, || { - let res = catch_unwind(AssertUnwindSafe(|| { - let mut bundler = Bundler::new( - &globals, - self.swc.cm.clone(), - &self.config.loader, - &self.config.resolver, - swc_core::bundler::Config { - require: true, - external_modules: builtins - .into_iter() - .chain( - self.config - .static_items - .config - .external_modules - .iter() - .cloned(), - ) - .collect(), - ..Default::default() - }, - Box::new(Hook), - ); - - let result = bundler - .bundle(self.config.static_items.config.entry.clone().into()) - .convert_err()?; - - let result = result - .into_iter() - .map(|bundle| match bundle.kind { - BundleKind::Named { name } | BundleKind::Lib { name } => { - Ok((name, bundle.module)) - } - BundleKind::Dynamic => bail!("unimplemented: dynamic code splitting"), - }) - .map(|res| { - res.and_then(|(k, m)| { - // TODO: Source map - let minify = self - .config - .static_items - .config - .options - .as_ref() - .map(|v| v.config.minify.into_bool()) - .unwrap_or(false); - - let output = self.swc.print( - &m, - PrintArgs { - inline_sources_content: true, - source_map: SourceMapsConfig::Bool(true), - emit_source_map_columns: true, - codegen_config: swc_core::ecma::codegen::Config::default() - .with_target(codegen_target) - .with_minify(minify), - ..Default::default() - }, - )?; - - Ok((k, output)) - }) - }) - .collect::>() - .convert_err()?; - - Ok(result) - })); - - let err = match res { - Ok(v) => return v, - Err(err) => err, - }; - - if let Some(s) = err.downcast_ref::() { - return Err(napi::Error::new( - Status::GenericFailure, - format!("panic detected: {s}"), - )); - } - - Err(napi::Error::new( - Status::GenericFailure, - "panic detected".to_string(), - )) - }) - } - - fn resolve(&mut self, _env: Env, output: Self::Output) -> napi::Result { - Ok(output) - } -} - -#[cfg(feature = "swc_v2")] -impl Task for BundleTask { - type JsValue = FxHashMap; - type Output = FxHashMap; - - fn compute(&mut self) -> napi::Result { - todo!() - } - - fn resolve(&mut self, env: Env, output: Self::Output) -> napi::Result { - todo!() - } -} - -#[cfg(feature = "swc_v1")] -#[napi(ts_return_type = "Promise<{ [index: string]: { code: string, map?: string } }>")] -pub(crate) fn bundle( - conf_items: Buffer, - signal: Option, -) -> napi::Result> { - crate::util::init_default_trace_subscriber(); - - let c: Arc = get_compiler(); - - let static_items: StaticConfigItem = get_deserialized(&conf_items)?; - - let loader = Box::new(swc_core::bundler::node::loaders::swc::SwcLoader::new( - c.clone(), - static_items - .config - .options - .as_ref() - .cloned() - .unwrap_or_else(|| { - serde_json::from_value(serde_json::Value::Object(Default::default())).unwrap() - }), - )); - - let target_env = static_items.config.target; - - let paths = static_items.config.options.as_ref().map(|options| { - let paths: Vec<(String, Vec)> = options - .config - .jsc - .paths - .iter() - .map(|(k, v)| (k.clone(), v.clone())) - .collect(); - (options.config.jsc.base_url.clone(), paths) - }); - - let alias = static_items - .config - .alias - .get(&target_env) - .cloned() - .unwrap_or_default(); - - let resolver: Box = if let Some((base_url, paths)) = paths { - Box::new(paths_resolver( - target_env, - alias, - base_url, - paths, - static_items.config.preserve_symlinks, - )) - } else { - Box::new(environment_resolver( - target_env, - alias, - static_items.config.preserve_symlinks, - )) - }; - - Ok(AsyncTask::with_optional_signal( - BundleTask { - swc: c, - config: ConfigItem { - loader, - resolver, - static_items, - }, - }, - signal, - )) -} - -#[cfg(feature = "swc_v2")] -#[napi] -pub(crate) fn bundle() -> napi::Result> { - todo!() -} - -struct Hook; - -impl swc_core::bundler::Hook for Hook { - fn get_import_meta_props( - &self, - span: Span, - module_record: &ModuleRecord, - ) -> Result, Error> { - let file_name = module_record.file_name.to_string(); - - Ok(vec![ - KeyValueProp { - key: PropName::Ident(IdentName::new("url".into(), span)), - value: Box::new(Expr::Lit(Lit::Str(Str { - span, - raw: None, - value: file_name.into(), - }))), - }, - KeyValueProp { - key: PropName::Ident(IdentName::new("main".into(), span)), - value: Box::new(if module_record.is_entry { - Expr::Member(MemberExpr { - span, - obj: Box::new(Expr::MetaProp(MetaPropExpr { - span, - kind: MetaPropKind::ImportMeta, - })), - prop: MemberProp::Ident(IdentName::new("main".into(), span)), - }) - } else { - Expr::Lit(Lit::Bool(Bool { span, value: false })) - }), - }, - ]) - } -} diff --git a/bindings/binding_core_node/src/lib.rs b/bindings/binding_core_node/src/lib.rs index 6450cb4362e0..21d832ab34dc 100644 --- a/bindings/binding_core_node/src/lib.rs +++ b/bindings/binding_core_node/src/lib.rs @@ -17,7 +17,6 @@ use swc_core::{ #[cfg(feature = "plugin")] mod analyze; mod ast_context; -mod bundle; mod minify; mod parse; mod print; diff --git a/crates/swc/src/lib.rs b/crates/swc/src/lib.rs index 8b5c9c0e4cb6..3969063839fa 100644 --- a/crates/swc/src/lib.rs +++ b/crates/swc/src/lib.rs @@ -282,15 +282,15 @@ fn downgrade_flow_script_like_module(program: Program) -> Result return Ok(program); }; - if module - .body - .iter() - .any(|module_item| matches!(module_item, ModuleItem::ModuleDecl(..))) - { - bail!( - "failed to downgrade Flow type-only module to script because module declarations \ - remain after stripping" - ); + match classify_flow_script_like_module_body(&module) { + FlowScriptLikeModuleKind::Script => {} + FlowScriptLikeModuleKind::RuntimeModule(..) => return Ok(Program::Module(module)), + FlowScriptLikeModuleKind::TypeOnlyModule => { + bail!( + "failed to downgrade Flow type-only module to script because module declarations \ + remain after stripping" + ); + } } let Module { diff --git a/crates/swc/src/plugin.rs b/crates/swc/src/plugin.rs index 157b4a949b3a..6a07ba3e3190 100644 --- a/crates/swc/src/plugin.rs +++ b/crates/swc/src/plugin.rs @@ -231,7 +231,10 @@ pub(crate) fn compile_wasm_plugins( ) -> Result<()> { let plugin_resolver = CachingResolver::new( 40, - NodeModulesResolver::new(swc_ecma_loader::TargetEnv::Node, Default::default(), true), + // WASM plugins can be configured by npm package name, such as + // `@swc/plugin-styled-components`, so plugin resolution must walk + // node_modules instead of only accepting filesystem paths. + NodeModulesResolver::new(swc_ecma_loader::TargetEnv::Node, Default::default(), false), ); // Currently swc enables filesystemcache by default on Embedded runtime plugin diff --git a/crates/swc/tests/srcmap/issue-622/index.js b/crates/swc/tests/srcmap/issue-622/index.js index f679e5c829ad..9053cef5e32c 100644 --- a/crates/swc/tests/srcmap/issue-622/index.js +++ b/crates/swc/tests/srcmap/issue-622/index.js @@ -1,6 +1,6 @@ -function* foo() { +function foo() { try { - return yield call(); + return call(); } finally { } -} \ No newline at end of file +} diff --git a/crates/swc_bundler/.gitignore b/crates/swc_bundler/.gitignore deleted file mode 100644 index 579ffda53d5e..000000000000 --- a/crates/swc_bundler/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# examples/bundle.rs generates this file. -output.js \ No newline at end of file diff --git a/crates/swc_bundler/AGENTS.md b/crates/swc_bundler/AGENTS.md deleted file mode 100644 index 5bc919c35ec0..000000000000 --- a/crates/swc_bundler/AGENTS.md +++ /dev/null @@ -1,5 +0,0 @@ -### Fixture Test Addition Guide - -- Preferred fixture roots in this crate: tests/fixture, tests/deno-exec. -- Update generated fixture outputs with: UPDATE=1 cargo test -p swc_bundler. -- Verify without UPDATE before finishing: cargo test -p swc_bundler. diff --git a/crates/swc_bundler/Cargo.toml b/crates/swc_bundler/Cargo.toml deleted file mode 100644 index f5376974c004..000000000000 --- a/crates/swc_bundler/Cargo.toml +++ /dev/null @@ -1,80 +0,0 @@ -[package] -authors = ["강동윤 "] -# OUT_DIR is required for testing -build = "build.rs" -description = "Very fast ecmascript bundler" -documentation = "https://rustdoc.swc.rs/swc_bundler/" -edition = { workspace = true } -include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"] -license = { workspace = true } -name = "swc_bundler" -repository = { workspace = true } -version = "51.0.0" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] - -[lib] -bench = false - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(swc_ast_unknown)'] } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[features] -concurrent = ["swc_common/concurrent", "dashmap", "rayon", "indexmap/rayon"] -default = [] - -[dependencies] -anyhow = { workspace = true } -crc = { workspace = true } -dashmap = { workspace = true, optional = true } -indexmap = { workspace = true } -is-macro = { workspace = true } -once_cell = { workspace = true } -petgraph = { workspace = true } -radix_fmt = { workspace = true } -rayon = { workspace = true, optional = true } -relative-path = { workspace = true } -rustc-hash = { workspace = true } -tracing = { workspace = true } - -swc_atoms = { version = "9.0.3", path = "../swc_atoms" } -swc_common = { version = "23.0.1", path = "../swc_common" } -swc_ecma_ast = { version = "25.0.0", path = "../swc_ecma_ast" } -swc_ecma_codegen = { version = "28.0.1", path = "../swc_ecma_codegen" } -swc_ecma_loader = { version = "24.0.0", path = "../swc_ecma_loader" } -swc_ecma_parser = { version = "41.0.1", path = "../swc_ecma_parser", default-features = false, features = [ - "typescript", -] } -swc_ecma_transforms_base = { version = "44.0.2", path = "../swc_ecma_transforms_base" } -swc_ecma_transforms_optimization = { version = "47.0.0", path = "../swc_ecma_transforms_optimization" } -swc_ecma_utils = { version = "31.0.0", path = "../swc_ecma_utils" } -swc_ecma_visit = { version = "25.0.0", path = "../swc_ecma_visit" } -swc_graph_analyzer = { version = "14.0.1", path = "../swc_graph_analyzer/" } - -[dev-dependencies] -hex = { workspace = true } -ntest = { workspace = true } -par-core = { workspace = true, features = ["chili"] } -path-clean = "1.0.1" -reqwest = { workspace = true, features = ["blocking"] } -sha1 = { workspace = true } -tempfile = { workspace = true } - -swc_ecma_loader = { version = "24.0.0", path = "../swc_ecma_loader", features = [ - "node", - "cache", -] } -swc_ecma_minifier = { version = "55.0.1", path = "../swc_ecma_minifier", features = [ - "concurrent", -] } -swc_ecma_transforms_base = { version = "44.0.2", path = "../swc_ecma_transforms_base", features = [ - "inline-helpers", -] } -swc_ecma_transforms_proposal = { version = "44.0.1", path = "../swc_ecma_transforms_proposal" } -swc_ecma_transforms_react = { version = "49.0.0", path = "../swc_ecma_transforms_react" } -swc_ecma_transforms_typescript = { version = "49.0.0", path = "../swc_ecma_transforms_typescript" } -swc_malloc = { version = "1.2.5", path = "../swc_malloc" } -testing = { version = "24.0.0", path = "../testing" } diff --git a/crates/swc_bundler/README.md b/crates/swc_bundler/README.md deleted file mode 100644 index 63ec86d792bf..000000000000 --- a/crates/swc_bundler/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# swc_bundler - -Bundler for the SWC project. - -## Features - -- Clean merging (generated code is easy to optimize) -- Parallel file loading -- Tree shaking -- Common js support (aka `require`) -- Circular imports - -Tests live at `/spack`. diff --git a/crates/swc_bundler/assets/a.js b/crates/swc_bundler/assets/a.js deleted file mode 100644 index ff6be2ff0975..000000000000 --- a/crates/swc_bundler/assets/a.js +++ /dev/null @@ -1,5 +0,0 @@ -export const FOO = 1; - -export class A { - foo() {} -} diff --git a/crates/swc_bundler/assets/main.js b/crates/swc_bundler/assets/main.js deleted file mode 100644 index a4afaa352927..000000000000 --- a/crates/swc_bundler/assets/main.js +++ /dev/null @@ -1,3 +0,0 @@ -import { A, FOO } from "./a"; - -console.log(A, FOO); diff --git a/crates/swc_bundler/build.rs b/crates/swc_bundler/build.rs deleted file mode 100644 index f328e4d9d04c..000000000000 --- a/crates/swc_bundler/build.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/crates/swc_bundler/examples/bundle.rs b/crates/swc_bundler/examples/bundle.rs deleted file mode 100644 index 6b823175da08..000000000000 --- a/crates/swc_bundler/examples/bundle.rs +++ /dev/null @@ -1,250 +0,0 @@ -#![allow(clippy::needless_update)] - -/// Use memory allocator -extern crate swc_malloc; - -use std::{ - collections::HashMap, - env, fs, - path::Path, - time::{Duration, Instant}, -}; - -use anyhow::Error; -use swc_atoms::atom; -use swc_bundler::{Bundle, Bundler, Load, ModuleData, ModuleRecord}; -use swc_common::{ - errors::{ColorConfig, Handler}, - sync::Lrc, - FileName, Mark, SourceMap, Span, GLOBALS, -}; -use swc_ecma_ast::*; -use swc_ecma_codegen::{ - text_writer::{omit_trailing_semi, JsWriter, WriteJs}, - Emitter, -}; -use swc_ecma_loader::{ - resolvers::{lru::CachingResolver, node::NodeModulesResolver}, - TargetEnv, -}; -use swc_ecma_minifier::option::{ - CompressOptions, ExtraOptions, MangleOptions, MinifyOptions, TopLevelOptions, -}; -use swc_ecma_parser::{parse_file_as_module, Syntax}; -use swc_ecma_transforms_base::fixer::fixer; -use swc_ecma_visit::VisitMutWith; - -fn print_bundles(cm: Lrc, modules: Vec, minify: bool) { - for bundled in modules { - let code = { - let mut buf = Vec::new(); - - { - let wr = JsWriter::new(cm.clone(), "\n", &mut buf, None); - let mut emitter = Emitter { - cfg: swc_ecma_codegen::Config::default().with_minify(true), - cm: cm.clone(), - comments: None, - wr: if minify { - Box::new(omit_trailing_semi(wr)) as Box - } else { - Box::new(wr) as Box - }, - }; - - emitter.emit_module(&bundled.module).unwrap(); - } - - String::from_utf8_lossy(&buf).to_string() - }; - - #[cfg(feature = "concurrent")] - rayon::spawn(move || drop(bundled)); - - println!("Created output.js ({}kb)", code.len() / 1024); - fs::write("output.js", &code).unwrap(); - } -} - -fn do_test(_entry: &Path, entries: HashMap, inline: bool, minify: bool) { - testing::run_test2(false, |cm, _| { - let start = Instant::now(); - - let globals = Box::leak(Box::default()); - let mut bundler = Bundler::new( - globals, - cm.clone(), - Loader { cm: cm.clone() }, - CachingResolver::new( - 4096, - NodeModulesResolver::new(TargetEnv::Node, Default::default(), true), - ), - swc_bundler::Config { - require: false, - disable_inliner: !inline, - external_modules: Default::default(), - disable_fixer: minify, - disable_hygiene: minify, - disable_dce: false, - module: Default::default(), - }, - Box::new(Hook), - ); - - let mut modules = bundler.bundle(entries).map_err(|err| println!("{err:?}"))?; - println!("Bundled as {} modules", modules.len()); - - #[cfg(feature = "concurrent")] - rayon::spawn(move || { - drop(bundler); - }); - - { - let dur = start.elapsed(); - println!("Bundler.bundle() took {}", to_ms(dur)); - } - - let error = false; - if minify { - let start = Instant::now(); - - modules = modules - .into_iter() - .map(|mut b| { - GLOBALS.set(globals, || { - b.module = swc_ecma_minifier::optimize( - b.module.into(), - cm.clone(), - None, - None, - &MinifyOptions { - compress: Some(CompressOptions { - top_level: Some(TopLevelOptions { functions: true }), - ..Default::default() - }), - mangle: Some(MangleOptions { - top_level: Some(true), - ..Default::default() - }), - ..Default::default() - }, - &ExtraOptions { - unresolved_mark: Mark::new(), - top_level_mark: Mark::new(), - mangle_name_cache: None, - }, - ) - .expect_module(); - b.module.visit_mut_with(&mut fixer(None)); - b - }) - }) - .collect(); - - let dur = start.elapsed(); - println!("Minification took {}", to_ms(dur)); - } - - { - let cm = cm; - print_bundles(cm, modules, minify); - } - - if error { - return Err(()); - } - - Ok(()) - }) - .expect("failed to process a module"); -} - -fn to_ms(dur: Duration) -> String { - format!("{}ms", dur.as_millis()) -} - -fn main() -> Result<(), Error> { - let minify = env::var("MINIFY").unwrap_or_else(|_| "0".to_string()) == "1"; - - let main_file = env::args().nth(1).unwrap(); - let mut entries = HashMap::default(); - entries.insert("main".to_string(), FileName::Real(main_file.clone().into())); - - let start = Instant::now(); - do_test(Path::new(&main_file), entries, false, minify); - let dur = start.elapsed(); - println!("Took {}", to_ms(dur)); - - Ok(()) -} - -struct Hook; - -impl swc_bundler::Hook for Hook { - fn get_import_meta_props( - &self, - span: Span, - module_record: &ModuleRecord, - ) -> Result, Error> { - let file_name = module_record.file_name.to_string(); - - Ok(vec![ - KeyValueProp { - key: PropName::Ident(IdentName::new(atom!("url"), span)), - value: Box::new(Expr::Lit(Lit::Str(Str { - span, - raw: None, - value: file_name.into(), - }))), - }, - KeyValueProp { - key: PropName::Ident(IdentName::new(atom!("main"), span)), - value: Box::new(if module_record.is_entry { - Expr::Member(MemberExpr { - span, - obj: Box::new(Expr::MetaProp(MetaPropExpr { - span, - kind: MetaPropKind::ImportMeta, - })), - prop: MemberProp::Ident(IdentName::new(atom!("main"), span)), - }) - } else { - Expr::Lit(Lit::Bool(Bool { span, value: false })) - }), - }, - ]) - } -} - -pub struct Loader { - pub cm: Lrc, -} - -impl Load for Loader { - fn load(&self, f: &FileName) -> Result { - let fm = match f { - FileName::Real(path) => self.cm.load_file(path)?, - _ => unreachable!(), - }; - - let module = parse_file_as_module( - &fm, - Syntax::Es(Default::default()), - EsVersion::Es2020, - None, - &mut Vec::new(), - ) - .unwrap_or_else(|err| { - let handler = - Handler::with_tty_emitter(ColorConfig::Always, false, false, Some(self.cm.clone())); - err.into_diagnostic(&handler).emit(); - panic!("failed to parse") - }); - - Ok(ModuleData { - fm, - module, - helpers: Default::default(), - }) - } -} diff --git a/crates/swc_bundler/examples/path.rs b/crates/swc_bundler/examples/path.rs deleted file mode 100644 index 3eb0f7535461..000000000000 --- a/crates/swc_bundler/examples/path.rs +++ /dev/null @@ -1,120 +0,0 @@ -use std::{collections::HashMap, io::stdout}; - -use anyhow::Error; -use swc_bundler::{BundleKind, Bundler, Config, Hook, Load, ModuleData, ModuleRecord, Resolve}; -use swc_common::{sync::Lrc, FileName, FilePathMapping, Globals, SourceMap, Span}; -use swc_ecma_ast::KeyValueProp; -use swc_ecma_codegen::{text_writer::JsWriter, Emitter}; -use swc_ecma_loader::resolve::Resolution; -use swc_ecma_parser::{parse_file_as_module, Syntax}; - -fn main() { - let _log = testing::init(); - - let globals = Globals::new(); - let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); - // This example does not use core modules. - let external_modules = Vec::new(); - let mut bundler = Bundler::new( - &globals, - cm.clone(), - PathLoader { cm: cm.clone() }, - PathResolver, - Config { - require: true, - external_modules, - ..Default::default() - }, - Box::new(Noop), - ); - let mut entries = HashMap::default(); - entries.insert("main".to_string(), FileName::Real("assets/main.js".into())); - - let mut bundles = bundler.bundle(entries).expect("failed to bundle"); - assert_eq!( - bundles.len(), - 1, - "There's no conditional / dynamic imports and we provided only one entry" - ); - let bundle = bundles.pop().unwrap(); - assert_eq!( - bundle.kind, - BundleKind::Named { - name: "main".into() - }, - "We provided it" - ); - - let wr = stdout(); - let mut emitter = Emitter { - cfg: swc_ecma_codegen::Config::default(), - cm: cm.clone(), - comments: None, - wr: Box::new(JsWriter::new(cm, "\n", wr.lock(), None)), - }; - - emitter.emit_module(&bundle.module).unwrap(); -} - -struct PathLoader { - cm: Lrc, -} - -impl Load for PathLoader { - fn load(&self, file: &FileName) -> Result { - let file = match file { - FileName::Real(v) => v, - _ => unreachable!(), - }; - - let fm = self.cm.load_file(file)?; - - let module = parse_file_as_module( - &fm, - Syntax::Es(Default::default()), - Default::default(), - None, - &mut Vec::new(), - ) - .expect("This should not happen"); - - Ok(ModuleData { - fm, - module, - helpers: Default::default(), - }) - } -} -struct PathResolver; - -impl Resolve for PathResolver { - fn resolve(&self, base: &FileName, module_specifier: &str) -> Result { - assert!( - module_specifier.starts_with('.'), - "We are not using node_modules within this example" - ); - - let base = match base { - FileName::Real(v) => v, - _ => unreachable!(), - }; - - Ok(Resolution { - filename: FileName::Real( - base.parent() - .unwrap() - .join(module_specifier) - .with_extension("js"), - ), - slug: None, - }) - } -} - -struct Noop; - -impl Hook for Noop { - fn get_import_meta_props(&self, _: Span, _: &ModuleRecord) -> Result, Error> { - unimplemented!() - } -} diff --git a/crates/swc_bundler/scripts/minifier.sh b/crates/swc_bundler/scripts/minifier.sh deleted file mode 100755 index 73aa06b5f294..000000000000 --- a/crates/swc_bundler/scripts/minifier.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -eu - -export RUST_LOG=swc_ecma_minifier=debug -export RUST_BACKTRACE=1 - -cargo test --test deno $@ \ No newline at end of file diff --git a/crates/swc_bundler/scripts/test.sh b/crates/swc_bundler/scripts/test.sh deleted file mode 100755 index ddd37b19e1a4..000000000000 --- a/crates/swc_bundler/scripts/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -eux - -cargo test --lib -cargo test --test fixture -(cd ../spack && cargo test --test fixture) -cargo test --test deno $@ -- --nocapture \ No newline at end of file diff --git a/crates/swc_bundler/src/bundler/chunk/cjs.rs b/crates/swc_bundler/src/bundler/chunk/cjs.rs deleted file mode 100644 index 428812e6263f..000000000000 --- a/crates/swc_bundler/src/bundler/chunk/cjs.rs +++ /dev/null @@ -1,392 +0,0 @@ -use std::{collections::HashMap, sync::atomic::Ordering}; - -use anyhow::Error; -use rustc_hash::FxHashMap; -use swc_atoms::atom; -use swc_common::{Span, SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_utils::{quote_ident, ExprFactory}; -use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; - -use crate::{ - bundler::{chunk::merge::Ctx, load::TransformedModule}, - modules::Modules, - Bundler, Load, Resolve, -}; - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - fn make_cjs_load_var(&self, info: &TransformedModule, span: Span) -> Ident { - Ident::new(atom!("load"), span, info.export_ctxt()) - } - - pub(super) fn replace_cjs_require_calls( - &self, - info: &TransformedModule, - module: &mut Modules, - is_entry: bool, - ) { - if !self.config.require { - return; - } - - let mut v = RequireReplacer { - is_entry, - base: info, - bundler: self, - replaced: false, - }; - module.visit_mut_with(&mut v); - - if v.replaced { - info.helpers.require.store(true, Ordering::SeqCst); - } - } - - /// Creates a variable named `load` (see `make_cjs_load_var`) if it's a - /// common js module. - pub(super) fn wrap_cjs_module( - &self, - ctx: &Ctx, - info: &TransformedModule, - mut module: Modules, - ) -> Result { - if !self.config.require || (!self.scope.is_cjs(info.id) && info.is_es6) { - return Ok(module); - } - - tracing::debug!("Merging as a common js module: {}", info.fm.name); - - let load_var = self.make_cjs_load_var(info, DUMMY_SP); - - module.visit_mut_with(&mut DefaultHandler { - local_ctxt: info.local_ctxt(), - }); - module.sort(info.id, &ctx.graph, &ctx.cycles, &self.cm); - - let stmt = wrap_module( - SyntaxContext::empty(), - SyntaxContext::empty().apply_mark(self.unresolved_mark), - info.local_ctxt(), - load_var, - module.into(), - ) - .into(); - - let wrapped = Modules::from( - info.id, - Module { - span: DUMMY_SP, - body: vec![stmt], - shebang: None, - }, - self.injected_ctxt, - ); - - tracing::debug!("Injected a variable named `load` for a common js module"); - - Ok(wrapped) - } -} - -fn wrap_module( - helper_ctxt: SyntaxContext, - unresolved_ctxt: SyntaxContext, - local_ctxt: SyntaxContext, - load_var: Ident, - mut dep: Module, -) -> Stmt { - { - // Remap syntax context of `module` and `exports` - // Those are unresolved, but it's actually an injected variable. - - let mut from = HashMap::default(); - from.insert((atom!("module"), unresolved_ctxt), local_ctxt); - from.insert((atom!("exports"), unresolved_ctxt), local_ctxt); - - dep.visit_mut_with(&mut Remapper { vars: from }) - } - - // ... body of foo - let module_fn: Expr = FnExpr { - ident: None, - function: Box::new(Function { - params: vec![ - // module - Param { - span: DUMMY_SP, - decorators: Default::default(), - pat: Pat::Ident(Ident::new(atom!("module"), DUMMY_SP, local_ctxt).into()), - }, - // exports - Param { - span: DUMMY_SP, - decorators: Default::default(), - pat: Pat::Ident(Ident::new(atom!("exports"), DUMMY_SP, local_ctxt).into()), - }, - ], - decorators: Vec::new(), - span: DUMMY_SP, - body: Some(BlockStmt { - span: dep.span, - stmts: dep - .body - .into_iter() - .map(|v| match v { - ModuleItem::ModuleDecl(i) => { - unreachable!("module item found but is_es6 is false: {:?}", i) - } - ModuleItem::Stmt(s) => s, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }) - .collect(), - ..Default::default() - }), - is_generator: false, - is_async: false, - ..Default::default() - }), - } - .into(); - - // var load = __swcpack_require__.bind(void 0, moduleDecl) - - VarDecl { - span: DUMMY_SP, - kind: VarDeclKind::Var, - declare: false, - decls: vec![VarDeclarator { - span: DUMMY_SP, - name: Pat::Ident(load_var.into()), - init: Some(Box::new(Expr::Call(CallExpr { - span: DUMMY_SP, - callee: Ident::new(atom!("__swcpack_require__"), DUMMY_SP, helper_ctxt) - .make_member(quote_ident!("bind")) - .as_callee(), - args: vec![Expr::undefined(DUMMY_SP).as_arg(), module_fn.as_arg()], - ..Default::default() - }))), - definite: false, - }], - ..Default::default() - } - .into() -} - -struct RequireReplacer<'a, 'b, L, R> -where - L: Load, - R: Resolve, -{ - base: &'a TransformedModule, - bundler: &'a Bundler<'b, L, R>, - replaced: bool, - is_entry: bool, -} - -impl VisitMut for RequireReplacer<'_, '_, L, R> -where - L: Load, - R: Resolve, -{ - noop_visit_mut_type!(fail); - - fn visit_mut_call_expr(&mut self, node: &mut CallExpr) { - node.visit_mut_children_with(self); - - if let Callee::Expr(e) = &node.callee { - if let Expr::Ident(i) = &**e { - // TODO: Check for global mark - if i.sym == *"require" && node.args.len() == 1 { - if let Expr::Lit(Lit::Str(module_name)) = &*node.args[0].expr { - let module_atom = module_name.value.to_atom_lossy(); - if self.bundler.is_external(module_atom.as_ref()) { - return; - } - let load = CallExpr { - span: node.span, - callee: Ident::new(atom!("load"), i.span, i.ctxt).as_callee(), - args: Vec::new(), - ..Default::default() - }; - self.replaced = true; - *node = load; - - tracing::trace!("Found, and replacing require"); - } - } - } - } - } - - fn visit_mut_module_item(&mut self, node: &mut ModuleItem) { - node.visit_mut_children_with(self); - - if !self.is_entry { - return; - } - - if let ModuleItem::ModuleDecl(ModuleDecl::Import(i)) = node { - let dep_module_id = self - .base - .imports - .specifiers - .iter() - .find(|(src, _)| src.src.value == i.src.value) - .map(|v| v.0.module_id); - let dep_module_id = match dep_module_id { - Some(v) => v, - _ => { - return; - } - }; - // Replace imports iff dependency is common js module. - let dep_module = self.bundler.scope.get_module(dep_module_id).unwrap(); - if !self.bundler.scope.is_cjs(dep_module_id) && dep_module.is_es6 { - return; - } - - let load_var = self.bundler.make_cjs_load_var(&dep_module, i.span); - // Replace import progress from 'progress'; - // Side effect import - if i.specifiers.is_empty() { - self.replaced = true; - *node = CallExpr { - span: DUMMY_SP, - callee: load_var.as_callee(), - args: Vec::new(), - - ..Default::default() - } - .into_stmt() - .into(); - return; - } - - let mut props = Vec::new(); - // TODO - for spec in i.specifiers.clone() { - match spec { - ImportSpecifier::Named(s) => match s.imported { - Some(ModuleExportName::Ident(imported)) => { - props.push(ObjectPatProp::KeyValue(KeyValuePatProp { - key: imported.into(), - value: Box::new(s.local.into()), - })); - } - Some(ModuleExportName::Str(..)) => { - unimplemented!("module string names unimplemented") - } - _ => { - props.push(ObjectPatProp::Assign(AssignPatProp { - span: s.span, - key: s.local.into(), - value: None, - })); - } - }, - ImportSpecifier::Default(s) => { - props.push(ObjectPatProp::KeyValue(KeyValuePatProp { - key: PropName::Ident(IdentName::new(atom!("default"), DUMMY_SP)), - value: Box::new(s.local.into()), - })); - } - ImportSpecifier::Namespace(ns) => { - self.replaced = true; - *node = VarDecl { - span: i.span, - kind: VarDeclKind::Var, - declare: false, - decls: vec![VarDeclarator { - span: ns.span, - name: ns.local.into(), - init: Some(Box::new( - CallExpr { - span: DUMMY_SP, - callee: load_var.as_callee(), - args: Vec::new(), - - ..Default::default() - } - .into(), - )), - definite: false, - }], - ..Default::default() - } - .into(); - return; - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - self.replaced = true; - *node = VarDecl { - span: i.span, - kind: VarDeclKind::Var, - declare: false, - decls: vec![VarDeclarator { - span: i.span, - name: Pat::Object(ObjectPat { - span: DUMMY_SP, - props, - optional: false, - type_ann: None, - }), - init: Some(Box::new(Expr::Call(CallExpr { - span: DUMMY_SP, - callee: load_var.as_callee(), - args: Vec::new(), - ..Default::default() - }))), - definite: false, - }], - ..Default::default() - } - .into(); - } - } -} - -struct DefaultHandler { - local_ctxt: SyntaxContext, -} - -impl VisitMut for DefaultHandler { - noop_visit_mut_type!(fail); - - fn visit_mut_expr(&mut self, e: &mut Expr) { - e.visit_mut_children_with(self); - - if let Expr::Ident(i) = e { - if i.sym == "default" { - *e = MemberExpr { - span: i.span, - obj: Ident::new(atom!("module"), DUMMY_SP, self.local_ctxt).into(), - prop: MemberProp::Ident(quote_ident!("exports")), - } - .into(); - } - } - } -} - -struct Remapper { - vars: FxHashMap, -} - -impl VisitMut for Remapper { - noop_visit_mut_type!(fail); - - fn visit_mut_ident(&mut self, i: &mut Ident) { - if let Some(v) = self.vars.get(&i.to_id()).copied() { - i.ctxt = v; - } - } -} diff --git a/crates/swc_bundler/src/bundler/chunk/computed_key.rs b/crates/swc_bundler/src/bundler/chunk/computed_key.rs deleted file mode 100644 index f64dfde3a492..000000000000 --- a/crates/swc_bundler/src/bundler/chunk/computed_key.rs +++ /dev/null @@ -1,355 +0,0 @@ -use std::mem::take; - -use anyhow::{bail, Error}; -use swc_atoms::atom; -use swc_common::{SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_utils::{contains_top_level_await, find_pat_ids, private_ident, ExprFactory}; -use swc_ecma_visit::{noop_fold_type, Fold}; - -use crate::{ - bundler::chunk::merge::Ctx, - modules::Modules, - util::{is_injected, ExportMetadata}, - Bundler, Load, ModuleId, Resolve, -}; - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - // Converts - /// - /// ```ts - /// export const arr = [1, 2, 3]; - /// ``` - /// - /// to - /// - /// ```ts - /// const _mod = (function(){ - /// const arr = [1, 2, 3]; - /// return { - /// arr, - /// }; - /// })(); - /// ``` - pub(super) fn wrap_esm( - &self, - ctx: &Ctx, - id: ModuleId, - module: Modules, - ) -> Result { - let span = DUMMY_SP; - let module_var_name = match self.scope.wrapped_esm_id(id) { - Some(v) => v, - None => bail!("{id:?} should not be wrapped with a function"), - }; - - let is_async = module.iter().any(|m| contains_top_level_await(m.1)); - - let mut additional_items = Vec::new(); - - module.iter().for_each(|(module_id, item)| { - match item { - // Handle `export *`-s from dependency modules. - // - // See: https://github.com/denoland/deno/issues/9200 - ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport { - ref specifiers, - with: Some(with), - .. - })) if is_injected(with) => { - for s in specifiers { - if let ExportSpecifier::Named(ExportNamedSpecifier { - orig, - exported: Some(exported), - .. - }) = s - { - let exported = match exported { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - if ctx.transitive_remap.get(&exported.ctxt).is_some() { - let specifier = ExportSpecifier::Named(ExportNamedSpecifier { - span: DUMMY_SP, - orig: orig.clone(), - exported: Some(ModuleExportName::Ident(exported.clone())), - is_type_only: false, - }); - additional_items.push(( - module_id, - NamedExport { - span: DUMMY_SP, - specifiers: vec![specifier], - src: None, - type_only: false, - with: Some( - ExportMetadata { - injected: true, - ..Default::default() - } - .into_with(), - ), - } - .into(), - )); - } - } - } - } - _ => {} - } - }); - - let mut export_visitor = ExportToReturn { - synthesized_ctxt: self.synthesized_ctxt, - return_props: Default::default(), - }; - let mut module = module.fold_with(&mut export_visitor); - - module.append_all(additional_items); - - let return_stmt = ReturnStmt { - span: DUMMY_SP, - arg: Some( - ObjectLit { - span: DUMMY_SP, - props: take(&mut export_visitor.return_props), - } - .into(), - ), - } - .into(); - - module.iter().for_each(|(_, v)| { - if let ModuleItem::ModuleDecl(ModuleDecl::ExportAll(ref export)) = v { - // We handle this later. - let mut map = ctx.export_stars_in_wrapped.lock(); - let data = ExportMetadata::decode(export.with.as_deref()); - if let Some(export_ctxt) = data.export_ctxt { - map.entry(id).or_default().push(export_ctxt); - } - } - }); - - let module_fn: Expr = FnExpr { - function: Box::new(Function { - params: Default::default(), - body: Some(BlockStmt { - span: DUMMY_SP, - stmts: vec![return_stmt], - ..Default::default() - }), - is_generator: false, - is_async, - ..Default::default() - }), - ident: None, - } - .into(); - - let mut module_expr = CallExpr { - span: DUMMY_SP, - callee: module_fn.as_callee(), - args: Default::default(), - ..Default::default() - } - .into(); - - if is_async { - module_expr = AwaitExpr { - span: DUMMY_SP, - arg: Box::new(module_expr), - } - .into(); - } - - let var_decl = VarDecl { - span, - ctxt: self.injected_ctxt, - declare: false, - kind: VarDeclKind::Const, - decls: vec![VarDeclarator { - span: DUMMY_SP, - definite: false, - name: Pat::Ident(module_var_name.into_ident().into()), - init: Some(Box::new(module_expr)), - }], - }; - - module.append(id, var_decl.into()); - - // print_hygiene( - // "wrap", - // &self.cm, - // &Module { - // span: DUMMY_SP, - // body: module_items.clone(), - // shebang: None, - // }, - // ); - - Ok(module) - } -} - -struct ExportToReturn { - return_props: Vec, - synthesized_ctxt: SyntaxContext, -} - -impl ExportToReturn { - fn export_id(&mut self, mut i: Ident) { - i.ctxt = SyntaxContext::empty(); - self.return_props - .push(PropOrSpread::Prop(Box::new(Prop::Shorthand(i)))); - } - - fn export_key_value(&mut self, key: Ident, value: Ident) { - self.return_props - .push(PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { - key: PropName::Ident(key.into()), - value: value.into(), - })))); - } -} - -impl Fold for ExportToReturn { - noop_fold_type!(); - - fn fold_stmt(&mut self, s: Stmt) -> Stmt { - s - } - - fn fold_module_item(&mut self, item: ModuleItem) -> ModuleItem { - let decl = match item { - ModuleItem::ModuleDecl(decl) => decl, - ModuleItem::Stmt(_) => return item, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - - let stmt = match decl { - ModuleDecl::Import(_) => return decl.into(), - ModuleDecl::ExportDecl(export) => { - match &export.decl { - Decl::Class(ClassDecl { ident, .. }) | Decl::Fn(FnDecl { ident, .. }) => { - self.export_id(ident.clone()); - } - Decl::Var(decl) => { - let ids: Vec = find_pat_ids(decl); - ids.into_iter().for_each(|id| self.export_id(id)); - } - _ => unreachable!(), - } - - Some(ModuleItem::from(export.decl)) - } - - ModuleDecl::ExportDefaultDecl(export) => match export.decl { - DefaultDecl::Class(expr) => { - let ident = expr.ident; - let ident = ident.unwrap_or_else(|| private_ident!("_default_decl")); - - self.export_key_value( - Ident::new_no_ctxt(atom!("default"), export.span), - ident.clone(), - ); - - Some( - ClassDecl { - ident, - class: expr.class, - declare: false, - } - .into(), - ) - } - DefaultDecl::Fn(expr) => { - let ident = expr.ident; - let ident = ident.unwrap_or_else(|| private_ident!("_default_decl")); - - self.export_key_value( - Ident::new_no_ctxt(atom!("default"), export.span), - ident.clone(), - ); - - Some( - FnDecl { - ident, - function: expr.function, - declare: false, - } - .into(), - ) - } - DefaultDecl::TsInterfaceDecl(_) => None, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }, - ModuleDecl::ExportDefaultExpr(_) => None, - ModuleDecl::ExportAll(export) => return export.into(), - ModuleDecl::ExportNamed(export) => { - for specifier in &export.specifiers { - match specifier { - ExportSpecifier::Namespace(_) => {} - ExportSpecifier::Default(_) => {} - ExportSpecifier::Named(named) => match &named.exported { - Some(ModuleExportName::Ident(exported)) => { - // As injected named exports are converted to variables by other - // passes, we should not create a variable for it. - if let ModuleExportName::Ident(orig) = &named.orig { - self.export_key_value(exported.clone(), orig.clone()); - } else { - unimplemented!("module string names unimplemented") - } - } - Some(ModuleExportName::Str(..)) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - Some(_) => panic!("unable to access unknown nodes"), - None => { - if let ModuleExportName::Ident(orig) = &named.orig { - self.export_id(orig.clone()); - } else { - unimplemented!("module string names unimplemented") - } - } - }, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - let md = ExportMetadata::decode(export.with.as_deref()); - // Ignore export {} specified by user. - if export.src.is_none() - && md.export_ctxt.unwrap_or_default() != self.synthesized_ctxt - { - None - } else { - return export.into(); - } - } - ModuleDecl::TsImportEquals(_) => None, - ModuleDecl::TsExportAssignment(_) => None, - ModuleDecl::TsNamespaceExport(_) => None, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - - if let Some(stmt) = stmt { - stmt - } else { - EmptyStmt { span: DUMMY_SP }.into() - } - } -} diff --git a/crates/swc_bundler/src/bundler/chunk/merge.rs b/crates/swc_bundler/src/bundler/chunk/merge.rs deleted file mode 100644 index cc5769b34bec..000000000000 --- a/crates/swc_bundler/src/bundler/chunk/merge.rs +++ /dev/null @@ -1,1440 +0,0 @@ -use std::sync::atomic::Ordering; - -use anyhow::Error; -use indexmap::IndexSet; -use petgraph::EdgeDirection; -use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; -use swc_atoms::atom; -use swc_common::{sync::Lock, FileName, SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_transforms_base::helpers::Helpers; -use swc_ecma_utils::{find_pat_ids, prepend_stmt, private_ident, quote_ident, ExprFactory}; -use swc_ecma_visit::{VisitMut, VisitMutWith}; -use EdgeDirection::Outgoing; - -use crate::{ - bundler::{keywords::KeywordRenamer, load::TransformedModule}, - dep_graph::ModuleGraph, - id::{Id, ModuleId}, - inline::inline, - load::Load, - modules::Modules, - resolve::Resolve, - util::{CloneMap, ExportMetadata, ExprExt, VarDeclaratorExt}, - Bundler, Hook, ModuleRecord, -}; - -pub(super) struct Ctx { - /// Full dependency graph. - pub graph: ModuleGraph, - pub cycles: Vec>, - pub transitive_remap: CloneMap, - pub export_stars_in_wrapped: Lock>>, -} - -impl Ctx { - pub fn is_exported_ctxt( - &self, - ctxt_to_check: SyntaxContext, - entry_export_ctxt: SyntaxContext, - ) -> bool { - if ctxt_to_check == entry_export_ctxt { - return true; - } - - if let Some(v) = self.transitive_remap.get(&ctxt_to_check) { - if v == ctxt_to_check { - return false; - } - - return self.is_exported_ctxt(v, entry_export_ctxt); - } - - false - } -} - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - pub(super) fn get_for_merging( - &self, - ctx: &Ctx, - id: ModuleId, - is_entry: bool, - ) -> Result { - self.run(|| { - let info = self - .scope - .get_module(id) - .unwrap_or_else(|| unreachable!("Module {} is not registered", id)); - let mut module = self.apply_hooks(id, is_entry)?; - module = self.prepare_for_merging(ctx, &info, module)?; - - if !is_entry { - module = self.wrap_cjs_module(ctx, &info, module)?; - } - self.replace_cjs_require_calls(&info, &mut module, is_entry); - - Ok(module) - }) - } - - /// This method sort modules. - pub(super) fn merge_into_entry( - &self, - ctx: &Ctx, - entry_id: ModuleId, - entry: &mut Modules, - all: &mut FxHashMap, - ) { - self.run(|| { - let injected_ctxt = self.injected_ctxt; - - let entry_info = self.scope.get_module(entry_id).unwrap(); - - let all_deps_of_entry = - self.collect_all_deps(&ctx.graph, entry_id, &mut Default::default()); - - tracing::debug!("Merging dependencies: {:?}", all_deps_of_entry); - - let deps = all_deps_of_entry.iter().map(|id| { - let dep_info = self.scope.get_module(*id).unwrap(); - entry_info.helpers.extend(&dep_info.helpers); - - { - let helpers = *entry_info.swc_helpers.lock(); - let dep_helpers = *dep_info.swc_helpers.lock(); - - let helpers = Helpers::from_data(helpers); - let dep_helpers = Helpers::from_data(dep_helpers); - - helpers.extend_from(&dep_helpers); - - *entry_info.swc_helpers.lock() = helpers.data(); - } - - if *id == entry_id { - return Modules::empty(injected_ctxt); - } - - all.remove(id).unwrap_or_else(|| { - unreachable!( - "failed to merge into {}: module {} does not exist in the map", - entry_id, id - ) - }) - }); - - for dep in deps { - entry.add_dep(dep); - } - - self.replace_import_specifiers(&entry_info, entry); - self.finalize_merging_of_entry(ctx, entry_id, entry); - self.remove_wrong_exports(ctx, &entry_info, entry); - }) - } - - #[allow(clippy::only_used_in_recursion)] - fn collect_all_deps( - &self, - graph: &ModuleGraph, - start: ModuleId, - dejavu: &mut FxHashSet, - ) -> IndexSet { - let mut set = IndexSet::default(); - - for dep in graph.neighbors_directed(start, Outgoing) { - if !dejavu.insert(dep) { - continue; - } - set.insert(dep); - set.extend(self.collect_all_deps(graph, dep, dejavu)); - } - - set - } - - pub(crate) fn apply_hooks( - &self, - module_id: ModuleId, - is_entry: bool, - ) -> Result { - self.run(|| { - let info = self.scope.get_module(module_id).unwrap(); - - let mut entry: Module = (*info.module).clone(); - entry.visit_mut_with(&mut ImportMetaHandler { - file: &info.fm.name, - hook: &self.hook, - is_entry, - inline_ident: private_ident!("importMeta"), - occurred: false, - err: None, - }); - - let module = Modules::from(module_id, entry, self.injected_ctxt); - - Ok(module) - }) - } - - /// This should only be called after everything is merged. - /// - /// This method does not care about orders of statement, and it's expected - /// to be called before `sort`. - fn inject_reexports(&self, ctx: &Ctx, _entry_id: ModuleId, entry: &mut Modules) { - // dbg!(&ctx.transitive_remap); - let injected_ctxt = self.injected_ctxt; - - { - // Handle `export *` for non-wrapped modules. - - let mut vars = Vec::new(); - /// We recurse if `export *` is nested. - fn add_var( - injected_ctxt: SyntaxContext, - vars: &mut Vec<(ModuleId, ModuleItem)>, - declared: &mut FxHashSet, - map: &CloneMap, - module_id: ModuleId, - id: Id, - ) { - let remapped = match map.get(&id.ctxt()) { - Some(v) => v, - _ => return, - }; - if remapped == id.ctxt() { - return; - } - let reexported = id.clone().with_ctxt(remapped); - - add_var( - injected_ctxt, - vars, - declared, - map, - module_id, - reexported.clone(), - ); - - if !declared.insert(reexported.clone()) { - return; - } - - vars.push(( - module_id, - id.assign_to(reexported) - .into_module_item(injected_ctxt, "export_star_replacer"), - )); - } - - // We have to exclude some ids because there are already declared. - // See https://github.com/denoland/deno/issues/8725 - // - // Let's say D is a dependency which contains export * from './foo'; - // If an user import and export from D, the transitive syntax context map - // contains a entry from D to foo because it's reexported and - // the variable (reexported from D) exist because it's imported. - let mut declared_ids = FxHashSet::<_>::default(); - - for (_, stmt) in entry.iter() { - if let ModuleItem::Stmt(Stmt::Decl(Decl::Var(decl))) = stmt { - if decl.ctxt == injected_ctxt { - let ids: Vec = find_pat_ids(decl); - declared_ids.extend(ids); - } - } - } - - for (module_id, stmt) in entry.iter() { - match stmt { - ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(export)) => { - for s in &export.specifiers { - match s { - ExportSpecifier::Namespace(_) => {} - ExportSpecifier::Default(_) => {} - ExportSpecifier::Named(named) => { - if let Some(exported) = &named.exported { - let exported = match exported { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - - let id: Id = exported.into(); - if declared_ids.contains(&id) { - continue; - } - - match &named.orig { - ModuleExportName::Ident(orig) => { - vars.push(( - module_id, - orig.clone() - .assign_to(exported.clone()) - .into_module_item( - injected_ctxt, - "finalize -> export to var", - ), - )); - } - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - } - - ModuleItem::Stmt(Stmt::Decl(Decl::Var(decl))) => { - let ids: Vec = find_pat_ids(decl); - - for id in ids { - if *id.sym() == "default" { - continue; - } - - add_var( - injected_ctxt, - &mut vars, - &mut declared_ids, - &ctx.transitive_remap, - module_id, - id, - ); - } - } - - _ => {} - } - } - - entry.append_all(vars); - } - - { - let mut map = ctx.export_stars_in_wrapped.lock(); - let mut additional_props = FxHashMap::<_, Vec<_>>::default(); - // Handle `export *` for wrapped modules. - for (module_id, ctxts) in map.drain() { - for (_, stmt) in entry.iter() { - if let ModuleItem::Stmt(Stmt::Decl(Decl::Var(decl))) = stmt { - let ids: Vec = find_pat_ids(decl); - - for id in ids { - if *id.sym() == "default" { - continue; - } - - if ctxts.contains(&id.ctxt()) { - additional_props.entry(module_id).or_default().push( - PropOrSpread::Prop(Box::new(Prop::Shorthand(id.into_ident()))), - ); - } - } - } - } - } - - for (module_id, props) in additional_props { - let id = match self.scope.wrapped_esm_id(module_id) { - Some(v) => v, - None => continue, - }; - - for (_, stmt) in entry.iter_mut() { - let var = match stmt { - ModuleItem::Stmt(Stmt::Decl(Decl::Var(var))) - if matches!( - &**var, - VarDecl { - kind: VarDeclKind::Const, - .. - } - ) => - { - var - } - _ => continue, - }; - - if var.decls.len() != 1 { - continue; - } - - let var_decl = &mut var.decls[0]; - match &var_decl.name { - Pat::Ident(i) if id == i.id => {} - _ => continue, - } - - let callee = match &mut var_decl.init { - Some(init) => match &mut **init { - Expr::Call(CallExpr { callee, .. }) => match callee { - Callee::Super(_) | Callee::Import(_) => continue, - Callee::Expr(v) => v, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }, - Expr::Await(AwaitExpr { arg, .. }) => match &mut **arg { - Expr::Call(CallExpr { callee, .. }) => match callee { - Callee::Super(_) | Callee::Import(_) => continue, - Callee::Expr(v) => v, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }, - _ => continue, - }, - _ => continue, - }, - None => continue, - }; - - let f = match &mut **callee { - Expr::Fn(f) => f, - _ => continue, - }; - - let body = match &mut f.function.body { - Some(body) => body, - None => continue, - }; - - let last_stmt = body.stmts.last_mut(); - - let return_stmt = match last_stmt { - Some(Stmt::Return(s)) => s, - _ => continue, - }; - - let ret_val = match &mut return_stmt.arg { - Some(arg) => arg, - None => continue, - }; - - let obj = match &mut **ret_val { - Expr::Object(obj) => obj, - _ => continue, - }; - - obj.props.extend(props); - break; - } - } - } - } - - fn finalize_merging_of_entry(&self, ctx: &Ctx, id: ModuleId, entry: &mut Modules) { - tracing::trace!("All modules are merged"); - - tracing::debug!("Injecting reexports"); - self.inject_reexports(ctx, id, entry); - - // entry.print(&self.cm, "before inline"); - - tracing::debug!("Inlining injected variables"); - - inline(self.injected_ctxt, entry); - - entry.sort(id, &ctx.graph, &ctx.cycles, &self.cm); - - // crate::debug::print_hygiene("done", &self.cm, &entry.clone().into()); - - entry.retain_mut(|_, item| { - match item { - ModuleItem::ModuleDecl(ModuleDecl::ExportAll(export)) => { - let src_atom = export.src.value.to_atom_lossy().into_owned(); - if self.config.external_modules.contains(&src_atom) { - return true; - } - - return false; - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(export)) => { - if let Some(src) = &export.src { - let src_atom = src.value.to_atom_lossy().into_owned(); - if self.config.external_modules.contains(&src_atom) { - return true; - } - } - - export - .specifiers - .retain(|s| !matches!(s, ExportSpecifier::Namespace(_))); - - export.src = None; - } - - ModuleItem::ModuleDecl(ModuleDecl::Import(import)) => { - let src_atom = import.src.value.to_atom_lossy().into_owned(); - if self.config.external_modules.contains(&src_atom) { - return true; - } - - // Drop import statements. - return false; - } - - _ => {} - } - - true - }); - - tracing::debug!("Renaming keywords"); - - entry.visit_mut_with(&mut KeywordRenamer::default()); - - // print_hygiene( - // "done-clean", - // &self.cm, - // &entry - // .clone() - // .fold_with(&mut hygiene()) - // .fold_with(&mut fixer(None)), - // ); - } - - /// Remove exports with wrong syntax context - fn remove_wrong_exports(&self, ctx: &Ctx, info: &TransformedModule, module: &mut Modules) { - tracing::debug!("Removing wrong exports"); - - let item_count = module.iter().count(); - tracing::trace!("Item count = {}", item_count); - - module.retain_mut(|_, item| { - if let ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport { - specifiers, .. - })) = item - { - specifiers.retain(|s| match s { - ExportSpecifier::Named(ExportNamedSpecifier { - exported: Some(exported), - .. - }) => { - let exported = match exported { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - // Default is not exported via `export *` - if &*exported.sym == "default" { - exported.ctxt == info.export_ctxt() - } else { - ctx.is_exported_ctxt(exported.ctxt, info.export_ctxt()) - } - } - _ => true, - }); - - if specifiers.is_empty() { - return false; - } - } - - true - }); - - tracing::debug!("Removed wrong exports"); - } - - /// This method handles imports and exports. - /// - /// - /// Basically one module have two top-level contexts. One is for it's codes - /// and another is for exporting. This method connects two module by - /// injecting `const local_A = exported_B_from_foo;` - /// - /// - /// We convert all exports to variable at here. - pub(super) fn prepare_for_merging( - &self, - ctx: &Ctx, - info: &TransformedModule, - mut module: Modules, - ) -> Result { - self.handle_imports_and_exports(ctx, info, &mut module); - - let wrapped = self.scope.should_be_wrapped_with_a_fn(info.id); - if wrapped { - module = self.wrap_esm(ctx, info.id, module)?; - } - - Ok(module) - } - - fn handle_imports_and_exports( - &self, - ctx: &Ctx, - info: &TransformedModule, - module: &mut Modules, - ) { - let injected_ctxt = self.injected_ctxt; - - if !info.is_es6 { - return; - } - - let mut extra = Vec::new(); - - module.map_any_items(|_, items| { - let mut new = Vec::with_capacity(items.len() * 11 / 10); - - for item in items { - match item { - ModuleItem::ModuleDecl(ModuleDecl::Import(mut import)) => { - let src_atom = import.src.value.to_atom_lossy().into_owned(); - // Preserve imports from node.js builtin modules. - if self.config.external_modules.contains(&src_atom) { - new.push(import.into()); - continue; - } - - if let Some((src, _)) = info - .imports - .specifiers - .iter() - .find(|s| s.0.src.value == import.src.value) - { - if !self.scope.get_module(src.module_id).unwrap().is_es6 { - new.push(import.into()); - continue; - } - } - - // Imports are easy to handle. - for s in &import.specifiers { - match s { - ImportSpecifier::Named(s) => { - if let Some(imported) = &s.imported { - let imported = match imported { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - new.push( - imported - .clone() - .assign_to(s.local.clone()) - .into_module_item( - injected_ctxt, - "prepare -> named import -> aliased", - ), - ); - } - } - ImportSpecifier::Default(s) => { - new.push( - Ident::new( - atom!("default"), - import.span, - ExportMetadata::decode(import.with.as_deref()) - .export_ctxt - .unwrap(), - ) - .assign_to(s.local.clone()) - .into_module_item( - injected_ctxt, - "prepare -> default import", - ), - ); - } - ImportSpecifier::Namespace(s) => { - if let Some((src, _)) = info - .imports - .specifiers - .iter() - .find(|s| s.0.src.value == import.src.value) - { - let esm_id = - self.scope.wrapped_esm_id(src.module_id).expect( - "If a namespace import specifier is preserved, it \ - means failure of deblobbing and as a result \ - module should be marked as wrapped esm", - ); - new.push( - esm_id - .clone() - .assign_to(s.local.clone()) - .into_module_item( - injected_ctxt, - "prepare -> import -> namespace", - ), - ); - } - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - import.specifiers.clear(); - new.push(import.into()); - } - ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(export)) => { - // At here, we create multiple items. - // - // One item is `const local_default = expr` and another one is - // `export { local_default as default }`. - // - // To allow using identifier of the declaration in the original module, we - // create `const local_default = orig_ident` if original identifier exists. - - let local = Ident::new(atom!("default"), DUMMY_SP, info.local_ctxt()); - - match export.decl { - DefaultDecl::Class(c) => { - // - match c.ident { - Some(ident) => { - new.push( - ClassDecl { - ident: ident.clone(), - class: c.class, - declare: false, - } - .into(), - ); - - new.push(ident.assign_to(local.clone()).into_module_item( - injected_ctxt, - "prepare -> export default decl -> class -> with ident", - )) - } - None => { - let init = c; - new.push(init.assign_to(local.clone()).into_module_item( - injected_ctxt, - "prepare -> export default decl -> class -> without \ - ident", - )); - } - } - } - DefaultDecl::Fn(f) => { - // - match f.ident { - Some(ident) => { - new.push( - FnDecl { - ident: ident.clone(), - function: f.function, - declare: false, - } - .into(), - ); - - new.push(ident.assign_to(local.clone()).into_module_item( - injected_ctxt, - "prepare -> export default decl -> function -> with \ - ident", - )) - } - None => { - // We should inject a function declaration because of - // dependencies. - // - // See: https://github.com/denoland/deno/issues/9346 - let ident = private_ident!("default"); - new.push( - FnDecl { - ident: ident.clone(), - function: f.function, - declare: false, - } - .into(), - ); - - new.push(ident.assign_to(local.clone()).into_module_item( - injected_ctxt, - "prepare -> export default decl -> function -> \ - without ident", - )); - } - } - } - DefaultDecl::TsInterfaceDecl(_) => continue, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - - // Create `export { local_default as default }` - tracing::trace!( - "Exporting `default` with `export default decl` ({})", - local.sym - ); - - let exported = Ident::new(atom!("default"), DUMMY_SP, info.export_ctxt()); - - new.push( - local - .clone() - .assign_to(exported.clone()) - .into_module_item(injected_ctxt, "prepare -> export default decl"), - ); - - let specifier = ExportSpecifier::Named(ExportNamedSpecifier { - span: DUMMY_SP, - orig: ModuleExportName::Ident(local), - exported: Some(ModuleExportName::Ident(exported)), - is_type_only: false, - }); - extra.push( - NamedExport { - span: export.span, - specifiers: vec![specifier], - src: None, - type_only: false, - with: Some( - ExportMetadata { - injected: true, - ..Default::default() - } - .into_with(), - ), - } - .into(), - ); - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultExpr(export)) => { - // At here, we create two items. - // - // One item is `const local_default = expr` and the - // other is `export { local_default as default }`. - - // TODO: Check if we really need this. - - let local = Ident::new(atom!("default"), DUMMY_SP, info.local_ctxt()); - - // Create `const local_default = expr` - new.push( - export - .expr - .assign_to(local.clone()) - .into_module_item(injected_ctxt, "prepare -> export default expr"), - ); - - let exported = Ident::new(atom!("default"), DUMMY_SP, info.export_ctxt()); - - new.push( - local - .clone() - .assign_to(exported.clone()) - .into_module_item(injected_ctxt, "prepare -> export default expr"), - ); - - // Create `export { local_default as default }` - let specifier = ExportSpecifier::Named(ExportNamedSpecifier { - span: DUMMY_SP, - orig: ModuleExportName::Ident(local), - exported: Some(ModuleExportName::Ident(exported)), - is_type_only: false, - }); - tracing::trace!("Exporting `default` with `export default expr`"); - extra.push( - NamedExport { - span: export.span, - specifiers: vec![specifier], - src: None, - type_only: false, - with: Some( - ExportMetadata { - injected: true, - ..Default::default() - } - .into_with(), - ), - } - .into(), - ); - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(export)) => { - // Idea is almost same as above. But we uses symbol of the declaration - // instead of using `default`. - - let local = match export.decl { - Decl::Class(c) => { - let i = c.ident.clone(); - new.push(c.into()); - - i - } - Decl::Fn(f) => { - let i = f.ident.clone(); - new.push(f.into()); - - i - } - Decl::Var(v) => { - let ids: Vec = find_pat_ids(&v); - // - - new.push(v.into()); - - let export = NamedExport { - span: export.span, - specifiers: ids - .into_iter() - .map(|id| { - let exported = Ident::new( - id.sym.clone(), - id.span, - info.export_ctxt(), - ); - - tracing::trace!( - "Exporting `{}{:?}` with `export decl`", - id.sym, - id.ctxt - ); - - new.push( - id.clone() - .assign_to(exported.clone()) - .into_module_item( - injected_ctxt, - "prepare -> export decl -> var", - ), - ); - - ExportNamedSpecifier { - span: DUMMY_SP, - orig: ModuleExportName::Ident(id), - exported: Some(ModuleExportName::Ident(exported)), - is_type_only: false, - } - }) - .map(ExportSpecifier::Named) - .collect(), - src: None, - type_only: false, - with: Some( - ExportMetadata { - injected: true, - ..Default::default() - } - .into_with(), - ), - } - .into(); - extra.push(export); - continue; - } - - Decl::TsInterface(_) - | Decl::TsTypeAlias(_) - | Decl::TsEnum(_) - | Decl::TsModule(_) - | Decl::Using(..) => continue, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - - tracing::trace!( - "Exporting `default` with `export default decl` ({})", - local.sym - ); - - // Create `export { local_ident as exported_ident }` - let exported = - Ident::new(local.sym.clone(), local.span, info.export_ctxt()); - - new.push( - local - .clone() - .assign_to(exported.clone()) - .into_module_item(injected_ctxt, "prepare -> export decl -> var"), - ); - - let specifier = ExportSpecifier::Named(ExportNamedSpecifier { - span: DUMMY_SP, - orig: ModuleExportName::Ident(local), - exported: Some(ModuleExportName::Ident(exported)), - is_type_only: false, - }); - - extra.push( - NamedExport { - span: export.span, - specifiers: vec![specifier], - src: None, - type_only: false, - with: Some( - ExportMetadata { - injected: true, - ..Default::default() - } - .into_with(), - ), - } - .into(), - ); - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport { - ref specifiers, - ref src, - .. - })) => { - if let Some(export_src) = src { - if let Some((src, _)) = info - .exports - .reexports - .iter() - .find(|s| s.0.src.value == export_src.value) - { - let dep = self.scope.get_module(src.module_id).unwrap(); - if !dep.is_es6 { - dep.helpers.require.store(true, Ordering::SeqCst); - - let mut vars = Vec::new(); - let mod_var = private_ident!("_cjs_module_"); - - vars.push(VarDeclarator { - span: DUMMY_SP, - name: mod_var.clone().into(), - init: Some( - CallExpr { - span: DUMMY_SP, - callee: Ident::new( - atom!("load"), - DUMMY_SP, - dep.export_ctxt(), - ) - .as_callee(), - ..Default::default() - } - .into(), - ), - definite: Default::default(), - }); - for s in specifiers { - match s { - ExportSpecifier::Namespace(s) => { - match &s.name { - ModuleExportName::Ident(name) => { - vars.push(VarDeclarator { - span: s.span, - name: name.clone().into(), - init: Some(mod_var.clone().into()), - definite: Default::default(), - }); - } - ModuleExportName::Str(..) => { - unimplemented!( - "module string names unimplemented" - ) - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - } - ExportSpecifier::Default(s) => { - vars.push(VarDeclarator { - span: DUMMY_SP, - name: s.exported.clone().into(), - init: Some( - mod_var - .clone() - .make_member(quote_ident!("default")) - .into(), - ), - definite: Default::default(), - }); - } - ExportSpecifier::Named(s) => { - let exp = s.exported.clone(); - let exported = match exp { - Some(ModuleExportName::Ident(ident)) => { - Some(ident) - } - Some(ModuleExportName::Str(..)) => { - unimplemented!( - "module string names unimplemented" - ) - } - _ => None, - }; - let orig = match &s.orig { - ModuleExportName::Ident(ident) => ident, - _ => unimplemented!( - "module string names unimplemented" - ), - }; - vars.push(VarDeclarator { - span: s.span, - name: exported.clone().unwrap().into(), - init: Some( - mod_var - .clone() - .make_member(orig.clone().into()) - .into(), - ), - definite: Default::default(), - }); - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - if !vars.is_empty() { - new.push( - VarDecl { - span: DUMMY_SP, - kind: VarDeclKind::Const, - declare: Default::default(), - decls: vars, - ..Default::default() - } - .into(), - ); - } - continue; - } - } - } - - for s in specifiers { - match s { - ExportSpecifier::Named(ExportNamedSpecifier { - orig, - exported: Some(exported), - .. - }) => { - let exported_ident = match exported { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - let orig_ident = match orig { - ModuleExportName::Ident(ident) => ident, - _ => unimplemented!("module string names unimplemented"), - }; - new.push( - orig_ident - .clone() - .assign_to(exported_ident.clone()) - .into_module_item( - injected_ctxt, - "prepare -> export named -> aliased", - ), - ); - } - - ExportSpecifier::Default(ExportDefaultSpecifier { - exported, - .. - }) => { - new.push( - Ident::new(atom!("default"), DUMMY_SP, info.local_ctxt()) - .clone() - .assign_to(exported.clone()) - .into_module_item( - injected_ctxt, - "prepare -> export named -> aliased", - ), - ); - } - - ExportSpecifier::Namespace(ns) => { - if let Some((src, _)) = info - .exports - .reexports - .iter() - .find(|s| s.0.src.value == src.as_ref().unwrap().value) - { - match &ns.name { - ModuleExportName::Ident(name) => { - if !self - .scope - .get_module(src.module_id) - .unwrap() - .is_es6 - { - continue; - } - - let wrapped_esm_id = - self.scope.wrapped_esm_id(src.module_id); - match wrapped_esm_id { - Some(module_var) => { - // Create variable for the namespaced - // export. - extra.push( - module_var - .clone() - .assign_to(name.clone()) - .into_module_item( - injected_ctxt, - "prepare -> namespaced \ - reexport", - ), - ); - let specifier = ExportSpecifier::Named( - ExportNamedSpecifier { - span: ns.span, - orig: ModuleExportName::Ident( - module_var.into(), - ), - exported: Some(ns.name.clone()), - is_type_only: false, - }, - ); - extra.push( - NamedExport { - span: ns.span, - specifiers: vec![specifier], - src: None, - with: None, - type_only: false, - } - .into(), - ); - } - None => { - unreachable!( - "Modules reexported with `export * as \ - foo from './foo'` should be marked \ - as a wrapped esm" - ) - } - } - - // Remove `export * as foo from ''` - continue; - } - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - } - _ => {} - } - } - - new.push(item); - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportAll(ref export)) => { - let metadata = ExportMetadata::decode(export.with.as_deref()); - - if let Some(export_ctxt) = metadata.export_ctxt { - let reexport = self.scope.get_module(info.id).unwrap().export_ctxt(); - ctx.transitive_remap.insert(export_ctxt, reexport); - } - - new.push(item); - } - - _ => { - new.push(item); - } - } - } - - new - }); - - for item in extra { - module.append(info.id, item); - } - - // module.print(&self.cm, "prepare"); - } - - pub(super) fn replace_import_specifiers(&self, info: &TransformedModule, module: &mut Modules) { - let injected_ctxt = self.injected_ctxt; - - let mut vars = Vec::new(); - module.map_any_items(|module_id, stmts| { - let mut new = Vec::with_capacity(stmts.len() + 32); - - for stmt in stmts { - if let ModuleItem::ModuleDecl(ModuleDecl::Import(import)) = &stmt { - let src_atom = import.src.value.to_atom_lossy().into_owned(); - if self.config.external_modules.contains(&src_atom) { - new.push(stmt); - continue; - } - - for specifier in &import.specifiers { - match specifier { - ImportSpecifier::Named(named) => { - if let Some(imported) = &named.imported { - let imporeted_ident = match imported { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - vars.push(( - module_id, - imporeted_ident - .clone() - .assign_to(named.local.clone()) - .into_module_item( - injected_ctxt, - "from_replace_import_specifiers", - ), - )); - continue; - } - } - ImportSpecifier::Default(default) => { - if let Some((src, _)) = info - .imports - .specifiers - .iter() - .find(|s| s.0.src.value == import.src.value) - { - let imported = - Ident::new(atom!("default"), DUMMY_SP, src.export_ctxt); - vars.push(( - module_id, - imported.assign_to(default.local.clone()).into_module_item( - injected_ctxt, - "from_replace_import_specifiers", - ), - )); - continue; - } - } - ImportSpecifier::Namespace(s) => { - if let Some((src, _)) = info - .imports - .specifiers - .iter() - .find(|s| s.0.src.value == import.src.value) - { - let esm_id = self.scope.wrapped_esm_id(src.module_id).expect( - "If a namespace import specifier is preserved, it means \ - failure of deblobbing and as a result module should be \ - marked as wrapped esm", - ); - vars.push(( - module_id, - esm_id.clone().assign_to(s.local.clone()).into_module_item( - injected_ctxt, - "from_replace_import_specifiers: namespaced", - ), - )); - continue; - } - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - // We should remove imports - continue; - } - - new.push(stmt); - } - - new - }); - - module.append_all(vars) - } -} - -struct ImportMetaHandler<'a, 'b> { - file: &'a FileName, - #[allow(clippy::borrowed_box)] - hook: &'a Box, - is_entry: bool, - inline_ident: Ident, - occurred: bool, - /// TODO: Use this - #[allow(dead_code)] - err: Option, -} - -impl VisitMut for ImportMetaHandler<'_, '_> { - fn visit_mut_expr(&mut self, e: &mut Expr) { - e.visit_mut_children_with(self); - - if let Expr::MetaProp(MetaPropExpr { - kind: MetaPropKind::ImportMeta, - .. - }) = e - { - *e = self.inline_ident.clone().into(); - self.occurred = true; - } - } - - fn visit_mut_module(&mut self, n: &mut Module) { - n.visit_mut_children_with(self); - - if self.occurred { - match self.hook.get_import_meta_props( - n.span, - &ModuleRecord { - file_name: self.file.to_owned(), - is_entry: self.is_entry, - }, - ) { - Ok(key_value_props) => { - prepend_stmt( - &mut n.body, - VarDecl { - span: n.span, - kind: VarDeclKind::Const, - declare: false, - decls: vec![VarDeclarator { - span: n.span, - name: Pat::Ident(self.inline_ident.clone().into()), - init: Some(Box::new(Expr::Object(ObjectLit { - span: n.span, - props: key_value_props - .iter() - .cloned() - .map(|kv| PropOrSpread::Prop(Box::new(Prop::KeyValue(kv)))) - .collect(), - }))), - definite: false, - }], - ..Default::default() - } - .into(), - ); - } - Err(err) => self.err = Some(err), - } - } - } -} diff --git a/crates/swc_bundler/src/bundler/chunk/mod.rs b/crates/swc_bundler/src/bundler/chunk/mod.rs deleted file mode 100644 index f7764548706d..000000000000 --- a/crates/swc_bundler/src/bundler/chunk/mod.rs +++ /dev/null @@ -1,183 +0,0 @@ -use std::time::Instant; - -use anyhow::{Context, Error}; -#[cfg(feature = "rayon")] -use rayon::iter::ParallelIterator; -use rustc_hash::FxHashMap; - -use super::{load::TransformedModule, Bundler}; -use crate::{ - bundler::chunk::merge::Ctx, load::Load, resolve::Resolve, util::IntoParallelIterator, Bundle, -}; - -mod cjs; -mod computed_key; -mod merge; -mod plan; - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - /// `entries` - Entry modules (provided by user) by it's basename. - /// - /// # How it works - /// - /// For first, we load all dependencies and determine all entries. - pub(super) fn chunk( - &self, - entries: FxHashMap, - ) -> Result, Error> { - #[cfg(not(target_arch = "wasm32"))] - let start = Instant::now(); - let (plan, graph, cycles) = self.determine_entries(entries).context("failed to plan")?; - #[cfg(not(target_arch = "wasm32"))] - let dur = Instant::now() - start; - #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Dependency analysis took {:?}", dur); - - if cfg!(debug_assertions) { - for (i, id1) in plan.all.iter().enumerate() { - for (j, id2) in plan.all.iter().enumerate() { - if i == j { - continue; - } - - debug_assert_ne!( - id1, id2, - "Dependency analysis created duplicate entries: {id1:?}" - ) - } - } - } - - let ctx = Ctx { - graph, - cycles, - transitive_remap: Default::default(), - export_stars_in_wrapped: Default::default(), - }; - - #[cfg(not(target_arch = "wasm32"))] - let start = Instant::now(); - let mut all = (&*plan.all) - .into_par_iter() - .map(|id| -> Result<_, Error> { - self.run(|| { - // TODO: is_entry should be false if it's dep of other entry. - let is_entry = plan.entries.contains_key(id); - let module = self.get_for_merging(&ctx, *id, is_entry)?; - - Ok((*id, module)) - }) - }) - .collect::, _>>()?; - - #[cfg(not(target_arch = "wasm32"))] - let dur = Instant::now() - start; - #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Module preparation took {:?}", dur); - - let entries = all - .iter() - .filter_map(|(id, module)| { - if plan.entries.contains_key(id) { - return Some((*id, module.clone())); - } - None - }) - .collect::>(); - - let merged: Vec<_> = if entries.len() == 1 { - entries - .into_iter() - .map(|(id, mut entry)| { - self.merge_into_entry(&ctx, id, &mut entry, &mut all); - - tracing::debug!("Merged `{}` and it's dep into an entry", id); - - (id, entry) - }) - .map(|(id, module)| { - let kind = plan - .entries - .get(&id) - .unwrap_or_else(|| { - unreachable!("Plan does not contain bundle kind for {:?}", id) - }) - .clone(); - Bundle { - kind, - id, - module: module.into(), - } - }) - .collect() - } else { - entries - .into_iter() - .map(|(id, mut entry)| { - let mut a = all.clone(); - self.merge_into_entry(&ctx, id, &mut entry, &mut a); - - tracing::debug!("Merged `{}` and it's dep into an entry", id); - - (id, entry) - }) - .map(|(id, module)| { - let kind = plan - .entries - .get(&id) - .unwrap_or_else(|| { - unreachable!("Plan does not contain bundle kind for {:?}", id) - }) - .clone(); - Bundle { - kind, - id, - module: module.into(), - } - }) - .collect() - }; - - Ok(merged) - } -} - -#[cfg(test)] -mod tests { - use swc_common::FileName; - - use super::*; - use crate::bundler::tests::suite; - - #[test] - fn cjs_chunk() { - suite() - .file( - "main.js", - " - require('./a'); - require('./b'); - ", - ) - .file("a.js", "require('./common')") - .file("b.js", "require('./common')") - .file("common.js", r#"console.log('foo')"#) - .run(|t| { - let module = t - .bundler - .load_transformed(&FileName::Real("main.js".into()))? - .unwrap(); - let mut entries = FxHashMap::default(); - entries.insert("main.js".to_string(), module); - - let chunked = t.bundler.chunk(entries)?; - assert_eq!(chunked.len(), 1); - - Ok(()) - }); - } -} diff --git a/crates/swc_bundler/src/bundler/chunk/plan/mod.rs b/crates/swc_bundler/src/bundler/chunk/plan/mod.rs deleted file mode 100644 index d5150586afd3..000000000000 --- a/crates/swc_bundler/src/bundler/chunk/plan/mod.rs +++ /dev/null @@ -1,74 +0,0 @@ -use anyhow::{bail, Error}; -use rustc_hash::FxHashMap; -use swc_graph_analyzer::{DepGraph, GraphAnalyzer}; - -use crate::{ - bundler::{load::TransformedModule, scope::Scope}, - dep_graph::ModuleGraph, - BundleKind, Bundler, Load, ModuleId, Resolve, -}; - -#[cfg(test)] -mod tests; - -#[derive(Debug, Default)] -struct PlanBuilder { - kinds: FxHashMap, -} - -#[derive(Debug, Default)] -pub(super) struct Plan { - pub entries: FxHashMap, - - /// Id of all modules. - pub all: Vec, -} - -impl DepGraph for Scope { - type ModuleId = ModuleId; - - fn deps_of(&self, module_id: Self::ModuleId) -> Vec { - let m = self.get_module(module_id).expect("failed to get module"); - - m.imports - .specifiers - .iter() - .chain(m.exports.reexports.iter()) - .map(|v| v.0.module_id) - .collect() - } -} - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - pub(super) fn determine_entries( - &self, - entries: FxHashMap, - ) -> Result<(Plan, ModuleGraph, Vec>), Error> { - let mut builder = PlanBuilder::default(); - let mut analyzer = GraphAnalyzer::new(&self.scope); - - for (name, module) in entries { - if let Some(v) = builder.kinds.insert(module.id, BundleKind::Named { name }) { - bail!("Multiple entries with same input path detected: {v:?}") - } - - analyzer.load(module.id); - } - let res = analyzer.into_result(); - - // dbg!(&builder.cycles); - - Ok(( - Plan { - entries: builder.kinds, - all: res.all, - }, - res.graph, - res.cycles, - )) - } -} diff --git a/crates/swc_bundler/src/bundler/chunk/plan/tests.rs b/crates/swc_bundler/src/bundler/chunk/plan/tests.rs deleted file mode 100644 index 8a522bfcfd23..000000000000 --- a/crates/swc_bundler/src/bundler/chunk/plan/tests.rs +++ /dev/null @@ -1,54 +0,0 @@ -use std::collections::HashMap; - -use rustc_hash::{FxHashMap, FxHashSet}; - -use crate::bundler::tests::suite; - -fn assert_cycles(map: FxHashMap, cycle_entries: Vec<&str>) { - let mut tester = suite(); - - for (k, v) in map { - tester = tester.file(&k, &v); - } - - tester.run(|tester| { - let mut entries = FxHashMap::default(); - entries.insert("main.js".to_string(), tester.module("main.js")); - let (_plan, _graph, cycles) = tester.bundler.determine_entries(entries).unwrap(); - - dbg!(&cycles); - - let actual: FxHashSet<_> = cycles.into_iter().flatten().collect(); - - let expected: FxHashSet<_> = cycle_entries - .iter() - .map(|name| tester.module(name).id) - .collect(); - - assert_eq!(expected, actual); - - Ok(()) - }); -} - -#[test] -fn deno_10820_1() { - let mut map = HashMap::default(); - map.insert("main.js".to_string(), "import './router.js'".to_string()); - map.insert("data.js".to_string(), "import './main.js'".to_string()); - map.insert("page1.js".to_string(), "import './data.js'".to_string()); - map.insert("page2.js".to_string(), "import './data.js'".to_string()); - map.insert( - "router.js".to_string(), - " - import './page1.js' - import './page2.js' - " - .to_string(), - ); - - assert_cycles( - map, - vec!["main.js", "data.js", "page1.js", "page2.js", "router.js"], - ); -} diff --git a/crates/swc_bundler/src/bundler/export.rs b/crates/swc_bundler/src/bundler/export.rs deleted file mode 100644 index 3f0bf55928ed..000000000000 --- a/crates/swc_bundler/src/bundler/export.rs +++ /dev/null @@ -1,317 +0,0 @@ -use indexmap::IndexMap; -use rustc_hash::FxBuildHasher; -use swc_atoms::{atom, Atom}; -use swc_common::{FileName, SyntaxContext}; -use swc_ecma_ast::*; -use swc_ecma_utils::find_pat_ids; -use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; - -use super::{ - load::{Source, Specifier}, - Bundler, -}; -use crate::{id::Id, load::Load, resolve::Resolve, util::ExportMetadata}; - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - /// TODO: Support pattern like - /// export const [a, b] = [1, 2] - pub(super) fn extract_export_info( - &self, - file_name: &FileName, - module: &mut Module, - export_ctxt: SyntaxContext, - ) -> RawExports { - self.run(|| { - let mut v = ExportFinder { - info: Default::default(), - file_name, - bundler: self, - export_ctxt, - }; - - module.visit_mut_with(&mut v); - - v.info - }) - } -} - -#[derive(Debug, Default)] -pub(super) struct RawExports { - /// Key is None if it's exported from the module itself. - pub items: IndexMap, Vec, FxBuildHasher>, -} - -#[derive(Debug, Default)] -pub(crate) struct Exports { - pub items: Vec, - pub reexports: Vec<(Source, Vec)>, -} - -struct ExportFinder<'a, 'b, L, R> -where - L: Load, - R: Resolve, -{ - info: RawExports, - file_name: &'a FileName, - bundler: &'a Bundler<'b, L, R>, - export_ctxt: SyntaxContext, -} - -impl ExportFinder<'_, '_, L, R> -where - L: Load, - R: Resolve, -{ - /// Returns `(local, export)`. - fn ctxt_for(&self, src: &Atom) -> Option<(SyntaxContext, SyntaxContext)> { - // Don't apply mark if it's a core module. - if self - .bundler - .config - .external_modules - .iter() - .any(|v| v == src) - { - return None; - } - let path = self.bundler.resolve(self.file_name, src).ok()?; - let (_, local_mark, export_mark) = self.bundler.scope.module_id_gen.gen(&path); - - Some(( - SyntaxContext::empty().apply_mark(local_mark), - SyntaxContext::empty().apply_mark(export_mark), - )) - } - - fn mark_as_wrapping_required(&self, src: &Atom) { - // Don't apply mark if it's a core module. - if self - .bundler - .config - .external_modules - .iter() - .any(|v| v == src) - { - return; - } - let path = self.bundler.resolve(self.file_name, src); - let path = match path { - Ok(v) => v, - _ => return, - }; - let (id, _, _) = self.bundler.scope.module_id_gen.gen(&path); - - self.bundler.scope.mark_as_wrapping_required(id); - } -} - -impl VisitMut for ExportFinder<'_, '_, L, R> -where - L: Load, - R: Resolve, -{ - noop_visit_mut_type!(fail); - - fn visit_mut_module_item(&mut self, item: &mut ModuleItem) { - match item { - // TODO: Optimize pure constants - // ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { - // decl: Decl::Var(v), - // .. - // })) if v.kind == VarDeclKind::Const - // && v.decls.iter().all(|v| { - // (match v.name { - // Pat::Ident(..) => true, - // _ => false, - // }) && (match v.init { - // Some(box Expr::Lit(..)) => true, - // _ => false, - // }) - // }) => - // { - // self.info - // .pure_constants - // .extend(v.decls.into_iter().map(|decl| { - // let id = match decl.name { - // Pat::Ident(i) => i.into(), - // _ => unreachable!(), - // }; - // let lit = match decl.init { - // Some(box Expr::Lit(l)) => l, - // _ => unreachable!(), - // }; - // (id, lit) - // })); - // return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); - // } - ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(decl)) => { - let v = self.info.items.entry(None).or_default(); - v.push({ - let i = match decl.decl { - Decl::Class(ref c) => &c.ident, - Decl::Fn(ref f) => &f.ident, - Decl::Var(ref var) => { - let ids: Vec = find_pat_ids(&var.decls); - for id in ids { - v.push(Specifier::Specific { - local: id, - alias: None, - }); - } - return; - } - Decl::TsEnum(ref e) => &e.id, - Decl::TsInterface(ref i) => &i.id, - Decl::TsTypeAlias(ref a) => &a.id, - _ => unreachable!("Decl in ExportDecl: {:?}", decl.decl), - }; - Specifier::Specific { - local: i.into(), - alias: None, - } - }); - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultDecl(_decl)) => { - self.info - .items - .entry(None) - .or_default() - .push(Specifier::Specific { - local: Id::new(atom!("default"), SyntaxContext::empty()), - alias: None, - }); - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportDefaultExpr(_expr)) => { - self.info - .items - .entry(None) - .or_default() - .push(Specifier::Specific { - local: Id::new(atom!("default"), SyntaxContext::empty()), - alias: None, - }); - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(named)) => { - let ctxt = named.src.as_ref().and_then(|s| { - let src_atom = s.value.to_atom_lossy(); - self.ctxt_for(src_atom.as_ref()) - }); - let mut need_wrapping = false; - - let v = self - .info - .items - .entry(named.src.clone().map(|v| *v)) - .or_default(); - for s in &mut named.specifiers { - match s { - ExportSpecifier::Namespace(n) => { - match &mut n.name { - ModuleExportName::Ident(name) => { - name.ctxt = self.export_ctxt; - - need_wrapping = true; - v.push(Specifier::Namespace { - local: name.clone().into(), - all: true, - }) - } - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - } - ExportSpecifier::Default(d) => { - v.push(Specifier::Specific { - local: d.exported.clone().into(), - alias: Some(Id::new(atom!("default"), SyntaxContext::empty())), - }); - } - ExportSpecifier::Named(n) => { - let orig = match &mut n.orig { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - if let Some((_, export_ctxt)) = ctxt { - orig.ctxt = export_ctxt; - } - - match &mut n.exported { - Some(ModuleExportName::Ident(exported)) => { - exported.ctxt = self.export_ctxt; - } - Some(ModuleExportName::Str(..)) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - Some(_) => panic!("unable to access unknown nodes"), - None => { - let mut exported: Ident = orig.clone(); - exported.ctxt = self.export_ctxt; - n.exported = Some(ModuleExportName::Ident(exported)); - } - } - - match &n.exported { - Some(ModuleExportName::Ident(exported)) => { - v.push(Specifier::Specific { - local: exported.clone().into(), - alias: Some(orig.clone().into()), - }); - } - Some(ModuleExportName::Str(..)) => { - unimplemented!("module string names unimplemented") - } - _ => { - v.push(Specifier::Specific { - local: orig.clone().into(), - alias: None, - }); - } - } - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - if need_wrapping { - let wrap_atom = named.src.as_ref().unwrap().value.to_atom_lossy(); - self.mark_as_wrapping_required(wrap_atom.as_ref()); - } - } - - ModuleItem::ModuleDecl(ModuleDecl::ExportAll(all)) => { - let ctxt = { - let src_atom = all.src.value.to_atom_lossy(); - self.ctxt_for(src_atom.as_ref()) - }; - if let Some((_, export_ctxt)) = ctxt { - ExportMetadata { - export_ctxt: Some(export_ctxt), - ..Default::default() - } - .encode(&mut all.with); - } - - self.info.items.entry(Some(*all.src.clone())).or_default(); - } - _ => {} - } - } -} diff --git a/crates/swc_bundler/src/bundler/finalize.rs b/crates/swc_bundler/src/bundler/finalize.rs deleted file mode 100644 index fd6ce8e3cb78..000000000000 --- a/crates/swc_bundler/src/bundler/finalize.rs +++ /dev/null @@ -1,455 +0,0 @@ -use std::path::{Path, PathBuf}; - -use anyhow::Error; -use relative_path::RelativePath; -use rustc_hash::FxHashMap; -use swc_atoms::atom; -use swc_common::{util::move_map::MoveMap, FileName, Mark, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_transforms_base::{ - fixer::fixer, - helpers::{inject_helpers, Helpers, HELPERS}, - hygiene::hygiene, -}; -use swc_ecma_utils::{contains_top_level_await, find_pat_ids, private_ident, ExprFactory}; -use swc_ecma_visit::{noop_fold_type, Fold, FoldWith, VisitMutWith}; - -use crate::{hash::calc_hash, Bundle, BundleKind, Bundler, Load, ModuleType, Resolve}; - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - /// This method do - /// - /// - inject helpers - /// - rename chunks - /// - invoke fixer - pub(super) fn finalize( - &self, - bundles: Vec, - unresolved_mark: Mark, - ) -> Result, Error> { - self.run(|| { - let mut new = Vec::with_capacity(bundles.len()); - let mut renamed = FxHashMap::default(); - - for mut bundle in bundles { - bundle.module = self.optimize(bundle.module); - - if !self.config.disable_hygiene { - bundle.module.visit_mut_with(&mut hygiene()); - } - - bundle.module = self.may_wrap_with_iife(bundle.module); - - if !self.config.disable_fixer { - bundle.module.visit_mut_with(&mut fixer(None)); - } - - { - // Inject swc helpers - let swc_helpers = *self - .scope - .get_module(bundle.id) - .expect("module should exist at this point") - .swc_helpers - .lock(); - - HELPERS.set(&Helpers::from_data(swc_helpers), || { - bundle - .module - .visit_mut_with(&mut inject_helpers(unresolved_mark)); - }); - } - - match bundle.kind { - BundleKind::Named { .. } => { - // Inject helpers - let helpers = self - .scope - .get_module(bundle.id) - .expect("module should exist at this point") - .helpers; - - helpers.add_to(&mut bundle.module.body); - - new.push(bundle); - } - BundleKind::Lib { name } => { - let hash = calc_hash(self.cm.clone(), &bundle.module)?; - let mut new_name = PathBuf::from(name); - let key = new_name.clone(); - let file_name = new_name - .file_name() - .map(|path| -> PathBuf { - let path = Path::new(path); - let ext = path.extension(); - if let Some(ext) = ext { - return format!( - "{}-{}.{}", - path.file_stem().unwrap().to_string_lossy(), - hash, - ext.to_string_lossy() - ) - .into(); - } - format!("{}-{}", path.file_stem().unwrap().to_string_lossy(), hash,) - .into() - }) - .expect("javascript file should have name"); - new_name.pop(); - new_name = new_name.join(file_name.clone()); - - renamed.insert(key, new_name.to_string_lossy().to_string()); - - new.push(Bundle { - kind: BundleKind::Named { - name: file_name.display().to_string(), - }, - ..bundle - }) - } - _ => new.push(bundle), - } - } - - if new.len() == 1 { - return Ok(new); - } - - new = new.move_map(|bundle| { - let path = match &*self.scope.get_module(bundle.id).unwrap().fm.name { - FileName::Real(ref v) => v.clone(), - _ => { - tracing::error!("Cannot rename: not a real file"); - return bundle; - } - }; - - let module = { - // Change imports - let mut v = Renamer { - resolver: &self.resolver, - base: &path, - renamed: &renamed, - }; - bundle.module.fold_with(&mut v) - }; - - Bundle { module, ..bundle } - }); - - Ok(new) - }) - } - - fn may_wrap_with_iife(&self, module: Module) -> Module { - if self.config.module != ModuleType::Iife { - return module; - } - - let is_async = contains_top_level_await(&module); - - // Properties of returned object - let mut props = Vec::new(); - - let mut body = BlockStmt { - span: module.span, - stmts: module - .body - .into_iter() - .filter_map(|item| { - let decl = match item { - ModuleItem::ModuleDecl(v) => v, - ModuleItem::Stmt(stmt) => return Some(stmt), - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - - match decl { - ModuleDecl::ExportNamed(NamedExport { src: Some(..), .. }) - | ModuleDecl::TsImportEquals(_) - | ModuleDecl::TsExportAssignment(_) - | ModuleDecl::TsNamespaceExport(_) - | ModuleDecl::Import(_) => None, - - ModuleDecl::ExportDecl(export) => { - match &export.decl { - Decl::Class(ClassDecl { ident, .. }) - | Decl::Fn(FnDecl { ident, .. }) => { - props.push(PropOrSpread::Prop(Box::new(Prop::Shorthand( - ident.clone(), - )))); - } - Decl::Var(decl) => { - let ids: Vec = find_pat_ids(decl); - props.extend( - ids.into_iter() - .map(Prop::Shorthand) - .map(Box::new) - .map(PropOrSpread::Prop), - ); - } - _ => unreachable!(), - } - - Some(export.decl.into()) - } - - ModuleDecl::ExportNamed(NamedExport { - specifiers, - src: None, - .. - }) => { - for s in specifiers { - match s { - ExportSpecifier::Namespace(..) => { - // unreachable - } - ExportSpecifier::Default(s) => { - props.push(PropOrSpread::Prop(Box::new(Prop::KeyValue( - KeyValueProp { - key: PropName::Ident(IdentName::new( - atom!("default"), - DUMMY_SP, - )), - value: s.exported.into(), - }, - )))); - } - ExportSpecifier::Named(s) => match s.exported { - Some(ModuleExportName::Ident(exported)) => { - let orig = match s.orig { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => unimplemented!( - "module string names unimplemented" - ), - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - props.push(PropOrSpread::Prop(Box::new( - Prop::KeyValue(KeyValueProp { - key: PropName::Ident(exported.into()), - value: orig.into(), - }), - ))); - } - Some(ModuleExportName::Str(..)) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - Some(_) => panic!("unable to access unknown nodes"), - None => { - let orig = match s.orig { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => unimplemented!( - "module string names unimplemented" - ), - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - props.push(PropOrSpread::Prop(Box::new( - Prop::Shorthand(orig), - ))); - } - }, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - None - } - - ModuleDecl::ExportDefaultDecl(export) => match export.decl { - DefaultDecl::Class(expr) => { - let ident = expr.ident; - let ident = - ident.unwrap_or_else(|| private_ident!("_default_decl")); - - props.push(PropOrSpread::Prop(Box::new(Prop::KeyValue( - KeyValueProp { - key: PropName::Ident(IdentName::new( - atom!("default"), - export.span, - )), - value: ident.clone().into(), - }, - )))); - - Some( - ClassDecl { - ident, - class: expr.class, - declare: false, - } - .into(), - ) - } - DefaultDecl::Fn(expr) => { - let ident = expr.ident; - let ident = - ident.unwrap_or_else(|| private_ident!("_default_decl")); - - props.push(PropOrSpread::Prop(Box::new(Prop::KeyValue( - KeyValueProp { - key: PropName::Ident(IdentName::new( - atom!("default"), - export.span, - )), - value: ident.clone().into(), - }, - )))); - - Some( - FnDecl { - ident, - function: expr.function, - declare: false, - } - .into(), - ) - } - DefaultDecl::TsInterfaceDecl(_) => None, - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }, - ModuleDecl::ExportDefaultExpr(export) => { - let default_var = private_ident!("default"); - props.push(PropOrSpread::Prop(Box::new(Prop::Shorthand( - default_var.clone(), - )))); - let var = VarDeclarator { - span: DUMMY_SP, - name: default_var.into(), - init: Some(export.expr), - definite: false, - }; - Some( - VarDecl { - span: DUMMY_SP, - kind: VarDeclKind::Const, - declare: false, - decls: vec![var], - ..Default::default() - } - .into(), - ) - } - - ModuleDecl::ExportAll(_) => None, - - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - }) - .collect(), - ..Default::default() - }; - body.stmts.push( - ReturnStmt { - span: DUMMY_SP, - arg: Some( - ObjectLit { - span: DUMMY_SP, - props, - } - .into(), - ), - } - .into(), - ); - - let f = Function { - is_generator: false, - is_async, - span: DUMMY_SP, - body: Some(body), - ..Default::default() - }; - - let invoked_fn_expr = FnExpr { - ident: None, - function: Box::new(f), - }; - - let iife = CallExpr { - span: DUMMY_SP, - callee: invoked_fn_expr.as_callee(), - args: Default::default(), - ..Default::default() - } - .into(); - - Module { - span: DUMMY_SP, - shebang: None, - body: vec![ModuleItem::Stmt(Stmt::Expr(ExprStmt { - span: DUMMY_SP, - expr: iife, - }))], - } - } -} - -/// Import renamer. This pass changes import path. -struct Renamer<'a, R> -where - R: Resolve, -{ - resolver: R, - base: &'a PathBuf, - renamed: &'a FxHashMap, -} - -impl Fold for Renamer<'_, R> -where - R: Resolve, -{ - noop_fold_type!(); - - fn fold_import_decl(&mut self, import: ImportDecl) -> ImportDecl { - let resolved = match self.resolver.resolve( - &FileName::Real(self.base.clone()), - &import.src.value.to_string_lossy(), - ) { - Ok(v) => match v.filename { - FileName::Real(v) => v, - _ => panic!("rename_bundles called with non-path module"), - }, - Err(_) => return import, - }; - - if let Some(v) = self.renamed.get(&resolved) { - // We use parent because RelativePath uses ../common-[hash].js - // if we use `entry-a.js` as a base. - // - // entry-a.js - // common.js - let base = self - .base - .parent() - .unwrap_or(self.base) - .as_os_str() - .to_string_lossy(); - let base = RelativePath::new(&*base); - let v = base.relative(v); - let value = v.as_str(); - return ImportDecl { - src: Box::new(Str { - value: if value.starts_with('.') { - value.into() - } else { - format!("./{value}").into() - }, - ..*import.src - }), - ..import - }; - } - - import - } -} diff --git a/crates/swc_bundler/src/bundler/helpers/_require.js b/crates/swc_bundler/src/bundler/helpers/_require.js deleted file mode 100644 index 7ac8f57e31be..000000000000 --- a/crates/swc_bundler/src/bundler/helpers/_require.js +++ /dev/null @@ -1,45 +0,0 @@ -function __swcpack_require__(mod) { - // Ported from _interopRequireWildcard - function interop(obj) { - if (obj && obj.__esModule) { - return obj; - } else { - var newObj = {}; - - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = - Object.defineProperty && - Object.getOwnPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : {}; - - if (desc.get || desc.set) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - } - - newObj.default = obj; - return newObj; - } - } - - var cache; - - if (cache) { - return cache; - } - - var module = { - exports: {}, - }; - - mod(module, module.exports); - cache = interop(module.exports); - return cache; -} diff --git a/crates/swc_bundler/src/bundler/helpers/mod.rs b/crates/swc_bundler/src/bundler/helpers/mod.rs deleted file mode 100644 index d99629fae243..000000000000 --- a/crates/swc_bundler/src/bundler/helpers/mod.rs +++ /dev/null @@ -1,70 +0,0 @@ -use std::sync::atomic::{AtomicBool, Ordering::SeqCst}; - -use once_cell::sync::Lazy; -use swc_common::{FileName, FilePathMapping, SourceMap}; -use swc_ecma_ast::*; -use swc_ecma_parser::parse_file_as_module; -use swc_ecma_utils::{drop_span, prepend_stmts}; - -#[derive(Debug, Default)] -pub(crate) struct Helpers { - /// `__swcpack_require__` - pub require: AtomicBool, -} - -fn parse(code: &'static str, name: &'static str) -> Vec { - let cm = SourceMap::new(FilePathMapping::empty()); - let fm = cm.new_source_file(FileName::Custom(name.into()).into(), code); - parse_file_as_module( - &fm, - Default::default(), - Default::default(), - None, - &mut Vec::new(), - ) - .map(|script| drop_span(script.body)) - .map_err(|_| {}) - .unwrap() -} - -macro_rules! define { - ( - $( - $name:ident { - build: $build:ident - } - )* - ) => { - $( - fn $build(to: &mut Vec) { - static STMTS: Lazy> = Lazy::new(|| { - parse(include_str!(concat!("_", stringify!($name), ".js")), stringify!($name)) - }); - - to.extend((*STMTS).clone()); - } - )* - }; -} - -define!(require { - build: build_swcpack_require -}); - -impl Helpers { - pub fn extend(&self, rhs: &Self) { - if rhs.require.load(SeqCst) { - self.require.store(true, SeqCst); - } - } - - pub fn add_to(&self, to: &mut Vec) { - let mut buf = Vec::new(); - - if self.require.load(SeqCst) { - build_swcpack_require(&mut buf); - } - - prepend_stmts(to, buf.into_iter()); - } -} diff --git a/crates/swc_bundler/src/bundler/import/mod.rs b/crates/swc_bundler/src/bundler/import/mod.rs deleted file mode 100644 index 978303c639f7..000000000000 --- a/crates/swc_bundler/src/bundler/import/mod.rs +++ /dev/null @@ -1,681 +0,0 @@ -use anyhow::{Context, Error}; -use rustc_hash::{FxHashMap, FxHashSet}; -use swc_atoms::Atom; -use swc_common::{sync::Lrc, FileName, Mark, Spanned, SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_utils::find_pat_ids; -use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; - -use super::Bundler; -use crate::{load::Load, resolve::Resolve, util::ExportMetadata}; - -#[cfg(test)] -mod tests; - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - /// This method de-globs imports if possible and colorizes imported values. - pub(super) fn extract_import_info( - &self, - path: &FileName, - module: &mut Module, - module_local_mark: Mark, - ) -> RawImports { - self.run(|| { - let mut v = ImportHandler { - module_ctxt: SyntaxContext::empty().apply_mark(module_local_mark), - path, - bundler: self, - top_level: false, - info: Default::default(), - usages: Default::default(), - imported_idents: Default::default(), - deglob_phase: false, - idents_to_deglob: Default::default(), - in_obj_of_member: false, - }; - module.body.visit_mut_with(&mut v); - v.deglob_phase = true; - module.body.visit_mut_with(&mut v); - - v.info - }) - } - - pub(super) fn resolve( - &self, - base: &FileName, - module_specifier: &str, - ) -> Result, Error> { - self.run(|| { - let path = self - .resolver - .resolve(base, module_specifier) - .map(|v| v.filename) - .with_context(|| format!("failed to resolve {module_specifier} from {base}"))?; - - let path = Lrc::new(path); - - Ok(path) - }) - } -} - -#[derive(Debug, Default)] -pub(super) struct RawImports { - /// Unconditional imports. This includes require on top level. - pub imports: Vec, - - /// Non-top-level imports. - /// - /// # Example - /// - /// ```js - /// try{ - /// const { watch } = require('watcher'); - /// } catch (e) { - /// } - /// ``` - pub lazy_imports: Vec, - pub dynamic_imports: Vec, - - /// Contains namespace imports accessed with computed key. - /// - /// - /// e.g. - /// - ///```js - /// import * as foo from './foo'; - /// function bar() {} - /// foo[bar()] - /// ``` - pub forced_ns: FxHashSet, -} - -/// This type implements two operation (analysis, deglobbing) to reduce binary -/// size. -struct ImportHandler<'a, 'b, L, R> -where - L: Load, - R: Resolve, -{ - /// The [SyntaxContext] for the top level module items. - //// The top level module items includes imported bindings. - module_ctxt: SyntaxContext, - path: &'a FileName, - bundler: &'a Bundler<'b, L, R>, - top_level: bool, - info: RawImports, - - /// HashMap from the local identifier of a namespace import to used - /// properties. - usages: FxHashMap>, - - /// While deglobbing, we also marks imported identifiers. - imported_idents: FxHashMap, - - deglob_phase: bool, - idents_to_deglob: FxHashSet, - - /// `true` while folding objects of a member expression. - /// - /// This is used to distinguish usage of `a` in `console.log(a)` and - /// `a.join()`. - in_obj_of_member: bool, -} - -impl RawImports { - fn insert(&mut self, import: &ImportDecl) { - for prev in self.imports.iter_mut() { - if prev.src.value == import.src.value { - prev.specifiers.extend(import.specifiers.clone()); - return; - } - } - - self.imports.push(import.clone()); - } -} - -impl ImportHandler<'_, '_, L, R> -where - L: Load, - R: Resolve, -{ - /// Returns (local, export) - fn ctxt_for(&self, src: &Atom) -> Option<(SyntaxContext, SyntaxContext)> { - // Don't apply mark if it's a core module. - if self.bundler.is_external(src) { - return None; - } - let path = self.bundler.resolve(self.path, src).ok()?; - let (_, local_mark, export_mark) = self.bundler.scope.module_id_gen.gen(&path); - - Some(( - SyntaxContext::empty().apply_mark(local_mark), - SyntaxContext::empty().apply_mark(export_mark), - )) - } - - fn mark_as_wrapping_required(&self, src: &Atom) { - // Don't apply mark if it's a core module. - if self.bundler.is_external(src) { - return; - } - let path = self.bundler.resolve(self.path, src); - let path = match path { - Ok(v) => v, - Err(_) => return, - }; - let (id, _, _) = self.bundler.scope.module_id_gen.gen(&path); - - self.bundler.scope.mark_as_wrapping_required(id); - } - - fn mark_as_cjs(&self, src: &Atom) { - let path = self.bundler.resolve(self.path, src); - let path = match path { - Ok(v) => v, - Err(_) => return, - }; - let (id, _, _) = self.bundler.scope.module_id_gen.gen(&path); - - self.bundler.scope.mark_as_cjs(id); - } - - fn add_forced_ns_for(&mut self, id: Id) { - self.idents_to_deglob.remove(&id); - self.imported_idents.remove(&id); - self.usages.remove(&id); - - if let Some(src) = self - .info - .imports - .iter() - .find(|import| { - import.specifiers.iter().any(|specifier| match specifier { - ImportSpecifier::Namespace(ns) => ns.local.sym == id.0 && ns.local.ctxt == id.1, - _ => false, - }) - }) - .map(|import| import.src.value.clone()) - { - self.info.forced_ns.insert(src.to_atom_lossy().into_owned()); - } - } - - fn find_require(&mut self, e: &mut Expr) { - match e { - Expr::Call(e) if e.args.len() == 1 => { - let src = match e.args.first().unwrap() { - ExprOrSpread { spread: None, expr } => match &**expr { - Expr::Lit(Lit::Str(s)) => s, - _ => return, - }, - _ => return, - }; - - match &mut e.callee { - Callee::Expr(callee) - if self.bundler.config.require && callee.is_ident_ref_to("require") => - { - let src_atom = src.value.to_atom_lossy(); - if self.bundler.is_external(src_atom.as_ref()) { - return; - } - if let Expr::Ident(i) = &mut **callee { - self.mark_as_cjs(src_atom.as_ref()); - if let Some((_, export_ctxt)) = self.ctxt_for(src_atom.as_ref()) { - i.ctxt = export_ctxt; - } - } - - let span = callee.span(); - - let decl = ImportDecl { - span, - specifiers: Vec::new(), - src: Box::new(src.clone()), - type_only: false, - with: None, - phase: Default::default(), - }; - - if self.top_level { - self.info.insert(&decl); - return; - } - - self.info.lazy_imports.push(decl); - } - - // TODO: Uncomment this after implementing an option to make swc_bundler - // includes dynamic imports - // - // - // ExprOrSuper::Expr(ref e) => match &**e { - // Expr::Ident(Ident { - // sym: "import", - // .. - // }) => { - // self.info.dynamic_imports.push(src.clone()); - // } - // _ => {} - // }, - _ => {} - } - } - _ => {} - } - } - - fn analyze_usage(&mut self, e: &mut Expr) { - if let Expr::Member(e) = e { - if let Expr::Ident(obj) = &*e.obj { - if !self.imported_idents.contains_key(&obj.to_id()) { - // If it's not imported, just abort the usage analysis. - return; - } - - if e.prop.is_computed() { - // If a module is accessed with unknown key, we should import - // everything from it. - self.add_forced_ns_for(obj.to_id()); - return; - } - - // Store usages of obj - let import = self.info.imports.iter().find(|import| { - for s in &import.specifiers { - if let ImportSpecifier::Namespace(n) = s { - return obj.sym == n.local.sym - && (obj.ctxt == self.module_ctxt || obj.ctxt == n.local.ctxt); - } - } - - false - }); - let import = match import { - Some(v) => v, - None => return, - }; - - let src_atom = import.src.value.to_atom_lossy(); - let mark = self.ctxt_for(src_atom.as_ref()); - let exported_ctxt = match mark { - None => return, - Some(ctxts) => ctxts.1, - }; - let prop = match &e.prop { - MemberProp::Ident(i) => { - let mut i = Ident::from(i.clone()); - i.ctxt = exported_ctxt; - i - } - _ => unreachable!( - "Non-computed member expression with property other than ident is invalid" - ), - }; - - self.usages - .entry(obj.to_id()) - .or_default() - .push(prop.to_id()); - } - } - } - - fn try_deglob(&mut self, e: &mut Expr) { - let me = match e { - Expr::Member(e) => e, - _ => return, - }; - if me.prop.is_computed() { - return; - } - - let obj = match &*me.obj { - Expr::Ident(obj) => obj, - _ => return, - }; - - let usages = self.usages.get(&obj.to_id()); - - match usages { - Some(..) => {} - _ => return, - }; - - let mut prop = match &me.prop { - MemberProp::Ident(v) => Ident::from(v.clone()), - _ => return, - }; - prop.ctxt = self.imported_idents.get(&obj.to_id()).copied().unwrap(); - - *e = prop.into(); - } -} - -impl VisitMut for ImportHandler<'_, '_, L, R> -where - L: Load, - R: Resolve, -{ - noop_visit_mut_type!(fail); - - fn visit_mut_export_named_specifier(&mut self, s: &mut ExportNamedSpecifier) { - let orig = match &s.orig { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => unimplemented!("module string names unimplemented"), - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - - self.add_forced_ns_for(orig.to_id()); - - match &mut s.exported { - Some(ModuleExportName::Ident(exported)) => { - // PR 3139 (https://github.com/swc-project/swc/pull/3139) removes the syntax context from any named exports from other sources. - exported.ctxt = self.module_ctxt; - } - Some(ModuleExportName::Str(..)) => unimplemented!("module string names unimplemented"), - #[cfg(swc_ast_unknown)] - Some(_) => panic!("unable to access unknown nodes"), - None => { - let exported = Ident::new(orig.sym.clone(), orig.span, self.module_ctxt); - s.exported = Some(ModuleExportName::Ident(exported)); - } - } - } - - fn visit_mut_expr(&mut self, e: &mut Expr) { - e.visit_mut_children_with(self); - - if !self.deglob_phase { - // Firstly, we check for usages of imported namespaces. - // Code like below are handled by this check. - // - // import * as log from './log'; - // console.log(log) - // console.log(log.getLogger()) - if !self.in_obj_of_member { - if let Expr::Ident(i) = &e { - if !self.in_obj_of_member { - self.add_forced_ns_for(i.to_id()); - return; - } - } - } - - self.analyze_usage(e); - self.find_require(e); - } else { - self.try_deglob(e); - } - } - - fn visit_mut_import_decl(&mut self, import: &mut ImportDecl) { - let src_atom = import.src.value.to_atom_lossy().into_owned(); - // Ignore if it's a core module. - if self.bundler.is_external(&src_atom) { - return; - } - - if !self.deglob_phase { - if let Some((_, export_ctxt)) = self.ctxt_for(&src_atom) { - // Firstly we attach proper syntax contexts. - ExportMetadata { - export_ctxt: Some(export_ctxt), - ..Default::default() - } - .encode(&mut import.with); - - // Then we store list of imported identifiers. - for specifier in &mut import.specifiers { - match specifier { - ImportSpecifier::Named(n) => { - self.imported_idents.insert(n.local.to_id(), export_ctxt); - match &mut n.imported { - Some(ModuleExportName::Ident(imported)) => { - imported.ctxt = export_ctxt; - } - Some(ModuleExportName::Str(..)) => { - unimplemented!("module string names unimplemented") - } - #[cfg(swc_ast_unknown)] - Some(_) => panic!("unable to access unknown nodes"), - None => { - let mut imported: Ident = n.local.clone(); - imported.ctxt = export_ctxt; - n.imported = Some(ModuleExportName::Ident(imported)); - } - } - } - ImportSpecifier::Default(n) => { - self.imported_idents.insert(n.local.to_id(), n.local.ctxt); - } - ImportSpecifier::Namespace(n) => { - self.imported_idents.insert(n.local.to_id(), export_ctxt); - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - } - - self.info.insert(import); - return; - } - - // Now we are in deglobbing phase. - - // We cannot deglob this. - if self.info.forced_ns.contains(&import.src.value) { - return; - } - - // deglob namespace imports - if import.specifiers.len() == 1 { - if let ImportSpecifier::Namespace(ns) = &import.specifiers[0] { - // - let specifiers = self - .usages - .get(&ns.local.to_id()) - .cloned() - .map(|ids| { - // - let specifiers: Vec<_> = ids - .into_iter() - .map(|id| { - self.idents_to_deglob.insert(id.clone()); - ImportSpecifier::Named(ImportNamedSpecifier { - span: DUMMY_SP, - local: Ident::new(id.0, DUMMY_SP, id.1), - imported: None, - is_type_only: false, - }) - }) - .collect(); - - for import_info in &mut self.info.imports { - if import_info.src != import.src { - continue; - } - - import_info.specifiers.extend(specifiers.clone()); - } - - specifiers - }) - .unwrap_or_else(Vec::new); - - if !specifiers.is_empty() { - import.specifiers = specifiers; - return; - } - - // We failed to found property usage. - self.info - .forced_ns - .insert(import.src.value.clone().to_atom_lossy().into_owned()); - } - } - } - - fn visit_mut_member_expr(&mut self, e: &mut MemberExpr) { - let old = self.in_obj_of_member; - self.in_obj_of_member = true; - e.obj.visit_mut_with(self); - - if let MemberProp::Computed(c) = &mut e.prop { - self.in_obj_of_member = false; - c.visit_mut_with(self); - } - - self.in_obj_of_member = old; - } - - fn visit_mut_module_items(&mut self, items: &mut Vec) { - self.top_level = true; - items.visit_mut_children_with(self); - - items.retain_mut(|item| match item { - ModuleItem::Stmt(Stmt::Empty(..)) => false, - ModuleItem::Stmt(Stmt::Decl(Decl::Var(var))) => { - var.decls.retain(|d| !matches!(d.name, Pat::Invalid(..))); - - !var.decls.is_empty() - } - - _ => true, - }); - - if self.deglob_phase { - let mut wrapping_required = Vec::new(); - for import in self.info.imports.iter_mut() { - let src_atom = import.src.value.to_atom_lossy().into_owned(); - let use_ns = self.info.forced_ns.contains(&import.src.value) - || self.bundler.config.external_modules.contains(&src_atom); - - if use_ns { - wrapping_required.push(import.src.value.clone()); - } else { - // De-glob namespace imports - import - .specifiers - .retain(|s| !matches!(s, ImportSpecifier::Namespace(_))); - } - } - - for id in wrapping_required { - let id_atom = id.to_atom_lossy(); - self.mark_as_wrapping_required(id_atom.as_ref()); - } - } - } - - fn visit_mut_stmts(&mut self, items: &mut Vec) { - self.top_level = false; - items.visit_mut_children_with(self) - } - - fn visit_mut_super_prop_expr(&mut self, e: &mut SuperPropExpr) { - let old = self.in_obj_of_member; - - if let SuperProp::Computed(c) = &mut e.prop { - self.in_obj_of_member = false; - c.visit_mut_with(self); - } - - self.in_obj_of_member = old; - } - - /// ```js - /// const { readFile } = required('fs'); - /// ``` - /// - /// is treated as - /// - /// ```js - /// import { readFile } from 'fs'; - /// ``` - fn visit_mut_var_declarator(&mut self, node: &mut VarDeclarator) { - node.visit_mut_children_with(self); - - if let Some(init) = &mut node.init { - match &mut **init { - Expr::Call(CallExpr { - span, - callee: Callee::Expr(ref mut callee), - ref args, - .. - }) if self.bundler.config.require - && callee.is_ident_ref_to("require") - && args.len() == 1 => - { - let span = *span; - let src = match args.first().unwrap() { - ExprOrSpread { spread: None, expr } => match &**expr { - Expr::Lit(Lit::Str(s)) => s.clone(), - _ => return, - }, - _ => return, - }; - // Ignore core modules. - let src_atom = src.value.to_atom_lossy(); - if self - .bundler - .config - .external_modules - .contains(src_atom.as_ref()) - { - return; - } - - self.mark_as_cjs(src_atom.as_ref()); - - if let Expr::Ident(i) = &mut **callee { - if let Some((_, export_ctxt)) = self.ctxt_for(src_atom.as_ref()) { - i.ctxt = export_ctxt; - } - } - - let ids: Vec = find_pat_ids(&node.name); - - let decl = ImportDecl { - span, - specifiers: ids - .into_iter() - .map(|ident| { - ImportSpecifier::Named(ImportNamedSpecifier { - span, - local: ident, - imported: None, - is_type_only: false, - }) - }) - .collect(), - src: Box::new(src), - type_only: false, - with: None, - phase: Default::default(), - }; - - // if self.top_level { - // self.info.imports.push(decl); - // node.init = None; - // node.name = Pat::Invalid(Invalid { span: DUMMY_SP }); - // return node; - // } - - self.info.lazy_imports.push(decl); - } - - _ => {} - } - } - } -} diff --git a/crates/swc_bundler/src/bundler/import/tests.rs b/crates/swc_bundler/src/bundler/import/tests.rs deleted file mode 100644 index 8cec1eec6396..000000000000 --- a/crates/swc_bundler/src/bundler/import/tests.rs +++ /dev/null @@ -1,75 +0,0 @@ -// use super::ImportHandler; -// use crate::bundler::tests::suite; -// use std::path::Path; -// use swc_common::{FileName, Mark, SyntaxContext}; -// use swc_ecma_visit::FoldWith; - -// #[test] -// #[ignore] -// fn ns_import_deglob_simple() { -// suite().run(|t| { -// let m = t.parse( -// " -// import * as ns from 'foo'; -// ns.foo(); -// ", -// ); -// let mut v = ImportHandler { -// path: &FileName::Real(Path::new("index.js").to_path_buf()), -// bundler: &t.bundler, -// top_level: false, -// info: Default::default(), -// ns_usage: Default::default(), -// deglob_phase: false, -// imported_idents: Default::default(), -// module_ctxt: -// SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())), -// idents_to_deglob: Default::default(), }; -// let m = m.fold_with(&mut v); -// assert!(v.info.forced_ns.is_empty()); -// assert_eq!(v.info.imports.len(), 1); - -// t.assert_eq(&m, "foo();"); - -// Ok(()) -// }) -// } - -// #[test] -// #[ignore] -// fn ns_import_deglob_multi() { -// suite().run(|t| { -// let m = t.parse( -// " -// import * as ns from 'foo'; -// ns.foo(); -// ns.bar(); -// ", -// ); -// let mut v = ImportHandler { -// path: &FileName::Real(Path::new("index.js").to_path_buf()), -// bundler: &t.bundler, -// top_level: false, -// info: Default::default(), -// ns_usage: Default::default(), -// deglob_phase: false, -// imported_idents: Default::default(), -// module_ctxt: -// SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())), -// idents_to_deglob: Default::default(), }; -// let m = m.fold_with(&mut v); -// assert!(v.info.forced_ns.is_empty()); -// assert_eq!(v.info.imports.len(), 1); -// assert_eq!(v.info.imports[0].specifiers.len(), 2); -// assert!(!format!("{:?}", -// v.info.imports[0].specifiers).contains("ns")); - -// t.assert_eq( -// &m, -// "foo(); -// bar();", -// ); - -// Ok(()) -// }) -// } diff --git a/crates/swc_bundler/src/bundler/keywords.rs b/crates/swc_bundler/src/bundler/keywords.rs deleted file mode 100644 index f5bcf0b2a956..000000000000 --- a/crates/swc_bundler/src/bundler/keywords.rs +++ /dev/null @@ -1,150 +0,0 @@ -use rustc_hash::FxHashMap; -use swc_common::util::take::Take; -use swc_ecma_ast::*; -use swc_ecma_utils::private_ident; -use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; - -use crate::id::Id; - -#[derive(Default)] -pub struct KeywordRenamer { - renamed: FxHashMap, -} - -impl KeywordRenamer { - /// Returns `Some(new_ident)` if it should be renamed. - fn renamed(&mut self, id: &Ident) -> Option { - if id.sym == "import" { - return None; - } - - if !(id.is_reserved() || id.is_reserved_in_strict_mode(true) || id.is_reserved_in_es3()) { - return None; - } - - Some( - self.renamed - .entry(id.into()) - .or_insert_with(|| private_ident!(id.span, format!("__{}", id.sym))) - .clone(), - ) - } -} - -impl VisitMut for KeywordRenamer { - noop_visit_mut_type!(fail); - - fn visit_mut_binding_ident(&mut self, n: &mut BindingIdent) { - if let Some(new) = self.renamed(&n.id) { - n.ctxt = new.ctxt; - n.sym = new.sym; - } - } - - fn visit_mut_class_decl(&mut self, c: &mut ClassDecl) { - c.class.visit_mut_with(self); - if let Some(renamed) = self.renamed(&c.ident) { - c.ident = renamed; - } - } - - fn visit_mut_class_prop(&mut self, n: &mut ClassProp) { - if n.key.is_computed() { - n.key.visit_mut_with(self); - } - - n.decorators.visit_mut_with(self); - n.value.visit_mut_with(self); - } - - fn visit_mut_export_named_specifier(&mut self, n: &mut ExportNamedSpecifier) { - let orig = match &n.orig { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => unimplemented!("module string names unimplemented"), - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - if let Some(renamed) = self.renamed(orig) { - n.orig = ModuleExportName::Ident(renamed); - } - } - - fn visit_mut_expr(&mut self, n: &mut Expr) { - if let Expr::Ident(n) = n { - if let Some(renamed) = self.renamed(n) { - *n = renamed; - } - return; - } - - n.visit_mut_children_with(self); - } - - fn visit_mut_fn_decl(&mut self, f: &mut FnDecl) { - f.function.visit_mut_with(self); - if let Some(renamed) = self.renamed(&f.ident) { - f.ident = renamed; - } - } - - fn visit_mut_object_pat_prop(&mut self, n: &mut ObjectPatProp) { - if let ObjectPatProp::Assign(pat) = n { - if let Some(renamed) = self.renamed(&pat.key) { - match &mut pat.value { - Some(default) => { - *n = ObjectPatProp::KeyValue(KeyValuePatProp { - key: PropName::Ident(pat.key.take().into()), - value: AssignPat { - span: pat.span, - left: Box::new(renamed.into()), - right: default.take(), - } - .into(), - }); - } - None => { - *n = ObjectPatProp::KeyValue(KeyValuePatProp { - key: PropName::Ident(pat.key.take().into()), - value: renamed.into(), - }) - } - } - } - return; - } - - n.visit_mut_children_with(self); - } - - fn visit_mut_pat(&mut self, n: &mut Pat) { - if let Pat::Ident(n) = n { - if let Some(renamed) = self.renamed(&n.id) { - *n = renamed.into(); - } - - return; - } - n.visit_mut_children_with(self); - } - - fn visit_mut_private_prop(&mut self, n: &mut PrivateProp) { - n.decorators.visit_mut_with(self); - n.value.visit_mut_with(self); - } - - fn visit_mut_prop(&mut self, n: &mut Prop) { - match n { - Prop::Shorthand(i) => { - if let Some(renamed) = self.renamed(i) { - *n = Prop::KeyValue(KeyValueProp { - key: PropName::Ident(i.clone().into()), - value: renamed.into(), - }); - } - } - _ => { - n.visit_mut_children_with(self); - } - } - } -} diff --git a/crates/swc_bundler/src/bundler/load.rs b/crates/swc_bundler/src/bundler/load.rs deleted file mode 100644 index 40290272381a..000000000000 --- a/crates/swc_bundler/src/bundler/load.rs +++ /dev/null @@ -1,501 +0,0 @@ -#![allow(dead_code)] - -use anyhow::{Context, Error}; -use is_macro::Is; -#[cfg(feature = "rayon")] -use rayon::iter::ParallelIterator; -use swc_atoms::atom; -use swc_common::{ - sync::{Lock, Lrc}, - FileName, SourceFile, SyntaxContext, -}; -use swc_ecma_ast::{ - CallExpr, Callee, Expr, Ident, ImportDecl, ImportSpecifier, MemberExpr, MemberProp, Module, - ModuleDecl, ModuleExportName, Str, SuperProp, SuperPropExpr, -}; -use swc_ecma_transforms_base::resolver; -use swc_ecma_visit::{ - noop_visit_mut_type, noop_visit_type, Visit, VisitMut, VisitMutWith, VisitWith, -}; - -use super::{export::Exports, helpers::Helpers, Bundler}; -use crate::{ - bundler::{export::RawExports, import::RawImports}, - id::{Id, ModuleId}, - load::ModuleData, - util, - util::IntoParallelIterator, - Load, Resolve, -}; -/// Module after applying transformations. -#[derive(Debug, Clone)] -pub(crate) struct TransformedModule { - pub id: ModuleId, - pub fm: Lrc, - pub module: Lrc, - pub imports: Lrc, - pub exports: Lrc, - - /// If false, the module will be wrapped with a small helper function. - pub is_es6: bool, - - /// Used helpers - pub helpers: Lrc, - - pub swc_helpers: Lrc>, - - local_ctxt: SyntaxContext, - export_ctxt: SyntaxContext, -} - -impl TransformedModule { - /// [SyntaxContext] for exported items. - pub fn export_ctxt(&self) -> SyntaxContext { - self.export_ctxt - } - - /// Top level contexts. - pub fn local_ctxt(&self) -> SyntaxContext { - self.local_ctxt - } -} - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - /// Phase 1 (discovery) - /// - /// We apply transforms at this phase to make cache efficient. - /// As we cache in this phase, changing dependency does not affect cache. - pub(super) fn load_transformed( - &self, - file_name: &FileName, - ) -> Result, Error> { - self.run(|| { - tracing::trace!("load_transformed: ({})", file_name); - - // In case of common module - if let Some(cached) = self.scope.get_module_by_path(file_name) { - tracing::debug!("Cached: {}", file_name); - return Ok(Some(cached)); - } - - let (_, data) = self.load(file_name).context("Bundler.load() failed")?; - let (v, mut files) = self - .analyze(file_name, data) - .context("failed to analyze module")?; - files.dedup_by_key(|v| v.1.clone()); - - tracing::debug!( - "({:?}, {:?}, {:?}) Storing module: {}", - v.id, - v.local_ctxt(), - v.export_ctxt(), - file_name - ); - self.scope.store_module(v.clone()); - - // Load dependencies and store them in the `Scope` - let results = files - .into_par_iter() - .map(|(_src, path)| { - tracing::trace!("loading dependency: {}", path); - self.load_transformed(&path) - }) - .collect::>(); - - // Do tasks in parallel, and then wait for result - for result in results { - result?; - } - - Ok(Some(v)) - }) - } - - fn load(&self, file_name: &FileName) -> Result<(ModuleId, ModuleData), Error> { - self.run(|| { - let (module_id, _, _) = self.scope.module_id_gen.gen(file_name); - - let data = self - .loader - .load(file_name) - .with_context(|| format!("Bundler.loader.load({file_name}) failed"))?; - self.scope.mark_as_loaded(module_id); - Ok((module_id, data)) - }) - } - - /// This methods returns [Source]s which should be loaded. - fn analyze( - &self, - file_name: &FileName, - mut data: ModuleData, - ) -> Result<(TransformedModule, Vec<(Source, Lrc)>), Error> { - self.run(|| { - tracing::trace!("transform_module({})", data.fm.name); - let (id, local_mark, export_mark) = self.scope.module_id_gen.gen(file_name); - - data.module.visit_mut_with(&mut ClearMark); - - data.module - .visit_mut_with(&mut resolver(self.unresolved_mark, local_mark, false)); - - // { - // let code = self - // .swc - // .print( - // &module.clone().fold_with(&mut HygieneVisualizer), - // SourceMapsConfig::Bool(false), - // None, - // false, - // ) - // .unwrap() - // .code; - // - // println!("Resolved:\n{}\n\n", code); - // } - - let imports = self.extract_import_info(file_name, &mut data.module, local_mark); - - // { - // let code = self - // .swc - // .print( - // &module.clone().fold_with(&mut HygieneVisualizer), - // SourceMapsConfig::Bool(false), - // None, - // false, - // ) - // .unwrap() - // .code; - // - // println!("After imports:\n{}\n", code,); - // } - - let exports = self.extract_export_info( - file_name, - &mut data.module, - SyntaxContext::empty().apply_mark(export_mark), - ); - - let is_es6 = if !self.config.require { - true - } else { - let mut v = Es6ModuleDetector { - forced_es6: false, - found_other: false, - }; - data.module.visit_with(&mut v); - v.forced_es6 || !v.found_other - }; - - let (imports, exports) = util::join( - || self.resolve_imports(file_name, imports), - || self.resolve_exports(file_name, exports), - ); - let (imports, mut import_files) = imports?; - let (exports, reexport_files) = exports?; - import_files.extend(reexport_files); - - Ok(( - TransformedModule { - id, - fm: data.fm, - module: Lrc::new(data.module), - imports: Lrc::new(imports), - exports: Lrc::new(exports), - is_es6, - helpers: Default::default(), - swc_helpers: Lrc::new(Lock::new(data.helpers.data())), - local_ctxt: SyntaxContext::empty().apply_mark(local_mark), - export_ctxt: SyntaxContext::empty().apply_mark(export_mark), - }, - import_files, - )) - }) - } - - /// Resolve re-exports. - fn resolve_exports( - &self, - base: &FileName, - raw: RawExports, - ) -> Result<(Exports, Vec<(Source, Lrc)>), Error> { - self.run(|| { - tracing::trace!("resolve_exports({})", base); - let mut files = Vec::new(); - - let mut exports = Exports::default(); - - let items = raw - .items - .into_par_iter() - .map(|(src, ss)| -> Result<_, Error> { - self.run(|| { - let info = match src { - Some(src) => { - let name = self.resolve(base, &src.value.to_string_lossy())?; - let (id, local_mark, export_mark) = - self.scope.module_id_gen.gen(&name); - Some((id, local_mark, export_mark, name, src)) - } - None => None, - }; - - Ok((info, ss)) - }) - }) - .collect::>(); - - for res in items { - let (info, specifiers) = res?; - - match info { - None => exports.items.extend(specifiers), - Some((id, local_mark, export_mark, name, src)) => { - // - let src = Source { - is_loaded_synchronously: true, - is_unconditional: false, - module_id: id, - local_ctxt: SyntaxContext::empty().apply_mark(local_mark), - export_ctxt: SyntaxContext::empty().apply_mark(export_mark), - src, - }; - exports.reexports.push((src.clone(), specifiers)); - files.push((src, name)); - } - } - } - - Ok((exports, files)) - }) - } - - /// Resolve dependencies - fn resolve_imports( - &self, - base: &FileName, - info: RawImports, - ) -> Result<(Imports, Vec<(Source, Lrc)>), Error> { - self.run(|| { - tracing::trace!("resolve_imports({})", base); - let mut files = Vec::new(); - - let mut merged = Imports::default(); - let RawImports { - imports, - lazy_imports, - dynamic_imports, - forced_ns, - } = info; - - let loaded = imports - .into_par_iter() - .map(|v| (v, false, true)) - .chain(lazy_imports.into_par_iter().map(|v| (v, false, false))) - .chain(dynamic_imports.into_par_iter().map(|src| { - ( - ImportDecl { - span: src.span, - specifiers: Vec::new(), - src: Box::new(src), - type_only: false, - with: None, - phase: Default::default(), - }, - true, - false, - ) - })) - .map(|(decl, dynamic, unconditional)| -> Result<_, Error> { - self.run(|| { - // - let file_name = self.resolve(base, &decl.src.value.to_string_lossy())?; - let (id, local_mark, export_mark) = - self.scope.module_id_gen.gen(&file_name); - - Ok(( - id, - local_mark, - export_mark, - file_name, - decl, - dynamic, - unconditional, - )) - }) - }) - .collect::>(); - - for res in loaded { - // TODO: Report error and proceed instead of returning an error - let (id, local_mark, export_mark, file_name, decl, is_dynamic, is_unconditional) = - res?; - - let src = Source { - is_loaded_synchronously: !is_dynamic, - is_unconditional, - module_id: id, - local_ctxt: SyntaxContext::empty().apply_mark(local_mark), - export_ctxt: SyntaxContext::empty().apply_mark(export_mark), - src: *decl.src, - }; - files.push((src.clone(), file_name)); - - // TODO: Handle rename - let mut specifiers = Vec::new(); - for s in decl.specifiers { - match s { - ImportSpecifier::Named(s) => { - let imported = match s.imported { - Some(ModuleExportName::Ident(ident)) => Some(ident), - Some(ModuleExportName::Str(..)) => { - unimplemented!("module string names unimplemented") - } - _ => None, - }; - specifiers.push(Specifier::Specific { - local: s.local.into(), - alias: imported.map(From::from), - }) - } - ImportSpecifier::Default(s) => specifiers.push(Specifier::Specific { - local: s.local.into(), - alias: Some(Id::new(atom!("default"), SyntaxContext::empty())), - }), - ImportSpecifier::Namespace(s) => { - specifiers.push(Specifier::Namespace { - local: s.local.into(), - all: forced_ns.contains(&src.src.value), - }); - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - merged.specifiers.push((src, specifiers)); - } - - Ok((merged, files)) - }) - } -} - -#[derive(Debug, Default)] -pub(crate) struct Imports { - /// If imported ids are empty, it is a side-effect import. - pub specifiers: Vec<(Source, Vec)>, -} - -/// Clone is relatively cheap -#[derive(Debug, Clone, Is)] -pub(crate) enum Specifier { - Specific { - local: Id, - alias: Option, - }, - Namespace { - local: Id, - /// True for `import * as foo from 'foo'; foo[computedKey()]` - all: bool, - }, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub(crate) struct Source { - pub is_loaded_synchronously: bool, - pub is_unconditional: bool, - - pub module_id: ModuleId, - pub local_ctxt: SyntaxContext, - pub export_ctxt: SyntaxContext, - - // Clone is relatively cheap, thanks to hstr. - pub src: Str, -} - -struct Es6ModuleDetector { - /// If import statement or export is detected, it's an es6 module regardless - /// of other codes. - forced_es6: bool, - /// True if other module system is detected. - found_other: bool, -} - -impl Visit for Es6ModuleDetector { - noop_visit_type!(); - - fn visit_call_expr(&mut self, e: &CallExpr) { - e.visit_children_with(self); - - match &e.callee { - Callee::Expr(e) => { - if let Expr::Ident(Ident { sym: _require, .. }) = &**e { - self.found_other = true; - } - } - Callee::Super(_) | Callee::Import(_) => {} - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - fn visit_member_expr(&mut self, e: &MemberExpr) { - e.obj.visit_with(self); - - if let MemberProp::Computed(c) = &e.prop { - c.visit_with(self); - } - - if let Expr::Ident(i) = &*e.obj { - // TODO: Check syntax context (Check if marker is the global mark) - if i.sym == *"module" { - self.found_other = true; - } - - if i.sym == *"exports" { - self.found_other = true; - } - } - } - - fn visit_super_prop_expr(&mut self, e: &SuperPropExpr) { - if let SuperProp::Computed(c) = &e.prop { - c.visit_with(self); - } - } - - fn visit_module_decl(&mut self, decl: &ModuleDecl) { - match decl { - ModuleDecl::Import(_) - | ModuleDecl::ExportDecl(_) - | ModuleDecl::ExportNamed(_) - | ModuleDecl::ExportDefaultDecl(_) - | ModuleDecl::ExportDefaultExpr(_) - | ModuleDecl::ExportAll(_) => { - self.forced_es6 = true; - } - - ModuleDecl::TsImportEquals(_) => {} - ModuleDecl::TsExportAssignment(_) => {} - ModuleDecl::TsNamespaceExport(_) => {} - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } -} - -#[derive(Clone, Copy)] -struct ClearMark; -impl VisitMut for ClearMark { - noop_visit_mut_type!(fail); - - fn visit_mut_ident(&mut self, ident: &mut Ident) { - ident.ctxt = SyntaxContext::empty(); - } -} diff --git a/crates/swc_bundler/src/bundler/mod.rs b/crates/swc_bundler/src/bundler/mod.rs deleted file mode 100644 index 5e7b09c9d202..000000000000 --- a/crates/swc_bundler/src/bundler/mod.rs +++ /dev/null @@ -1,214 +0,0 @@ -use std::collections::HashMap; - -use anyhow::{Context, Error}; -use rustc_hash::FxHashMap; -use swc_atoms::Atom; -use swc_common::{sync::Lrc, FileName, Globals, Mark, SourceMap, SyntaxContext, GLOBALS}; -use swc_ecma_ast::Module; - -use self::scope::Scope; -use crate::{Hook, Load, ModuleId, Resolve}; - -mod chunk; -mod export; -mod finalize; -mod helpers; -mod import; -mod keywords; -mod load; -mod optimize; -mod scope; -#[cfg(test)] -pub(crate) mod tests; - -#[derive(Debug, Default)] -pub struct Config { - /// If it's true, [Bundler] searches for require calls. - pub require: bool, - - /// If it's true, many temporary variables will be generated. - /// - /// This option exists mainly for testing. As inlining and dce removes all - /// temporary variables, it's really hard to see what's going on. - pub disable_inliner: bool, - - /// Useful if you are going to minify the code. - pub disable_hygiene: bool, - - pub disable_fixer: bool, - - /// Disable tree-shaking optimization. - pub disable_dce: bool, - - /// List of modules which should be preserved. - pub external_modules: Vec, - - /// Type of emitted module - pub module: ModuleType, -} - -#[derive(Debug, PartialEq, Eq, Hash, Default)] -pub enum ModuleType { - #[default] - Es, - Iife, -} - -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub enum BundleKind { - /// User-provided entry - Named { name: String }, - /// Auto-generated entry (created by import expression) - Dynamic, - /// A lazy-loaded shared library - Lib { name: String }, -} - -/// Built bundle -#[derive(Debug)] -pub struct Bundle { - pub kind: BundleKind, - pub id: ModuleId, - /// Merged module. - pub module: Module, -} - -pub struct Bundler<'a, L, R> -where - L: Load, - R: Resolve, -{ - config: Config, - - unresolved_mark: Mark, - - globals: &'a Globals, - cm: Lrc, - loader: L, - resolver: R, - - _helper_ctxt: SyntaxContext, - /// Used to mark nodes as synthesized. - /// - /// We can check if a span is a dummy for now, but in future we may improve - /// spans. - synthesized_ctxt: SyntaxContext, - - /// Used to mark a variable declaration as injected. - pub(crate) injected_ctxt: SyntaxContext, - - scope: Scope, - - hook: Box, -} - -impl<'a, L, R> Bundler<'a, L, R> -where - L: Load, - R: Resolve, -{ - pub fn new( - globals: &'a Globals, - cm: Lrc, - loader: L, - resolver: R, - config: Config, - hook: Box, - ) -> Self { - GLOBALS.set(globals, || { - let helper_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())); - tracing::debug!("Helper ctxt: {:?}", helper_ctxt); - let synthesized_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())); - tracing::debug!("Synthesized ctxt: {:?}", synthesized_ctxt); - let injected_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())); - tracing::debug!("Injected ctxt: {:?}", injected_ctxt); - - Bundler { - config, - globals, - cm, - loader, - resolver, - _helper_ctxt: helper_ctxt, - synthesized_ctxt, - injected_ctxt, - scope: Default::default(), - hook, - unresolved_mark: Mark::new(), - } - }) - } - - pub(crate) fn is_external(&self, src: &Atom) -> bool { - self.config.external_modules.iter().any(|v| v == src) - } - - /// - /// - /// - /// Note: This method will panic if entries references each other in - /// circular manner. However, it applies only to the provided `entries`, and - /// dependencies with circular reference is ok. - pub fn bundle(&mut self, entries: HashMap) -> Result, Error> { - let results = entries - .into_iter() - .map(|(name, path)| -> Result<_, Error> { - let path = match path { - FileName::Real(path) => { - if cfg!(target_os = "windows") { - let path = path - .canonicalize() - .context("failed to canonicalize entry")?; - FileName::Real(path) - } else { - FileName::Real(path) - } - } - _ => path, - }; - - let res = self - .load_transformed(&path) - .context("load_transformed failed")?; - Ok((name, res)) - }) - .collect::>(); - - // We collect at here to handle dynamic imports - // TODO: Handle dynamic imports - - let local = { - let mut output = FxHashMap::default(); - - for res in results { - let (name, m) = res?; - let m = m.unwrap(); - - output.insert(name, m); - } - - output - }; - - let bundles = self.chunk(local)?; - - let bundles = self.finalize(bundles, self.unresolved_mark)?; - - #[cfg(feature = "concurrent")] - { - let scope = std::mem::take(&mut self.scope); - rayon::spawn(move || drop(scope)) - } - - Ok(bundles) - } - - /// Sets `swc_common::GLOBALS` - #[inline] - fn run(&self, op: F) -> Ret - where - F: FnOnce() -> Ret, - { - GLOBALS.set(self.globals, op) - } -} diff --git a/crates/swc_bundler/src/bundler/optimize.rs b/crates/swc_bundler/src/bundler/optimize.rs deleted file mode 100644 index f72a30e49359..000000000000 --- a/crates/swc_bundler/src/bundler/optimize.rs +++ /dev/null @@ -1,37 +0,0 @@ -use swc_common::pass::Repeat; -use swc_ecma_ast::*; -use swc_ecma_transforms_optimization::simplify::{const_propagation::constant_propagation, dce}; -use swc_ecma_visit::VisitMutWith; - -use crate::{Bundler, Load, Resolve}; - -impl Bundler<'_, L, R> -where - L: Load, - R: Resolve, -{ - /// If used_exports is [None], all exports are treated as exported. - /// - /// Note: Context of used_exports is ignored, as the specifiers comes from - /// other module. - pub(super) fn optimize(&self, mut node: Module) -> Module { - self.run(|| { - if !self.config.disable_inliner { - node.visit_mut_with(&mut constant_propagation()) - } - if !self.config.disable_dce { - node.visit_mut_with(&mut Repeat::new(dce::dce( - dce::Config { - // TODO(kdy1): Apply mark to wrapped esms and use it at here. - module_mark: None, - top_level: true, - top_retain: Default::default(), - preserve_imports_with_side_effects: true, - }, - self.unresolved_mark, - ))); - } - node - }) - } -} diff --git a/crates/swc_bundler/src/bundler/scope.rs b/crates/swc_bundler/src/bundler/scope.rs deleted file mode 100644 index 18ef803099a4..000000000000 --- a/crates/swc_bundler/src/bundler/scope.rs +++ /dev/null @@ -1,93 +0,0 @@ -use std::sync::atomic::{AtomicBool, Ordering}; - -use swc_atoms::atom; -use swc_common::{sync::Lrc, FileName}; - -use super::load::TransformedModule; -use crate::{ - id::{Id, ModuleId, ModuleIdGenerator}, - util::CloneMap, -}; - -#[derive(Debug, Default)] -pub(super) struct Scope { - pub module_id_gen: ModuleIdGenerator, - - loaded_modules: CloneMap, - - /// Cached after applying basic transformations. - transformed_modules: CloneMap, - - accessed_with_computed_key: CloneMap>, - is_cjs: CloneMap>, -} - -impl Scope { - pub fn mark_as_loaded(&self, id: ModuleId) { - self.loaded_modules.insert(id, ()); - } - - /// Stores module information. The information should contain only - /// information gotten from module itself. In other words, it should not - /// contains information from a dependency. - pub fn store_module(&self, info: TransformedModule) { - self.transformed_modules.insert(info.id, info); - } - - pub fn get_module_by_path(&self, file_name: &FileName) -> Option { - let (id, _, _) = self.module_id_gen.gen(file_name); - self.get_module(id) - } - - pub fn get_module(&self, id: ModuleId) -> Option { - self.transformed_modules.get(&id) - } - - pub fn is_cjs(&self, id: ModuleId) -> bool { - if let Some(v) = self.is_cjs.get(&id) { - v.load(Ordering::SeqCst) - } else { - false - } - } - - /// Set the module as a common js module - pub fn mark_as_cjs(&self, id: ModuleId) { - if let Some(v) = self.is_cjs.get(&id) { - v.store(true, Ordering::SeqCst); - return; - } - - self.is_cjs.insert(id, Lrc::new(AtomicBool::from(true))); - } - - /// Set the module as - pub fn mark_as_wrapping_required(&self, id: ModuleId) { - if let Some(v) = self.accessed_with_computed_key.get(&id) { - v.store(true, Ordering::SeqCst); - return; - } - - self.accessed_with_computed_key - .insert(id, Lrc::new(AtomicBool::from(true))); - } - - pub fn should_be_wrapped_with_a_fn(&self, id: ModuleId) -> bool { - if let Some(v) = self.accessed_with_computed_key.get(&id) { - v.load(Ordering::SeqCst) - } else { - false - } - } - - /// Returns `Some(module_ident)` if the module should be wrapped - /// with a function. - pub fn wrapped_esm_id(&self, id: ModuleId) -> Option { - if !self.should_be_wrapped_with_a_fn(id) { - return None; - } - let info = self.get_module(id)?; - - Some(Id::new(atom!("mod"), info.export_ctxt())) - } -} diff --git a/crates/swc_bundler/src/bundler/tests.rs b/crates/swc_bundler/src/bundler/tests.rs deleted file mode 100644 index 7fe8e7250470..000000000000 --- a/crates/swc_bundler/src/bundler/tests.rs +++ /dev/null @@ -1,178 +0,0 @@ -//! Utilities for testing. -use std::path::PathBuf; - -use anyhow::Error; -use indexmap::IndexMap; -use rustc_hash::FxBuildHasher; -use swc_common::{sync::Lrc, FileName, SourceMap, Span, GLOBALS}; -use swc_ecma_ast::*; -use swc_ecma_loader::resolve::Resolution; -use swc_ecma_parser::{lexer::Lexer, Parser, StringInput}; -use swc_ecma_utils::drop_span; -use swc_ecma_visit::VisitMutWith; - -use super::{load::TransformedModule, Bundler, Config}; -use crate::{load::ModuleData, util::HygieneRemover, Load, ModuleRecord, Resolve}; - -pub(crate) struct Tester<'a> { - pub cm: Lrc, - pub bundler: Bundler<'a, Loader, Resolver>, -} - -pub struct Loader { - cm: Lrc, - files: IndexMap, -} - -impl Load for Loader { - fn load(&self, f: &FileName) -> Result { - eprintln!("load: {f}"); - let v = self.files.get(&f.to_string()); - let v = v.unwrap(); - - let fm = self.cm.new_source_file(f.clone().into(), v.to_string()); - - let lexer = Lexer::new( - Default::default(), - EsVersion::Es2020, - StringInput::from(&*fm), - None, - ); - - let mut parser = Parser::new_from(lexer); - let module = parser.parse_module().unwrap(); - - Ok(ModuleData { - fm, - module, - helpers: Default::default(), - }) - } -} - -#[derive(Debug, Default)] -pub struct Resolver; - -impl Resolve for Resolver { - fn resolve(&self, _: &FileName, s: &str) -> Result { - assert!(s.starts_with("./")); - - let path = PathBuf::from(s.to_string()) - .with_extension("js") - .strip_prefix("./") - .unwrap() - .into(); - - Ok(Resolution { - filename: FileName::Real(path), - slug: None, - }) - } -} - -impl Tester<'_> { - pub fn module(&self, name: &str) -> TransformedModule { - self.bundler - .scope - .get_module_by_path(&FileName::Real(name.to_string().into())) - .unwrap_or_else(|| panic!("failed to find module named {name}")) - } - - #[allow(dead_code)] - pub fn parse(&self, s: &str) -> Module { - let fm = self.cm.new_source_file( - FileName::Real(PathBuf::from("input.js")).into(), - s.to_string(), - ); - - let lexer = Lexer::new( - Default::default(), - Default::default(), - StringInput::from(&*fm), - None, - ); - let mut parser = Parser::new_from(lexer); - parser.parse_module().unwrap() - } - - #[allow(dead_code)] - pub fn assert_eq(&self, m: &Module, expected: &str) { - let expected = self.parse(expected); - - let mut m = m.clone(); - m.visit_mut_with(&mut HygieneRemover); - - let m = drop_span(m); - let expected = drop_span(expected); - - assert_eq!(m, expected) - } -} -pub(crate) fn suite() -> TestBuilder { - TestBuilder::default() -} - -#[derive(Default)] -pub(crate) struct TestBuilder { - files: IndexMap, -} - -impl TestBuilder { - pub fn file(mut self, name: &str, src: &str) -> Self { - self.files.insert(name.to_string(), src.to_string()); - self - } - - pub fn run(self, op: F) - where - F: FnOnce(&mut Tester) -> Result<(), Error>, - { - testing::run_test2(true, |cm, _| { - GLOBALS.with(|globals| { - let bundler = Bundler::new( - globals, - cm.clone(), - Loader { - cm: cm.clone(), - files: self.files.clone(), - }, - Default::default(), - Config { - require: true, - disable_inliner: true, - disable_hygiene: false, - disable_fixer: false, - disable_dce: false, - external_modules: Vec::new(), - module: Default::default(), - }, - Box::new(Hook), - ); - - for (name, _) in self.files { - bundler - .load_transformed(&FileName::Real(name.clone().into())) - .unwrap(); - } - - let mut t = Tester { - cm: cm.clone(), - bundler, - }; - - op(&mut t).unwrap(); - - Ok(()) - }) - }) - .expect("WTF?"); - } -} - -struct Hook; - -impl crate::Hook for Hook { - fn get_import_meta_props(&self, _: Span, _: &ModuleRecord) -> Result, Error> { - unreachable!() - } -} diff --git a/crates/swc_bundler/src/debug/mod.rs b/crates/swc_bundler/src/debug/mod.rs deleted file mode 100644 index 177bb6974b02..000000000000 --- a/crates/swc_bundler/src/debug/mod.rs +++ /dev/null @@ -1,46 +0,0 @@ -#![allow(dead_code)] - -use std::io::{stderr, Write}; - -use swc_common::{sync::Lrc, SourceMap, SyntaxContext}; -use swc_ecma_ast::{Ident, Module}; -use swc_ecma_codegen::{text_writer::JsWriter, Emitter}; -use swc_ecma_visit::{noop_fold_type, Fold, FoldWith}; - -#[cfg(not(debug_assertions))] -pub(crate) fn print_hygiene(_: &str, _: &Lrc, _: &Module) {} - -#[cfg(debug_assertions)] -pub(crate) fn print_hygiene(event: &str, cm: &Lrc, t: &Module) { - let module = t.clone().fold_with(&mut HygieneVisualizer); - - let stdout = stderr(); - let mut w = stdout.lock(); - - writeln!(w, "==================== @ {event} ====================").unwrap(); - Emitter { - cfg: swc_ecma_codegen::Config::default(), - cm: cm.clone(), - comments: None, - wr: Box::new(JsWriter::new(cm.clone(), "\n", &mut w, None)), - } - .emit_module(&module) - .unwrap(); - writeln!(w, "==================== @ ====================").unwrap(); -} - -struct HygieneVisualizer; - -impl Fold for HygieneVisualizer { - noop_fold_type!(); - - fn fold_ident(&mut self, node: Ident) -> Ident { - if node.ctxt == SyntaxContext::empty() { - return node; - } - Ident { - sym: format!("{}{:?}", node.sym, node.ctxt).into(), - ..node - } - } -} diff --git a/crates/swc_bundler/src/dep_graph.rs b/crates/swc_bundler/src/dep_graph.rs deleted file mode 100644 index e88a975bca8f..000000000000 --- a/crates/swc_bundler/src/dep_graph.rs +++ /dev/null @@ -1,6 +0,0 @@ -use petgraph::{prelude::GraphMap, Directed}; -use rustc_hash::FxBuildHasher; - -use crate::ModuleId; - -pub(crate) type ModuleGraph = GraphMap; diff --git a/crates/swc_bundler/src/hash.rs b/crates/swc_bundler/src/hash.rs deleted file mode 100644 index 754a45f8c836..000000000000 --- a/crates/swc_bundler/src/hash.rs +++ /dev/null @@ -1,138 +0,0 @@ -use std::io; - -use anyhow::{Context, Error}; -use crc::{Crc, Digest, CRC_64_ECMA_182}; -use swc_common::{sync::Lrc, BytePos, SourceMap, Span}; -use swc_ecma_ast::Module; -use swc_ecma_codegen::{text_writer::WriteJs, Emitter}; - -pub(crate) fn calc_hash(cm: Lrc, m: &Module) -> Result { - let crc = Crc::::new(&CRC_64_ECMA_182); - let digest = crc.digest(); - let mut buf = Hasher { digest }; - - { - let mut emitter = Emitter { - cfg: Default::default(), - cm, - comments: None, - wr: Box::new(&mut buf) as Box, - }; - - emitter - .emit_module(m) - .context("failed to emit module to calculate hash")?; - } - // - - let result = buf.digest.finalize(); - Ok(radix_fmt::radix(result, 36).to_string()) -} - -struct Hasher<'a> { - digest: Digest<'a, u64>, -} - -impl Hasher<'_> { - fn w(&mut self, s: &str) { - self.digest.update(s.as_bytes()); - } -} - -impl WriteJs for &mut Hasher<'_> { - fn increase_indent(&mut self) -> io::Result<()> { - Ok(()) - } - - fn decrease_indent(&mut self) -> io::Result<()> { - Ok(()) - } - - fn write_semi(&mut self, _: Option) -> io::Result<()> { - self.w(";"); - Ok(()) - } - - fn write_space(&mut self) -> io::Result<()> { - self.w(" "); - Ok(()) - } - - fn write_keyword(&mut self, _: Option, s: &'static str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_operator(&mut self, _: Option, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_param(&mut self, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_property(&mut self, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_line(&mut self) -> io::Result<()> { - self.w("\n"); - Ok(()) - } - - fn write_lit(&mut self, _: Span, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_comment(&mut self, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_str_lit(&mut self, _: Span, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_str(&mut self, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_symbol(&mut self, _: Span, s: &str) -> io::Result<()> { - self.w(s); - Ok(()) - } - - fn write_punct( - &mut self, - _: Option, - s: &'static str, - _commit_pending_semi: bool, - ) -> io::Result<()> { - self.w(s); - Ok(()) - } - - #[inline] - fn care_about_srcmap(&self) -> bool { - false - } - - #[inline] - fn add_srcmap(&mut self, _: BytePos) -> io::Result<()> { - Ok(()) - } - - fn commit_pending_semi(&mut self) -> io::Result<()> { - Ok(()) - } - - fn can_ignore_invalid_unicodes(&mut self) -> bool { - true - } -} diff --git a/crates/swc_bundler/src/hook.rs b/crates/swc_bundler/src/hook.rs deleted file mode 100644 index 56e8aba80790..000000000000 --- a/crates/swc_bundler/src/hook.rs +++ /dev/null @@ -1,17 +0,0 @@ -use anyhow::Error; -use swc_common::{FileName, Span}; -use swc_ecma_ast::KeyValueProp; - -#[non_exhaustive] -pub struct ModuleRecord { - pub file_name: FileName, - pub is_entry: bool, -} - -pub trait Hook: swc_common::sync::Sync + swc_common::sync::Send { - fn get_import_meta_props( - &self, - span: Span, - module_record: &ModuleRecord, - ) -> Result, Error>; -} diff --git a/crates/swc_bundler/src/id.rs b/crates/swc_bundler/src/id.rs deleted file mode 100644 index ded9b72414c1..000000000000 --- a/crates/swc_bundler/src/id.rs +++ /dev/null @@ -1,133 +0,0 @@ -use std::{ - fmt, - sync::atomic::{AtomicU32, Ordering::SeqCst}, -}; - -use rustc_hash::FxHashMap; -use swc_atoms::Atom; -use swc_common::{sync::Lock, FileName, Mark, SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::{Expr, Ident}; -use swc_ecma_utils::ident::IdentLike; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct ModuleId(u32); - -impl fmt::Display for ModuleId { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(&self.0, f) - } -} - -impl fmt::Debug for ModuleId { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "ModuleId({})", self.0)?; - Ok(()) - } -} - -#[derive(Debug, Default)] -pub(crate) struct ModuleIdGenerator { - v: AtomicU32, - /// `(module_id, local_mark, export_mark)` - cache: Lock>, -} - -impl ModuleIdGenerator { - pub fn gen(&self, file_name: &FileName) -> (ModuleId, Mark, Mark) { - let mut w = self.cache.lock(); - if let Some(v) = w.get(file_name) { - return *v; - } - - let id = ModuleId(self.v.fetch_add(1, SeqCst)); - let local_mark = Mark::fresh(Mark::root()); - let export_mark = Mark::fresh(Mark::root()); - let v = (id, local_mark, export_mark); - w.insert(file_name.clone(), v); - (id, local_mark, export_mark) - } -} - -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct Id(Atom, SyntaxContext); - -impl fmt::Debug for Id { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}{:?}", self.0, self.1) - } -} - -impl Id { - pub fn new(sym: Atom, ctxt: SyntaxContext) -> Self { - Id(sym, ctxt) - } - - pub fn sym(&self) -> &Atom { - &self.0 - } - - pub fn ctxt(&self) -> SyntaxContext { - self.1 - } - - pub fn into_ident(self) -> Ident { - Ident::new(self.0, DUMMY_SP, self.1) - } - - pub fn with_ctxt(mut self, ctxt: SyntaxContext) -> Self { - self.1 = ctxt; - self - } -} - -impl IdentLike for Id { - fn from_ident(i: &Ident) -> Self { - i.into() - } - - fn to_id(&self) -> (Atom, SyntaxContext) { - (self.0.clone(), self.1) - } - - fn into_id(self) -> (Atom, SyntaxContext) { - (self.0, self.1) - } -} - -impl From for Id { - fn from(i: Ident) -> Self { - Id(i.sym, i.ctxt) - } -} - -impl From<&Ident> for Id { - fn from(i: &Ident) -> Self { - Id(i.sym.clone(), i.ctxt) - } -} - -impl PartialEq for Id { - fn eq(&self, other: &Ident) -> bool { - self.0 == other.sym && self.1 == other.ctxt - } -} - -impl PartialEq for Id { - fn eq(&self, other: &Atom) -> bool { - self.0 == *other - } -} - -impl From for Ident { - #[inline] - fn from(id: Id) -> Self { - id.into_ident() - } -} - -impl From for Expr { - #[inline] - fn from(id: Id) -> Self { - id.into_ident().into() - } -} diff --git a/crates/swc_bundler/src/inline.rs b/crates/swc_bundler/src/inline.rs deleted file mode 100644 index 1d8c6496225e..000000000000 --- a/crates/swc_bundler/src/inline.rs +++ /dev/null @@ -1,173 +0,0 @@ -use rustc_hash::FxHashMap; -use swc_common::{SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_visit::{ - noop_visit_mut_type, noop_visit_type, visit_mut_obj_and_computed, Visit, VisitMut, - VisitMutWith, VisitWith, -}; - -use crate::{id::Id, modules::Modules, util::Readonly}; - -#[derive(Debug, Default)] -pub(crate) struct InlineData { - ids: FxHashMap, -} - -/// Inline **injected** variables. -pub(crate) fn inline(injected_ctxt: SyntaxContext, module: &mut Modules) { - tracing::debug!("Inlining injected variables"); - - let mut data = Default::default(); - - { - let mut analyzer = Analyzer { - injected_ctxt, - data: &mut data, - }; - - module.visit_with(&mut analyzer); - } - - let mut v = Inliner { data: data.into() }; - module.par_visit_mut_with(&mut v); - module.retain_mut(|_, s| !matches!(s, ModuleItem::Stmt(Stmt::Empty(..)))); -} - -#[derive(Debug)] -#[cfg_attr(feature = "concurrent", derive(Clone))] -struct Inliner { - data: Readonly, -} - -struct Analyzer<'a> { - injected_ctxt: SyntaxContext, - data: &'a mut InlineData, -} - -impl Analyzer<'_> { - fn store(&mut self, from: Id, to: Id) { - if let Some(prev) = self.data.ids.insert(from.clone(), to.clone()) { - unreachable!( - "Multiple identifiers equivalent up to span hygiene found: {:#?}\nFirst = \ - {:#?}\nSecond = {:#?}", - from, prev, to - ) - } - } -} - -impl Visit for Analyzer<'_> { - noop_visit_type!(); - - /// Noop - fn visit_module_decl(&mut self, _: &ModuleDecl) {} - - /// Noop. We don't inline variables declared in subscopes. - fn visit_function(&mut self, _: &Function) {} - - /// Noop. We don't inline variables declared in subscopes. - fn visit_block_stmt(&mut self, _: &BlockStmt) {} - - fn visit_var_decl(&mut self, n: &VarDecl) { - if n.ctxt != self.injected_ctxt || n.kind != VarDeclKind::Const { - return; - } - - n.visit_children_with(self); - } - - fn visit_var_declarator(&mut self, n: &VarDeclarator) { - n.visit_children_with(self); - if let (Pat::Ident(from), Some(Expr::Ident(to))) = (&n.name, n.init.as_deref()) { - self.store(from.id.clone().into(), to.into()); - } - } -} - -impl VisitMut for Inliner { - noop_visit_mut_type!(fail); - - visit_mut_obj_and_computed!(); - - /// Don't modify exported ident. - fn visit_mut_export_named_specifier(&mut self, n: &mut ExportNamedSpecifier) { - if n.exported.is_none() { - n.exported = Some(n.orig.clone()); - } - - n.orig.visit_mut_with(self); - } - - fn visit_mut_ident(&mut self, n: &mut Ident) { - if let Some(mapped) = self.data.ids.get(&n.clone().into()).cloned() { - *n = mapped.into(); - n.visit_mut_with(self); - } - } - - fn visit_mut_module_items(&mut self, n: &mut Vec) { - n.visit_mut_children_with(self); - - n.retain(|v| !matches!(v, ModuleItem::Stmt(Stmt::Empty(..)))); - } - - fn visit_mut_prop(&mut self, n: &mut Prop) { - match n { - Prop::Shorthand(i) => { - let orig = i.clone(); - i.visit_mut_with(self); - if i.ctxt == orig.ctxt { - return; - } - if i.sym != orig.sym { - *n = Prop::KeyValue(KeyValueProp { - key: PropName::Ident(orig.into()), - value: i.clone().into(), - }); - } - } - _ => { - n.visit_mut_children_with(self); - } - } - } - - fn visit_mut_prop_name(&mut self, n: &mut PropName) { - match n { - PropName::Ident(_) => {} - PropName::Str(_) => {} - PropName::Num(_) => {} - PropName::Computed(e) => { - e.expr.visit_mut_with(self); - } - PropName::BigInt(_) => {} - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - } - - fn visit_mut_stmt(&mut self, n: &mut Stmt) { - n.visit_mut_children_with(self); - - match n { - Stmt::Decl(Decl::Var(var)) if var.decls.is_empty() => { - *n = EmptyStmt { span: DUMMY_SP }.into(); - } - _ => {} - } - } - - fn visit_mut_var_declarators(&mut self, n: &mut Vec) { - n.retain(|d| { - if let Pat::Ident(name) = &d.name { - if self.data.ids.contains_key(&name.id.clone().into()) { - return false; - } - } - - true - }); - - n.visit_mut_children_with(self); - } -} diff --git a/crates/swc_bundler/src/lib.rs b/crates/swc_bundler/src/lib.rs deleted file mode 100644 index 2df47112ff39..000000000000 --- a/crates/swc_bundler/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![deny(clippy::all)] -#![allow(unstable_name_collisions)] -#![allow(clippy::mutable_key_type)] -#![cfg_attr(not(test), allow(unused))] - -pub use self::{ - bundler::{Bundle, BundleKind, Bundler, Config, ModuleType}, - hook::{Hook, ModuleRecord}, - id::ModuleId, - load::{Load, ModuleData}, - resolve::Resolve, -}; - -mod bundler; -mod debug; -mod dep_graph; -mod hash; -mod hook; -mod id; -mod inline; -mod load; -mod modules; -mod resolve; -mod util; diff --git a/crates/swc_bundler/src/load.rs b/crates/swc_bundler/src/load.rs deleted file mode 100644 index d42a8cbc2c71..000000000000 --- a/crates/swc_bundler/src/load.rs +++ /dev/null @@ -1,56 +0,0 @@ -use anyhow::Error; -use swc_common::{sync::Lrc, FileName, SourceFile}; -use swc_ecma_ast::Module; -use swc_ecma_transforms_base::helpers::Helpers; - -#[derive(Debug)] -pub struct ModuleData { - pub fm: Lrc, - pub module: Module, - /// Used helpers - /// - /// # Example - /// - /// ```rust,ignore - /// - /// impl Load for Loader { - /// fn load(&self, name: &FileName) -> Result { - /// let helpers = Helpers::new(false); - /// let fm = self.load_file(name)?; - /// let module = self.parse(fm.clone())?; - /// - /// let module = helpers::HELPERS.set(&helpers, || { - /// // Apply transforms (like decorators pass) - /// module - /// }); - /// - /// Ok(ModuleData { fm, module, helpers }) - /// } - /// } - /// ``` - pub helpers: Helpers, -} - -/// Responsible for providing files to the bundler. -/// -/// Note: Resolve and Load are separate trait because multiple module can depend -/// on a single module. Due to the possibility of 'common' module, bundler -/// should implement some caching. The bundler uses [FileName] as a key of the -/// cache. -/// -/// This trait is designed to allow passing pre-parsed module. -pub trait Load: swc_common::sync::Send + swc_common::sync::Sync { - fn load(&self, file: &FileName) -> Result; -} - -impl Load for Box { - fn load(&self, file: &FileName) -> Result { - (**self).load(file) - } -} - -impl Load for &T { - fn load(&self, file: &FileName) -> Result { - (**self).load(file) - } -} diff --git a/crates/swc_bundler/src/modules/mod.rs b/crates/swc_bundler/src/modules/mod.rs deleted file mode 100644 index 3084d25d43b6..000000000000 --- a/crates/swc_bundler/src/modules/mod.rs +++ /dev/null @@ -1,311 +0,0 @@ -use std::mem::take; - -use rustc_hash::FxHashMap; -use swc_common::{SourceMap, SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_visit::{Fold, FoldWith, Visit, VisitMut, VisitMutWith, VisitWith}; - -use crate::ModuleId; - -mod sort; - -#[derive(Debug, Clone)] -pub struct Modules { - /// Indicates that a statement is injected. - /// - /// Note: This context should be shared for a bundle. - pub(crate) injected_ctxt: SyntaxContext, - - // We will change this into `Vec`. - modules: Vec<(ModuleId, Module)>, - prepended_stmts: FxHashMap>, - appended_stmts: FxHashMap>, -} - -impl Modules { - pub fn empty(injected_ctxt: SyntaxContext) -> Self { - Self { - injected_ctxt, - modules: Default::default(), - prepended_stmts: Default::default(), - appended_stmts: Default::default(), - } - } - - pub fn from(id: ModuleId, module: Module, injected_ctxt: SyntaxContext) -> Self { - let mut ret = Self::empty(injected_ctxt); - ret.modules.push((id, module)); - ret - } - - fn into_items(self) -> Vec { - debug_assert!( - self.prepended_stmts.is_empty(), - "sort should be called before calling into_items" - ); - debug_assert!( - self.appended_stmts.is_empty(), - "sort should be called before calling into_items" - ); - self.modules.into_iter().flat_map(|v| v.1.body).collect() - } - - pub fn add_dep(&mut self, dep: Modules) { - self.push_all(dep) - } - - pub fn push_all(&mut self, other: Modules) { - for (id, stmts) in other.prepended_stmts { - self.prepended_stmts.entry(id).or_default().extend(stmts); - } - - for (id, stmts) in other.appended_stmts { - self.appended_stmts.entry(id).or_default().extend(stmts); - } - - for (id, module) in other.modules { - if let Some(prev) = self.modules.iter_mut().find(|prev| prev.0 == id) { - prev.1.body.extend(module.body); - } else { - self.modules.push((id, module)); - } - } - } - - pub fn iter(&self) -> impl Iterator { - self.prepended_stmts - .iter() - .flat_map(|(id, stmts)| stmts.iter().map(move |stmt| (*id, stmt))) - .chain( - self.modules - .iter() - .flat_map(|(id, m)| m.body.iter().map(move |v| (*id, v))), - ) - .chain( - self.appended_stmts - .iter() - .flat_map(|(id, stmts)| stmts.iter().map(move |stmt| (*id, stmt))), - ) - } - - pub fn iter_mut(&mut self) -> impl Iterator { - self.prepended_stmts - .iter_mut() - .flat_map(|(id, stmts)| stmts.iter_mut().map(move |stmt| (*id, stmt))) - .chain( - self.modules - .iter_mut() - .flat_map(|(id, m)| m.body.iter_mut().map(move |v| (*id, v))), - ) - .chain( - self.appended_stmts - .iter_mut() - .flat_map(|(id, stmts)| stmts.iter_mut().map(move |stmt| (*id, stmt))), - ) - } - - pub fn map_any_items(&mut self, mut op: F) - where - F: FnMut(ModuleId, Vec) -> Vec, - { - let p = take(&mut self.prepended_stmts); - self.prepended_stmts = p - .into_iter() - .map(|(id, items)| (id, op(id, items))) - .collect(); - - self.modules = take(&mut self.modules) - .into_iter() - .map(|mut m| { - let body = op(m.0, take(&mut m.1.body)); - - (m.0, Module { body, ..m.1 }) - }) - .collect(); - - let a = take(&mut self.appended_stmts); - self.appended_stmts = a - .into_iter() - .map(|(id, items)| (id, op(id, items))) - .collect(); - } - - pub fn map_items_mut(&mut self, mut op: F) - where - F: FnMut(ModuleId, &mut ModuleItem), - { - self.iter_mut().for_each(|(id, item)| op(id, item)) - } - - pub fn append_all(&mut self, items: impl IntoIterator) { - for v in items { - self.append(v.0, v.1); - } - } - - pub fn append(&mut self, module_id: ModuleId, item: ModuleItem) { - self.appended_stmts.entry(module_id).or_default().push(item); - } - - pub fn prepend(&mut self, module_id: ModuleId, item: ModuleItem) { - self.prepended_stmts - .entry(module_id) - .or_default() - .push(item); - } - - #[cfg(not(feature = "concurrent"))] - pub(crate) fn par_visit_mut_with(&mut self, v: &mut V) - where - V: VisitMut, - { - self.visit_mut_with(v) - } - - #[cfg(feature = "concurrent")] - pub(crate) fn par_visit_mut_with(&mut self, v: &mut V) - where - V: Clone + VisitMut + Send + Sync, - { - use rayon::prelude::*; - - let pre = &mut self.prepended_stmts; - let modules = &mut self.modules; - let app = &mut self.appended_stmts; - - rayon::scope(|s| { - s.spawn(|_| { - pre.par_iter_mut() - .for_each(|(_, stmts)| stmts.visit_mut_with(&mut v.clone())); - }); - - s.spawn(|_| { - modules - .par_iter_mut() - .for_each(|(_, stmts)| stmts.visit_mut_with(&mut v.clone())); - }); - - s.spawn(|_| { - app.par_iter_mut() - .for_each(|(_, stmts)| stmts.visit_mut_with(&mut v.clone())); - }); - }); - } - - pub fn visit_mut_with(&mut self, v: &mut V) - where - V: VisitMut, - { - self.iter_mut().for_each(|item| item.1.visit_mut_with(v)); - } - - pub fn fold_with(mut self, v: &mut V) -> Self - where - V: Fold, - { - self.prepended_stmts = self - .prepended_stmts - .into_iter() - .map(|(id, items)| (id, items.fold_with(&mut *v))) - .collect(); - self.modules = self - .modules - .into_iter() - .map(|m| (m.0, m.1.fold_with(&mut *v))) - .collect(); - - self.appended_stmts = self - .appended_stmts - .into_iter() - .map(|(id, items)| (id, items.fold_with(&mut *v))) - .collect(); - - self - } - - pub fn visit_with(&self, v: &mut V) - where - V: Visit, - { - self.iter().for_each(|item| item.1.visit_with(v)); - } - - pub fn retain_mut(&mut self, mut op: F) - where - F: FnMut(ModuleId, &mut ModuleItem) -> bool, - { - self.prepended_stmts - .iter_mut() - .for_each(|(id, v)| v.retain_mut(|item| op(*id, item))); - - for module in &mut self.modules { - let id = module.0; - module.1.body.retain_mut(|item| op(id, item)); - } - - self.appended_stmts - .iter_mut() - .for_each(|(id, v)| v.retain_mut(|item| op(*id, item))); - } - - #[allow(unused)] - #[cfg(debug_assertions)] - pub(crate) fn print( - &self, - cm: &swc_common::sync::Lrc, - event: impl std::fmt::Display, - ) { - let files = self - .modules - .iter() - .map(|(_, m)| m.span) - .filter_map(|module_span| { - if module_span.is_dummy() { - return None; - } - Some(format!("{}\n", cm.lookup_source_file(module_span.lo).name)) - }) - .collect::(); - let mut cloned = self.clone(); - let mut stmts = Vec::new(); - - for (id, mut module) in cloned.modules { - swc_ecma_utils::prepend_stmts( - &mut module.body, - cloned - .prepended_stmts - .get(&id) - .cloned() - .unwrap_or_default() - .into_iter(), - ); - - module - .body - .extend(cloned.appended_stmts.get(&id).cloned().unwrap_or_default()); - - stmts.extend(module.body); - } - - crate::debug::print_hygiene( - &format!("{event}\n{files}"), - cm, - &Module { - span: DUMMY_SP, - body: stmts, - shebang: None, - }, - ); - } -} - -impl From for Module { - fn from(modules: Modules) -> Self { - // TODO - Self { - span: DUMMY_SP, - body: modules.into_items(), - shebang: None, - } - } -} diff --git a/crates/swc_bundler/src/modules/sort/chunk.rs b/crates/swc_bundler/src/modules/sort/chunk.rs deleted file mode 100644 index d1ede6dd8ff8..000000000000 --- a/crates/swc_bundler/src/modules/sort/chunk.rs +++ /dev/null @@ -1,243 +0,0 @@ -use std::{collections::VecDeque, iter::from_fn, mem::take, time::Instant}; - -use indexmap::IndexSet; -use petgraph::EdgeDirection::Outgoing; -use rustc_hash::{FxBuildHasher, FxHashSet}; -use swc_common::{sync::Lrc, SourceMap, SyntaxContext}; -use swc_ecma_ast::*; -use swc_ecma_utils::prepend_stmts; - -use super::stmt::sort_stmts; -use crate::{dep_graph::ModuleGraph, modules::Modules, ModuleId}; - -/// The unit of sorting. -#[derive(Debug)] -pub(super) struct Chunk { - pub stmts: Vec, -} - -impl Modules { - /// Modules with circular import relations will be in same chunk. - #[allow(clippy::ptr_arg)] - pub(super) fn take_chunks( - &mut self, - entry_id: ModuleId, - graph: &ModuleGraph, - cycle: &Vec>, - cm: &Lrc, - ) -> Vec { - let injected_ctxt = self.injected_ctxt; - let mut chunks = Vec::new(); - - let mut modules = take(&mut self.modules); - - for (id, module) in &mut modules { - if let Some(prepended) = self.prepended_stmts.remove(&*id) { - prepend_stmts(&mut module.body, prepended.into_iter()); - } - - if let Some(items) = self.appended_stmts.remove(&*id) { - module.body.extend(items); - } - } - - chunks.extend(toposort_real_modules( - injected_ctxt, - modules, - entry_id, - graph, - cycle, - cm, - )); - - chunks - } -} - -/// Sort items topologically, while merging cycles as a -fn toposort_real_modules<'a>( - injected_ctxt: SyntaxContext, - mut modules: Vec<(ModuleId, Module)>, - entry: ModuleId, - graph: &'a ModuleGraph, - cycles: &'a [Vec], - cm: &Lrc, -) -> Vec { - let mut queue = modules.iter().map(|v| v.0).collect::>(); - queue.push_front(entry); - - let mut chunks = Vec::new(); - - tracing::debug!( - "Topologically sorting modules based on the dependency graph: ({} items)", - modules.len() - ); - - #[cfg(not(target_arch = "wasm32"))] - let start = Instant::now(); - let sorted_ids = toposort_real_module_ids(queue, graph, cycles).collect::>(); - #[cfg(not(target_arch = "wasm32"))] - let end = Instant::now(); - #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Toposort of module ids took {:?}", end - start); - for ids in sorted_ids { - if ids.is_empty() { - continue; - } - - let mut stmts = Vec::new(); - - for id in ids.iter().copied().rev() { - if let Some((_, module)) = modules.iter_mut().find(|(module_id, _)| *module_id == id) { - module - .body - .retain(|item| !matches!(item, ModuleItem::Stmt(Stmt::Empty(..)))); - if module.body.is_empty() { - continue; - } - - stmts.push(take(&mut module.body)); - } - } - - if stmts.is_empty() { - continue; - } - - // Skip sorting statements if there is no import. - if ids.len() == 1 && graph.neighbors_directed(ids[0], Outgoing).count() == 0 { - chunks.push(Chunk { - stmts: stmts.into_iter().next().unwrap(), - }); - continue; - } - - let stmts = sort_stmts(injected_ctxt, stmts, cm); - - // print_hygiene( - // &format!("after sort: {:?}", ids), - // cm, - // &Module { - // span: DUMMY_SP, - // body: stmts.clone(), - // shebang: None, - // }, - // ); - - chunks.push(Chunk { stmts }) - } - - chunks -} - -fn cycles_for( - cycles: &[Vec], - id: ModuleId, - checked: &mut Vec, -) -> IndexSet { - checked.push(id); - let mut v = cycles - .iter() - .filter(|v| v.contains(&id)) - .flatten() - .copied() - .collect::>(); - - let ids = v.clone(); - - for added in ids { - if checked.contains(&added) { - continue; - } - v.extend(cycles_for(cycles, added, checked)); - } - - v -} - -fn toposort_real_module_ids<'a>( - mut queue: VecDeque, - graph: &'a ModuleGraph, - cycles: &'a [Vec], -) -> impl 'a + Iterator> { - let mut done = FxHashSet::::default(); - let mut errorred = FxHashSet::::default(); - - from_fn(move || { - while let Some(id) = queue.pop_front() { - if done.contains(&id) { - continue; - } - - // dbg!(id); - - let deps = graph - .neighbors_directed(id, Outgoing) - .filter(|dep| !done.contains(dep)) - .collect::>(); - - if deps.is_empty() { - // TODO: Add dependants - - // Emit - done.insert(id); - errorred.clear(); - return Some(vec![id]); - } - - // dbg!(&deps); - - let mut all_modules_in_circle = cycles_for(cycles, id, &mut Default::default()); - all_modules_in_circle.reverse(); - - // dbg!(&all_modules_in_circle); - - if all_modules_in_circle.is_empty() { - queue.push_front(id); - - // This module does not have any circular imports. - for dep in deps.iter().copied().rev() { - queue.push_front(dep); - } - - continue; - } - - // We need to handle dependencies of all circular modules. - let deps_of_circle = all_modules_in_circle - .iter() - .flat_map(|&id| { - graph - .neighbors_directed(id, Outgoing) - .filter(|dep| !done.contains(dep) && !all_modules_in_circle.contains(dep)) - }) - .collect::>(); - - // dbg!(&deps_of_circle); - - if !deps_of_circle.is_empty() { - if errorred.insert(id) { - queue.push_front(id); - - // Handle dependencies first. - for dep in deps_of_circle.iter().copied().rev() { - queue.push_front(dep); - } - - continue; - } - tracing::info!("Using slow, fallback logic for topological sorting"); - all_modules_in_circle.extend(deps_of_circle); - } - - // TODO: Add dependants - - // Emit - done.extend(all_modules_in_circle.iter().copied()); - errorred.clear(); - return Some(all_modules_in_circle.into_iter().collect()); - } - - None - }) -} diff --git a/crates/swc_bundler/src/modules/sort/graph.rs b/crates/swc_bundler/src/modules/sort/graph.rs deleted file mode 100644 index cb6b231fe6fb..000000000000 --- a/crates/swc_bundler/src/modules/sort/graph.rs +++ /dev/null @@ -1,111 +0,0 @@ -use std::{collections::VecDeque, iter::repeat}; - -use petgraph::{ - prelude::GraphMap, - Directed, - EdgeDirection::{self, Incoming, Outgoing}, -}; -use rustc_hash::{FxBuildHasher, FxHashSet}; - -/// Is dependency between nodes hard? -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub(super) enum Required { - /// Required to evaluate - Always, - - /// Maybe required to evaluate - Maybe, -} - -/// Used to debug petgraph. -#[derive(Debug, Default)] -pub(super) struct StmtDepGraph { - inner: GraphMap, - /// Read-optimized hashset which contains all direct dependencies and - /// transitive dependencies. - paths: Vec>, -} - -impl StmtDepGraph { - pub fn node_count(&self) -> usize { - self.inner.node_count() - } - - pub fn add_node(&mut self, node: usize) { - self.inner.add_node(node); - } - - pub fn remove_node(&mut self, node: usize) { - self.inner.add_node(node); - } - - pub fn add_edge(&mut self, a: usize, b: usize, required: Required) { - self.inner.add_edge(a, b, required); - - self.insert_transitives(a, b); - } - - fn calc_transitives(&self, id: usize, dir: EdgeDirection) -> FxHashSet { - let mut set = FxHashSet::default(); - - let mut queue = VecDeque::default(); - queue.push_front(id); - - while let Some(id) = queue.pop_front() { - // Already processed - if !set.insert(id) { - continue; - } - - for transitive in self.inner.neighbors_directed(id, dir) { - queue.push_back(transitive); - } - } - - set - } - - fn insert_transitives(&mut self, from: usize, to: usize) { - if self.paths.len() <= from { - self.paths - .extend(repeat(Default::default()).take(from + 1 - self.paths.len())) - } - if !self.paths[from].insert(to) { - return; - } - - for transitive in self.calc_transitives(to, Outgoing) { - if from == transitive { - continue; - } - self.paths[from].insert(transitive); - } - - for transitive in self.calc_transitives(from, Incoming) { - if to == transitive { - continue; - } - - self.paths[transitive].insert(to); - } - } - - pub fn edge_weight(&self, a: usize, b: usize) -> Option { - self.inner.edge_weight(a, b).cloned() - } - - pub fn neighbors_directed( - &self, - start: usize, - dir: EdgeDirection, - ) -> impl '_ + Iterator { - self.inner.neighbors_directed(start, dir) - } - - pub fn has_a_path(&self, from: usize, to: usize) -> bool { - match self.paths.get(from) { - Some(ps) => ps.contains(&to), - None => false, - } - } -} diff --git a/crates/swc_bundler/src/modules/sort/mod.rs b/crates/swc_bundler/src/modules/sort/mod.rs deleted file mode 100644 index 5efc9b9a0658..000000000000 --- a/crates/swc_bundler/src/modules/sort/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -use std::time::Instant; - -use swc_common::{sync::Lrc, SourceMap, DUMMY_SP}; -use swc_ecma_ast::*; - -use super::Modules; -use crate::{dep_graph::ModuleGraph, ModuleId}; - -mod chunk; -mod graph; -mod stmt; -#[cfg(test)] -mod tests; - -impl Modules { - /// If module graph proves that one module can com before other module, it - /// will be simply injected. If it is not the case, we will consider the - /// dependency between statements. - /// - /// TODO: Change this to return [Module]. - #[allow(clippy::ptr_arg)] - pub fn sort( - &mut self, - entry_id: ModuleId, - module_graph: &ModuleGraph, - cycles: &Vec>, - cm: &Lrc, - ) { - tracing::debug!("Sorting {:?}", entry_id); - - let injected_ctxt = self.injected_ctxt; - - #[cfg(not(target_arch = "wasm32"))] - let start = Instant::now(); - let chunks = self.take_chunks(entry_id, module_graph, cycles, cm); - #[cfg(not(target_arch = "wasm32"))] - let dur = Instant::now() - start; - #[cfg(not(target_arch = "wasm32"))] - tracing::debug!("Sorting took {:?}", dur); - - let buf = chunks - .into_iter() - .flat_map(|chunk| chunk.stmts) - .collect::>(); - - let module = Module { - span: DUMMY_SP, - body: buf, - shebang: None, - }; - - // print_hygiene("after sort", cm, &module); - - *self = Modules::from(entry_id, module, injected_ctxt); - tracing::debug!("Sorted {:?}", entry_id); - } -} diff --git a/crates/swc_bundler/src/modules/sort/stmt.rs b/crates/swc_bundler/src/modules/sort/stmt.rs deleted file mode 100644 index f3b7366ab667..000000000000 --- a/crates/swc_bundler/src/modules/sort/stmt.rs +++ /dev/null @@ -1,1236 +0,0 @@ -use std::{collections::VecDeque, iter::from_fn, ops::Range}; - -use indexmap::IndexSet; -use petgraph::EdgeDirection::{Incoming as Dependants, Outgoing as Dependencies}; -use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet}; -use swc_common::{sync::Lrc, util::take::Take, SourceMap, SyntaxContext}; -use swc_ecma_ast::*; -use swc_ecma_utils::find_pat_ids; -use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; - -use super::graph::Required; -use crate::{id::Id, modules::sort::graph::StmtDepGraph, util::is_injected}; - -pub(super) fn sort_stmts( - injected_ctxt: SyntaxContext, - modules: Vec>, - _cm: &Lrc, -) -> Vec { - let total_len: usize = modules.iter().map(|v| v.len()).sum(); - - let mut stmts = Vec::new(); - let mut free = Vec::new(); - let mut same_module_ranges = Vec::new(); - let mut module_starts = Vec::new(); - - for module in modules { - let start = stmts.len(); - module_starts.push(stmts.len()); - let mut module_item_count = 0; - - for stmt in module { - if is_injected_module_item(&stmt, injected_ctxt) { - free.push(stmt) - } else { - module_item_count += 1; - stmts.push(stmt) - } - } - - same_module_ranges.push(start..start + module_item_count); - } - let non_free_count = stmts.len(); - let free_range = non_free_count..non_free_count + free.len(); - stmts.extend(free); - - // print_hygiene( - // &format!("before sort"), - // cm, - // &Module { - // span: DUMMY_SP, - // body: stmts.clone(), - // shebang: None, - // }, - // ); - - let mut id_graph = calc_deps(&stmts); - - tracing::debug!("Analyzed dependencies between statements"); - - let orders = iter( - &mut id_graph, - &same_module_ranges, - free_range, - &module_starts, - &stmts, - ) - .collect::>(); - - tracing::debug!("Sorted statements"); - - debug_assert_eq!(total_len, orders.len()); - - let mut new = Vec::with_capacity(stmts.len()); - for idx in orders { - new.push(stmts[idx].take()); - } - - new -} - -fn is_injected_module_item(stmt: &ModuleItem, injected_ctxt: SyntaxContext) -> bool { - match stmt { - ModuleItem::ModuleDecl( - ModuleDecl::Import(ImportDecl { - with: Some(with), .. - }) - | ModuleDecl::ExportAll(ExportAll { - with: Some(with), .. - }) - | ModuleDecl::ExportNamed(NamedExport { - with: Some(with), .. - }), - ) => is_injected(with), - - ModuleItem::Stmt(Stmt::Decl(Decl::Var(v))) => v.ctxt == injected_ctxt, - - _ => false, - } -} - -fn iter<'a>( - graph: &'a mut StmtDepGraph, - same_module_ranges: &'a [Range], - free: Range, - module_starts: &[usize], - stmts: &'a [ModuleItem], -) -> impl 'a + Iterator { - let len = graph.node_count(); - - // dbg!(&same_module_ranges); - // dbg!(&free); - // dbg!(&module_starts); - - let mut moves = FxHashSet::default(); - let mut done = FxHashSet::default(); - let mut stack = VecDeque::new(); - stack.extend(module_starts.iter().copied()); - - for &start in module_starts { - let range = same_module_ranges - .iter() - .find(|range| range.contains(&start)) - .cloned(); - if let Some(range) = range { - for v in range { - stack.push_back(v); - } - } - } - for v in free.clone() { - stack.push_back(v); - } - - from_fn(move || { - if done.len() == len { - return None; - } - - // Check for first item. - 'main: while let Some(idx) = stack.pop_front() { - if done.contains(&idx) { - // eprintln!("Done: {}", idx); - continue; - } - let is_free = free.contains(&idx); - - // dbg!(idx, is_free); - // match &stmts[idx] { - // ModuleItem::Stmt(Stmt::Decl(Decl::Var(var))) => { - // let ids: Vec = find_ids(&var.decls); - // eprintln!("(`{}`) Declare var: `{:?}`", idx, ids); - // } - // ModuleItem::Stmt(Stmt::Decl(Decl::Class(cls))) => { - // eprintln!("(`{}`) Declare class: `{:?}`", idx, Id::from(&cls.ident)); - // } - // ModuleItem::Stmt(Stmt::Decl(Decl::Fn(f))) => { - // eprintln!("(`{}`) Declare fn: `{:?}`", idx, Id::from(&f.ident)); - // } - // _ => eprintln!("(`{}`) Stmt", idx,), - // } - - let current_range = same_module_ranges - .iter() - .find(|range| range.contains(&idx)) - .cloned(); - - // dbg!(¤t_range); - - let can_ignore_deps = match &stmts[idx] { - ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { - decl: Decl::Fn(..), - .. - })) - | ModuleItem::Stmt(Stmt::Decl(Decl::Fn(..))) => true, - - ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { - decl: Decl::Class(cls), - .. - })) - | ModuleItem::Stmt(Stmt::Decl(Decl::Class(cls))) - if cls.class.super_class.is_none() => - { - true - } - - _ => false, - }; - let can_ignore_weak_deps = can_ignore_deps - || matches!( - &stmts[idx], - ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { - decl: Decl::Class(..), - .. - })) | ModuleItem::Stmt(Stmt::Decl(Decl::Class(..))) - ); - - // We - { - let deps = graph - .neighbors_directed(idx, Dependencies) - .filter(|dep| { - let declared_in_same_module = match ¤t_range { - Some(v) => v.contains(dep), - None => false, - }; - if declared_in_same_module { - return false; - } - - if !free.contains(&idx) - && graph.has_a_path(*dep, idx) - && !moves.insert((idx, *dep)) - { - return false; - } - - // Exclude emitted items - !done.contains(dep) - }) - .collect::>(); - - // dbg!(&deps); - - if !deps.is_empty() { - let mut deps_to_push = Vec::new(); - for dep in deps.iter().rev().copied() { - if deps_to_push.contains(&dep) { - continue; - } - - let can_ignore_dep = can_ignore_deps - || (can_ignore_weak_deps - && graph.edge_weight(idx, dep) == Some(Required::Maybe)); - - if can_ignore_dep && graph.has_a_path(dep, idx) { - // Just emit idx. - continue; - } - - deps_to_push.push(dep); - } - - // dbg!(&deps_to_push); - - if !deps_to_push.is_empty() { - // We should check idx again after emitting dependencies. - stack.push_front(idx); - - for dep in deps_to_push { - // eprintln!("[Move]{} => {}; kind = dep", idx, dep); - stack.push_front(dep) - } - - continue; - } - } - } - - if is_free { - let dependants = graph - .neighbors_directed(idx, Dependants) - .collect::>(); - - for dependant in dependants { - if !done.contains(&dependant) && free.contains(&dependant) { - stack.push_front(dependant); - } - } - - graph.remove_node(idx); - done.insert(idx); - return Some(idx); - } - - let current_range = match current_range { - Some(v) => v, - None => { - let dependants = graph - .neighbors_directed(idx, Dependants) - .collect::>(); - - // dbg!(&dependants); - - // We only emit free items because we want to emit statements from same module - // to emitted closely. - for dependant in dependants { - if !done.contains(&dependant) && free.contains(&dependant) { - stack.push_front(dependant); - } - } - - // It's not within a module, so explicit ordering is not required. - graph.remove_node(idx); - done.insert(idx); - return Some(idx); - } - }; - - // We should respect original order of statements within a module. - for preceding in current_range.clone() { - // We should select first statement in module which is not emitted yet. - if done.contains(&preceding) { - continue; - } - // dbg!(preceding); - if preceding == idx { - continue; - } - if preceding > idx { - break; - } - - if !moves.insert((idx, preceding)) { - // idx = preceding; - continue; - } - - let dependants = graph - .neighbors_directed(idx, Dependants) - .collect::>(); - - // dbg!(&dependants); - - // We only emit free items because we want to emit statements from same module - // to emitted closely. - for dependant in dependants { - if !done.contains(&dependant) && free.contains(&dependant) { - stack.push_front(dependant); - } - } - - // We found a preceding statement which is not emitted yet. - stack.push_front(idx); - stack.push_front(preceding); - continue 'main; - } - - graph.remove_node(idx); - done.insert(idx); - return Some(idx); - } - - None - }) -} - -/// Using prototype should be treated as an initialization. -#[derive(Default)] -struct FieldInitFinder { - in_object_assign: bool, - in_rhs: bool, - accessed: FxHashSet, -} - -impl FieldInitFinder { - fn check_lhs_of_assign(&mut self, lhs: &AssignTarget) { - if let AssignTarget::Simple(SimpleAssignTarget::Member(m)) = lhs { - match &*m.obj { - Expr::Ident(i) => { - self.accessed.insert(i.into()); - } - Expr::Member(..) => self.check_lhs_expr_of_assign(&m.obj), - _ => {} - } - } - } - - fn check_lhs_expr_of_assign(&mut self, lhs: &Expr) { - if let Expr::Member(m) = lhs { - match &*m.obj { - Expr::Ident(i) => { - self.accessed.insert(i.into()); - } - Expr::Member(..) => self.check_lhs_expr_of_assign(&m.obj), - _ => {} - } - } - } -} - -impl Visit for FieldInitFinder { - noop_visit_type!(); - - fn visit_assign_expr(&mut self, e: &AssignExpr) { - let old = self.in_rhs; - self.in_rhs = false; - e.left.visit_with(self); - self.check_lhs_of_assign(&e.left); - - self.in_rhs = true; - e.right.visit_with(self); - self.in_rhs = old; - } - - fn visit_pat(&mut self, e: &Pat) { - let old = self.in_rhs; - self.in_rhs = false; - e.visit_children_with(self); - self.in_rhs = old; - } - - fn visit_call_expr(&mut self, e: &CallExpr) { - match &e.callee { - Callee::Super(_) | Callee::Import(_) => {} - Callee::Expr(callee) => { - if let Expr::Member(callee) = &**callee { - if callee.obj.is_ident_ref_to("Object") { - match &callee.prop { - MemberProp::Ident(IdentName { sym: prop_sym, .. }) - if *prop_sym == *"assign" => - { - let old = self.in_object_assign; - self.in_object_assign = true; - - e.args.visit_with(self); - self.in_object_assign = old; - - return; - } - _ => {} - } - } - } - } - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - } - - e.visit_children_with(self); - } - - fn visit_member_expr(&mut self, e: &MemberExpr) { - e.obj.visit_with(self); - - if let MemberProp::Computed(c) = &e.prop { - c.visit_with(self); - } - - if !self.in_rhs || self.in_object_assign { - if let Expr::Ident(obj) = &*e.obj { - match &e.prop { - MemberProp::Ident(IdentName { sym: prop_sym, .. }) - if *prop_sym == *"prototype" => - { - self.accessed.insert(obj.into()); - } - _ => {} - } - } - } - } - - fn visit_super_prop_expr(&mut self, e: &SuperPropExpr) { - if let SuperProp::Computed(c) = &e.prop { - c.visit_with(self); - } - } -} - -/// Finds usage of `ident` -struct InitializerFinder { - ident: Id, - found: bool, - in_complex: bool, -} - -impl Visit for InitializerFinder { - noop_visit_type!(); - - fn visit_pat(&mut self, pat: &Pat) { - match pat { - Pat::Ident(i) if self.ident == i.id => { - self.found = true; - } - - _ => { - pat.visit_children_with(self); - } - } - } - - fn visit_ident(&mut self, i: &Ident) { - if self.in_complex && self.ident == *i { - self.found = true; - } - } - - fn visit_expr_or_spread(&mut self, node: &ExprOrSpread) { - let in_complex = self.in_complex; - self.in_complex = true; - node.visit_children_with(self); - self.in_complex = in_complex; - } - - fn visit_member_expr(&mut self, e: &MemberExpr) { - { - let in_complex = self.in_complex; - self.in_complex = true; - e.obj.visit_children_with(self); - self.in_complex = in_complex; - } - - if let MemberProp::Computed(c) = &e.prop { - c.visit_with(self); - } - } - - fn visit_super_prop_expr(&mut self, e: &SuperPropExpr) { - if let SuperProp::Computed(c) = &e.prop { - c.visit_with(self); - } - } -} - -/// We do not care about variables created by current statement. -/// But we care about modifications. -#[derive(Default)] -struct RequirementCalculator { - required_ids: IndexSet<(Id, Required), FxBuildHasher>, - /// While bundling, there can be two bindings with same name and syntax - /// context, in case of wrapped es modules. We exclude them from dependency - /// graph. - excluded: IndexSet, - - in_weak: bool, - in_var_decl: bool, - in_assign_lhs: bool, -} - -macro_rules! weak { - ($name:ident, $T:ty) => { - fn $name(&mut self, f: &$T) { - let in_weak = self.in_weak; - self.in_weak = true; - - f.visit_children_with(self); - - self.in_weak = in_weak; - } - }; -} - -impl RequirementCalculator { - fn insert(&mut self, i: Id) { - self.required_ids.insert(( - i, - if self.in_weak { - Required::Maybe - } else { - Required::Always - }, - )); - } -} - -impl Visit for RequirementCalculator { - noop_visit_type!(); - - weak!(visit_arrow_expr, ArrowExpr); - - weak!(visit_function, Function); - - weak!(visit_class_method, ClassMethod); - - weak!(visit_private_method, PrivateMethod); - - weak!(visit_method_prop, MethodProp); - - fn visit_export_named_specifier(&mut self, n: &ExportNamedSpecifier) { - let orig = match &n.orig { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => unimplemented!("module string names unimplemented"), - #[cfg(swc_ast_unknown)] - _ => panic!("unable to access unknown nodes"), - }; - self.insert(orig.clone().into()); - } - - fn visit_assign_expr(&mut self, e: &AssignExpr) { - let old = self.in_assign_lhs; - - self.in_assign_lhs = true; - e.left.visit_with(self); - - self.in_assign_lhs = false; - e.right.visit_with(self); - - self.in_assign_lhs = old; - } - - fn visit_pat(&mut self, pat: &Pat) { - match pat { - Pat::Ident(i) => { - // We do not care about variables created by current statement. - if self.in_var_decl && !self.in_assign_lhs { - return; - } - self.insert(i.id.clone().into()); - } - _ => { - pat.visit_children_with(self); - } - } - } - - fn visit_var_declarator(&mut self, var: &VarDeclarator) { - let in_var_decl = self.in_var_decl; - self.in_var_decl = true; - - if self.in_weak { - let ids: Vec = find_pat_ids(&var.name); - self.excluded.extend(ids); - } - - var.visit_children_with(self); - - self.in_var_decl = in_var_decl; - } - - fn visit_expr(&mut self, expr: &Expr) { - match expr { - Expr::Ident(i) => { - if self.in_var_decl && self.in_assign_lhs { - return; - } - self.insert(i.into()); - } - _ => { - expr.visit_children_with(self); - } - } - } - - fn visit_prop(&mut self, prop: &Prop) { - match prop { - Prop::Shorthand(i) => { - self.insert(i.into()); - } - _ => prop.visit_children_with(self), - } - } - - fn visit_member_expr(&mut self, e: &MemberExpr) { - e.obj.visit_with(self); - - if let MemberProp::Computed(c) = &e.prop { - c.visit_with(self); - } - } - - fn visit_super_prop_expr(&mut self, e: &SuperPropExpr) { - if let SuperProp::Computed(c) = &e.prop { - c.visit_with(self); - } - } -} - -fn calc_deps(new: &[ModuleItem]) -> StmtDepGraph { - tracing::debug!("Analyzing dependencies between statements"); - let mut graph = StmtDepGraph::default(); - - let mut declared_by = FxHashMap::>::default(); - let mut uninitialized_ids = FxHashMap::::default(); - - for (idx, item) in new.iter().enumerate() { - graph.add_node(idx); - - // We start by calculating ids created by statements. Note that we don't need to - // analyze bodies of functions nor members of classes, because it's not - // evaluated until they are called. - - match item { - // We only check declarations because ids are created by declarations. - ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(ExportDecl { decl, .. })) - | ModuleItem::Stmt(Stmt::Decl(decl)) => { - // - match decl { - Decl::Class(ClassDecl { ident, .. }) | Decl::Fn(FnDecl { ident, .. }) => { - // eprintln!("Decl: `{}` declares {:?}`", idx, Id::from(ident)); - declared_by.entry(Id::from(ident)).or_default().push(idx); - } - Decl::Var(vars) => { - for var in &vars.decls { - // - let ids: Vec = find_pat_ids(&var.name); - for id in ids { - if var.init.is_none() { - uninitialized_ids.insert(id.clone(), idx); - } - - // eprintln!("Decl: `{}` declares {:?}`", idx, id); - declared_by.entry(id).or_default().push(idx); - } - } - } - _ => {} - } - } - _ => {} - } - - { - // Find extra initializations. - let mut v = FieldInitFinder::default(); - item.visit_with(&mut v); - - for id in v.accessed { - if let Some(declarator_indexes) = declared_by.get(&id) { - // let idx_decl = match &item { - // ModuleItem::Stmt(Stmt::Decl(Decl::Var(var))) => { - // let ids: Vec = find_ids(&var.decls); - // format!("`{:?}`", ids) - // } - // ModuleItem::Stmt(Stmt::Decl(Decl::Class(c))) => { - // format!("{}{:?}", c.ident.sym, c.ident.ctxt) - // } - // ModuleItem::Stmt(Stmt::Decl(Decl::Fn(f))) => { - // format!("{}{:?}", f.ident.sym, f.ident.ctxt) - // } - // _ => String::from(""), - // }; - - for &declarator_index in declarator_indexes { - if declarator_index != idx { - graph.add_edge(idx, declarator_index, Required::Always); - // eprintln!( - // "Field init: `{}` ({}) depends on `{}`: - // {:?}", - // idx, idx_decl, declarator_index, &id - // ); - } - } - - // eprintln!("`{}` declares {:?}`", idx, id); - declared_by.entry(id).or_default().push(idx); - } - } - } - } - - // Handle uninitialized variables - // - // Compiled typescript enum is not initialized by declaration - // - // var Status; - // (function(Status){})(Status) - for (uninit_id, start_idx) in uninitialized_ids { - for (idx, item) in new.iter().enumerate().filter(|(idx, _)| *idx > start_idx) { - let mut finder = InitializerFinder { - ident: uninit_id.clone(), - found: false, - in_complex: false, - }; - item.visit_with(&mut finder); - if finder.found { - declared_by.entry(uninit_id).or_default().push(idx); - break; - } - } - } - - for (idx, item) in new.iter().enumerate() { - // We then calculate which ids a statement require to be executed. - // Again, we don't need to analyze non-top-level identifiers because they - // are not evaluated while loading module. - - let mut visitor = RequirementCalculator::default(); - - item.visit_with(&mut visitor); - - for (id, kind) in visitor.required_ids { - if visitor.excluded.contains(&id) { - continue; - } - - if let Some(declarator_indexes) = declared_by.get(&id) { - for &declarator_index in declarator_indexes { - if declarator_index != idx { - // let idx_decl = match &item { - // ModuleItem::Stmt(Stmt::Decl(Decl::Var(var))) => { - // let ids: Vec = find_ids(&var.decls); - // format!("`{:?}`", ids) - // } - // ModuleItem::Stmt(Stmt::Decl(Decl::Class(c))) => { - // format!("{}{:?}", c.ident.sym, c.ident.ctxt) - // } - // ModuleItem::Stmt(Stmt::Decl(Decl::Fn(f))) => { - // format!("{}{:?}", f.ident.sym, f.ident.ctxt) - // } - // _ => String::from(""), - // }; - - graph.add_edge(idx, declarator_index, kind); - // eprintln!( - // "`{}` ({}) depends on `{}`: {:?}", - // idx, idx_decl, declarator_index, &id - // ); - if cfg!(debug_assertions) { - assert!(graph - .neighbors_directed(idx, Dependencies) - .any(|x| x == declarator_index)); - } - } - } - } - } - } - - graph -} - -#[cfg(test)] -mod tests { - use swc_common::DUMMY_SP; - use swc_ecma_ast::*; - - use super::{calc_deps, Dependencies}; - use crate::{bundler::tests::suite, debug::print_hygiene}; - - fn assert_no_cycle(s: &str) { - suite().file("main.js", s).run(|t| { - let info = t.module("main.js"); - let module = (*info.module).clone(); - - let graph = calc_deps(&module.body); - - for i in 0..module.body.len() { - if let ModuleItem::Stmt(Stmt::Decl(Decl::Fn(..))) = &module.body[i] { - continue; - } - - let deps = graph - .neighbors_directed(i, Dependencies) - .collect::>(); - - for dep in deps { - if let ModuleItem::Stmt(Stmt::Decl(Decl::Fn(..))) = &module.body[dep] { - continue; - } - print_hygiene( - "first item", - &t.cm, - &Module { - span: DUMMY_SP, - body: vec![module.body[dep].clone()], - shebang: None, - }, - ); - print_hygiene( - "second item", - &t.cm, - &Module { - span: DUMMY_SP, - body: vec![module.body[i].clone()], - shebang: None, - }, - ); - assert!( - !graph.has_a_path(dep, i), - "{dep} and {i} is dependant to each other", - ); - } - } - - Ok(()) - }); - } - - #[test] - fn no_cycle_1() { - assert_no_cycle( - r#" - function lexer(str) { - const tokens = []; - let i = 0; - while(i < str.length){ - const char = str[i]; - if (char === "*" || char === "+" || char === "?") { - tokens.push({ - type: "MODIFIER", - index: i, - value: str[i++] - }); - continue; - } - if (char === "\\") { - tokens.push({ - type: "ESCAPED_CHAR", - index: i++, - value: str[i++] - }); - continue; - } - if (char === "{") { - tokens.push({ - type: "OPEN", - index: i, - value: str[i++] - }); - continue; - } - if (char === "}") { - tokens.push({ - type: "CLOSE", - index: i, - value: str[i++] - }); - continue; - } - if (char === ":") { - let name = ""; - let j = i + 1; - while(j < str.length){ - const code = str.charCodeAt(j); - if ((code >= 48 && code <= 57) || (code >= 65 && code <= 90) || (code >= 97 && code <= 122) || code === 95) { - name += str[j++]; - continue; - } - break; - } - if (!name) throw new TypeError(`Missing parameter name at ${i}`); - tokens.push({ - type: "NAME", - index: i, - value: name - }); - i = j; - continue; - } - if (char === "(") { - let count = 1; - let pattern = ""; - let j = i + 1; - if (str[j] === "?") { - throw new TypeError(`Pattern cannot start with "?" at ${j}`); - } - while(j < str.length){ - if (str[j] === "\\") { - pattern += str[j++] + str[j++]; - continue; - } - if (str[j] === ")") { - count--; - if (count === 0) { - j++; - break; - } - } else if (str[j] === "(") { - count++; - if (str[j + 1] !== "?") { - throw new TypeError(`Capturing groups are not allowed at ${j}`); - } - } - pattern += str[j++]; - } - if (count) throw new TypeError(`Unbalanced pattern at ${i}`); - if (!pattern) throw new TypeError(`Missing pattern at ${i}`); - tokens.push({ - type: "PATTERN", - index: i, - value: pattern - }); - i = j; - continue; - } - tokens.push({ - type: "CHAR", - index: i, - value: str[i++] - }); - } - tokens.push({ - type: "END", - index: i, - value: "" - }); - return tokens; - } - function parse(str, options = { - }) { - const tokens = lexer(str); - const { prefixes ="./" } = options; - const defaultPattern = `[^${escapeString(options.delimiter || "/#?")}]+?`; - const result = []; - let key = 0; - let i = 0; - let path = ""; - const tryConsume = (type)=>{ - if (i < tokens.length && tokens[i].type === type) return tokens[i++].value; - }; - const mustConsume = (type)=>{ - const value = tryConsume(type); - if (value !== undefined) return value; - const { type: nextType , index } = tokens[i]; - throw new TypeError(`Unexpected ${nextType} at ${index}, expected ${type}`); - }; - const consumeText = ()=>{ - let result1 = ""; - let value; - while((value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR"))){ - result1 += value; - } - return result1; - }; - while(i < tokens.length){ - const char = tryConsume("CHAR"); - const name = tryConsume("NAME"); - const pattern = tryConsume("PATTERN"); - if (name || pattern) { - let prefix = char || ""; - if (prefixes.indexOf(prefix) === -1) { - path += prefix; - prefix = ""; - } - if (path) { - result.push(path); - path = ""; - } - result.push({ - name: name || key++, - prefix, - suffix: "", - pattern: pattern || defaultPattern, - modifier: tryConsume("MODIFIER") || "" - }); - continue; - } - const value = char || tryConsume("ESCAPED_CHAR"); - if (value) { - path += value; - continue; - } - if (path) { - result.push(path); - path = ""; - } - const open = tryConsume("OPEN"); - if (open) { - const prefix = consumeText(); - const name1 = tryConsume("NAME") || ""; - const pattern1 = tryConsume("PATTERN") || ""; - const suffix = consumeText(); - mustConsume("CLOSE"); - result.push({ - name: name1 || (pattern1 ? key++ : ""), - pattern: name1 && !pattern1 ? defaultPattern : pattern1, - prefix, - suffix, - modifier: tryConsume("MODIFIER") || "" - }); - continue; - } - mustConsume("END"); - } - return result; - } - const parse1 = parse; - function compile(str, options) { - return tokensToFunction(parse(str, options), options); - } - const compile1 = compile; - function tokensToFunction(tokens, options = { - }) { - const reFlags = flags(options); - const { encode =(x)=>x - , validate =true } = options; - const matches = tokens.map((token)=>{ - if (typeof token === "object") { - return new RegExp(`^(?:${token.pattern})$`, reFlags); - } - }); - return (data)=>{ - let path = ""; - for(let i = 0; i < tokens.length; i++){ - const token = tokens[i]; - if (typeof token === "string") { - path += token; - continue; - } - const value = data ? data[token.name] : undefined; - const optional = token.modifier === "?" || token.modifier === "*"; - const repeat = token.modifier === "*" || token.modifier === "+"; - if (Array.isArray(value)) { - if (!repeat) { - throw new TypeError(`Expected "${token.name}" to not repeat, but got an array`); - } - if (value.length === 0) { - if (optional) continue; - throw new TypeError(`Expected "${token.name}" to not be empty`); - } - for(let j = 0; j < value.length; j++){ - const segment = encode(value[j], token); - if (validate && !(matches[i]).test(segment)) { - throw new TypeError(`Expected all "${token.name}" to match "${token.pattern}", but got "${segment}"`); - } - path += token.prefix + segment + token.suffix; - } - continue; - } - if (typeof value === "string" || typeof value === "number") { - const segment = encode(String(value), token); - if (validate && !(matches[i]).test(segment)) { - throw new TypeError(`Expected "${token.name}" to match "${token.pattern}", but got "${segment}"`); - } - path += token.prefix + segment + token.suffix; - continue; - } - if (optional) continue; - const typeOfMessage = repeat ? "an array" : "a string"; - throw new TypeError(`Expected "${token.name}" to be ${typeOfMessage}`); - } - return path; - }; - } - const tokensToFunction1 = tokensToFunction; - function match(str, options) { - const keys = []; - const re = pathToRegexp(str, keys, options); - return regexpToFunction(re, keys, options); - } - const match1 = match; - function regexpToFunction(re, keys, options = { - }) { - const { decode =(x)=>x - } = options; - return function(pathname) { - const m = re.exec(pathname); - if (!m) return false; - const { 0: path , index } = m; - const params = Object.create(null); - for(let i = 1; i < m.length; i++){ - if (m[i] === undefined) continue; - const key = keys[i - 1]; - if (key.modifier === "*" || key.modifier === "+") { - params[key.name] = m[i].split(key.prefix + key.suffix).map((value)=>{ - return decode(value, key); - }); - } else { - params[key.name] = decode(m[i], key); - } - } - return { - path, - index, - params - }; - }; - } - const regexpToFunction1 = regexpToFunction; - function escapeString(str) { - return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); - } - function flags(options) { - return options && options.sensitive ? "" : "i"; - } - function regexpToRegexp(path, keys) { - if (!keys) return path; - const groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g; - let index = 0; - let execResult = groupsRegex.exec(path.source); - while(execResult){ - keys.push({ - name: execResult[1] || index++, - prefix: "", - suffix: "", - modifier: "", - pattern: "" - }); - execResult = groupsRegex.exec(path.source); - } - return path; - } - function arrayToRegexp(paths, keys, options) { - const parts = paths.map((path)=>pathToRegexp(path, keys, options).source - ); - return new RegExp(`(?:${parts.join("|")})`, flags(options)); - } - function stringToRegexp(path, keys, options) { - return tokensToRegexp(parse(path, options), keys, options); - } - function tokensToRegexp(tokens, keys, options = { - }) { - const { strict =false , start =true , end =true , encode =(x)=>x - } = options; - const endsWith = `[${escapeString(options.endsWith || "")}]|$`; - const delimiter = `[${escapeString(options.delimiter || "/#?")}]`; - let route = start ? "^" : ""; - for (const token of tokens){ - if (typeof token === "string") { - route += escapeString(encode(token)); - } else { - const prefix = escapeString(encode(token.prefix)); - const suffix = escapeString(encode(token.suffix)); - if (token.pattern) { - if (keys) keys.push(token); - if (prefix || suffix) { - if (token.modifier === "+" || token.modifier === "*") { - const mod = token.modifier === "*" ? "?" : ""; - route += `(?:${prefix}((?:${token.pattern})(?:${suffix}${prefix}(?:${token.pattern}))*)${suffix})${mod}`; - } else { - route += `(?:${prefix}(${token.pattern})${suffix})${token.modifier}`; - } - } else { - route += `(${token.pattern})${token.modifier}`; - } - } else { - route += `(?:${prefix}${suffix})${token.modifier}`; - } - } - } - if (end) { - if (!strict) route += `${delimiter}?`; - route += !options.endsWith ? "$" : `(?=${endsWith})`; - } else { - const endToken = tokens[tokens.length - 1]; - const isEndDelimited = typeof endToken === "string" ? delimiter.indexOf(endToken[endToken.length - 1]) > -1 : endToken === undefined; - if (!strict) { - route += `(?:${delimiter}(?=${endsWith}))?`; - } - if (!isEndDelimited) { - route += `(?=${delimiter}|${endsWith})`; - } - } - return new RegExp(route, flags(options)); - } - const tokensToRegexp1 = tokensToRegexp; - function pathToRegexp(path, keys, options) { - if (path instanceof RegExp) return regexpToRegexp(path, keys); - if (Array.isArray(path)) return arrayToRegexp(path, keys, options); - return stringToRegexp(path, keys, options); - } - const pathToRegexp1 = pathToRegexp; - "#, - ); - } -} diff --git a/crates/swc_bundler/src/modules/sort/tests.rs b/crates/swc_bundler/src/modules/sort/tests.rs deleted file mode 100644 index 206b3ffb42a6..000000000000 --- a/crates/swc_bundler/src/modules/sort/tests.rs +++ /dev/null @@ -1,522 +0,0 @@ -use swc_common::{SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_utils::drop_span; -use testing::assert_eq; - -use super::stmt::sort_stmts; -use crate::{bundler::tests::suite, debug::print_hygiene}; - -fn assert_sorted(src: &[&str], res: &str) { - assert_sorted_with_free(src, "", res) -} - -fn assert_sorted_with_free(src: &[&str], free: &str, res: &str) { - let mut s = suite(); - for (i, src) in src.iter().enumerate() { - s = s.file(&format!("{i}.js"), src); - } - s.run(|t| { - let mut modules = Vec::new(); - let mut entry = None; - - let mut free: Module = drop_span(t.parse(free)); - for item in free.body.iter_mut() { - mark(item, t.bundler.injected_ctxt); - } - modules.push(free.body); - - for (i, _) in src.iter().enumerate() { - let info = t.module(&format!("{i}.js")); - if entry.is_none() { - entry = Some(info.id); - } - let actual: Module = drop_span((*info.module).clone()); - modules.push(actual.body); - } - - let sorted = sort_stmts(t.bundler.injected_ctxt, modules, &t.cm); - - let actual: Module = drop_span(Module { - span: DUMMY_SP, - body: sorted, - shebang: None, - }); - - let expected = drop_span(t.parse(res)); - - if actual == expected { - return Ok(()); - } - - print_hygiene("actual", &t.cm, &actual); - print_hygiene("expected", &t.cm, &expected); - assert_eq!(actual, expected); - panic!() - }); -} - -#[test] -#[ignore] -fn sort_001() { - assert_sorted( - &["_9[0] = 133;", "const _9 = new ByteArray(32);"], - " - const _9 = new ByteArray(32); - _9[0] = 133; - ", - ) -} - -#[test] -#[ignore] -fn sort_002() { - assert_sorted( - &[ - " - const mod = (function(){ - const A = v; - }()); - ", - "const v = 5;", - ], - " - const v = 5; - const mod = (function(){ - const A = v; - }()); - ", - ) -} - -#[test] -#[ignore] -fn sort_003() { - assert_sorted( - &[ - "class Constraint extends serialization.Serializable {}", - "const serialization = {};", - ], - " - const serialization = {}; - class Constraint extends serialization.Serializable { - } - ", - ); -} - -#[test] -#[ignore] -fn sort_004() { - assert_sorted( - &["use(global);", "const global = getGlobal();"], - " - const global = getGlobal(); - use(global); - ", - ); -} - -#[test] -#[ignore] -fn sort_005() { - assert_sorted( - &[ - "use(a);", - " - const a = new A(); - const b = 1; - ", - " - use(b); - class A {} - ", - ], - " - class A { - } - const a = new A(); - const b = 1; - use(b); - use(a); - ", - ); -} - -#[test] -#[ignore] -fn deno_jszip_01() { - assert_sorted( - &[ - "use(a);", - " - const a = {}; - a.foo = 1; - ", - ], - " - const a = {}; - a.foo = 1; - use(a) - ", - ); -} - -#[test] -#[ignore] -fn deno_jszip_02() { - assert_sorted( - &[ - "X()", - " - const Q = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof self ? \ - self : global; - ", - " - function X() { - console.log(Q.A) - } - ", - ], - " - const Q = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof self ? \ - self : global; - function X() { - console.log(Q.A) - } - X() - ", - ); -} - -#[test] -#[ignore] -fn deno_jszip_03() { - assert_sorted( - &[ - "const v = X()", - " - const Q = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof self ? \ - self : global; - function X() { - console.log(Q.A) - } - ", - ], - " - const Q = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof self ? \ - self : global; - function X() { - console.log(Q.A) - } - const v = X() - ", - ); -} - -#[test] -#[ignore] -fn sort_006() { - assert_sorted( - &[ - "use(b)", - " - const b, a = b = {}; - a.env = {}; - ", - ], - " - const b, a = b = {}; - a.env = {}; - use(b); - ", - ); -} - -#[test] -#[ignore] -fn sort_007() { - assert_sorted_with_free( - &[ - " - var e, o = e = {}; - var T = e; - e.env = {}; - ", - " - if (h$1.env.NODE_DEBUG) { - } - ", - ], - " - const h325 = T; - const h$1 = h325; - ", - " - var e, o = e = {}; - var T = e; - e.env = { - }; - const h325 = T; - const h$1 = h325; - if (h$1.env.NODE_DEBUG) { - } - ", - ); -} - -#[test] -#[ignore] -fn sort_008() { - assert_sorted_with_free( - &[ - " - var e, o = e = {}; - o.env = {} - var T = e; - ", - " - use(h); - ", - ], - " - const h = T; - ", - " - var e, o = e = {}; - o.env = {} - var T = e; - const h = T; - use(h); - ", - ); -} - -#[test] -#[ignore] -fn sort_009() { - assert_sorted_with_free( - &[ - " - use(h); - ", - " - var e, o = e = {}; - o.env = {} - var T = e; - ", - ], - " - const h = T; - ", - " - var e, o = e = {}; - o.env = {} - var T = e; - const h = T; - use(h); - ", - ); -} - -#[test] -#[ignore] -fn sort_010() { - assert_sorted( - &[" - class AbstractBufBase {} - class BufWriter extends AbstractBufBase {} - "], - " - class AbstractBufBase {} - class BufWriter extends AbstractBufBase {} - ", - ); -} - -#[test] -#[ignore] -fn sort_011() { - assert_sorted( - &[ - "use(BufWriter)", - "use(BufWriterSync)", - " - class AbstractBufBase {} - class BufWriter extends AbstractBufBase {} - class BufWriterSync extends AbstractBufBase { } - ", - ], - " - class AbstractBufBase { - } - class BufWriter extends AbstractBufBase { - } - class BufWriterSync extends AbstractBufBase { - } - use(BufWriter); - use(BufWriterSync); - ", - ); -} - -#[test] -#[ignore] -fn sort_012() { - assert_sorted( - &[ - "use(isWindows)", - "use(NATIVE_OS)", - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - ", - ], - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - use(isWindows); - use(NATIVE_OS); - ", - ); -} - -#[test] -#[ignore] -fn sort_013() { - assert_sorted( - &[ - "use(isWindows)", - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - ", - ], - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - use(isWindows); - ", - ); -} - -#[test] -#[ignore] -fn sort_014() { - assert_sorted( - &[ - "use(NATIVE_OS)", - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - ", - ], - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - use(NATIVE_OS) - ", - ); -} - -#[test] -#[ignore] -fn sort_015() { - assert_sorted( - &[ - " - use(isWindows) - use(NATIVE_OS) - ", - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - ", - ], - " - let NATIVE_OS = 'linux'; - const navigator = globalThis.navigator; - if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; - } else if (navigator?.appVersion?.includes?.('Win') ?? false) { - NATIVE_OS = 'windows'; - } - const isWindows = NATIVE_OS == 'windows'; - use(isWindows); - use(NATIVE_OS); - ", - ); -} - -#[test] -#[ignore] -fn sort_016() { - assert_sorted( - &[ - " - function f1() { - - } - f2(); - ", - " - function f2() { - - } - f1(); - ", - ], - " - function f1() { - } - function f2() { - } - f2(); - f1(); - ", - ); -} - -#[allow(unused)] -fn mark(item: &mut ModuleItem, ctxt: SyntaxContext) {} diff --git a/crates/swc_bundler/src/resolve.rs b/crates/swc_bundler/src/resolve.rs deleted file mode 100644 index 1a8be509610b..000000000000 --- a/crates/swc_bundler/src/resolve.rs +++ /dev/null @@ -1 +0,0 @@ -pub use swc_ecma_loader::resolve::Resolve; diff --git a/crates/swc_bundler/src/util.rs b/crates/swc_bundler/src/util.rs deleted file mode 100644 index 63b136f1d9a1..000000000000 --- a/crates/swc_bundler/src/util.rs +++ /dev/null @@ -1,282 +0,0 @@ -#![allow(dead_code)] - -use std::hash::Hash; - -use rustc_hash::FxBuildHasher; -#[cfg(not(feature = "concurrent"))] -use rustc_hash::FxHashMap; -use swc_atoms::atom; -use swc_common::{SyntaxContext, DUMMY_SP}; -use swc_ecma_ast::*; -use swc_ecma_utils::ident::IdentLike; -use swc_ecma_visit::{noop_visit_mut_type, VisitMut}; - -#[cfg(feature = "concurrent")] -pub(crate) type Readonly = std::sync::Arc; - -#[cfg(not(feature = "concurrent"))] -pub(crate) type Readonly = T; - -const TRACK: bool = false; - -pub(crate) trait VarDeclaratorExt: Into { - fn into_module_item(self, injected_ctxt: SyntaxContext, name: &str) -> ModuleItem { - VarDecl { - span: DUMMY_SP, - ctxt: injected_ctxt, - kind: VarDeclKind::Const, - declare: false, - decls: if TRACK { - vec![ - self.into(), - Str { - span: DUMMY_SP, - raw: None, - value: name.into(), - } - .assign_to(Ident::new_no_ctxt(atom!("INJECTED_FROM"), DUMMY_SP)), - ] - } else { - vec![self.into()] - }, - } - .into() - } -} - -impl VarDeclaratorExt for T where T: Into {} - -pub(crate) trait ExprExt: Into { - #[track_caller] - fn assign_to(self, lhs: T) -> VarDeclarator - where - T: IdentLike, - { - let init = self.into(); - let lhs = lhs.into_id(); - - if cfg!(debug_assertions) { - if let Expr::Ident(rhs) = &init { - debug_assert_ne!(lhs, rhs.to_id()); - } - } - - VarDeclarator { - span: DUMMY_SP, - name: Ident::new(lhs.0, DUMMY_SP, lhs.1).into(), - init: Some(Box::new(init)), - definite: false, - } - } -} - -impl ExprExt for T where T: Into {} - -#[derive(Debug)] -pub(crate) struct CHashSet -where - V: Eq + Hash, -{ - inner: CloneMap, -} - -impl CHashSet -where - V: Eq + Hash, -{ - // pub fn insert(&self, v: V) -> bool { - // self.inner.insert(v, ()).is_none() - // } -} - -impl Default for CHashSet -where - V: Eq + Hash, -{ - fn default() -> Self { - Self { - inner: Default::default(), - } - } -} - -#[derive(Debug)] -pub(crate) struct CloneMap -where - K: Eq + Hash, - V: Clone, -{ - #[cfg(feature = "concurrent")] - inner: dashmap::DashMap, - #[cfg(not(feature = "concurrent"))] - inner: std::cell::RefCell>, -} - -impl Default for CloneMap -where - K: Eq + Hash, - V: Clone, -{ - fn default() -> Self { - Self { - inner: Default::default(), - } - } -} - -impl CloneMap -where - K: Eq + Hash, - V: Clone, -{ - #[cfg(feature = "concurrent")] - pub fn get(&self, k: &K) -> Option { - self.inner.get(k).map(|v| v.value().clone()) - } - - #[cfg(not(feature = "concurrent"))] - pub fn get(&self, k: &K) -> Option { - self.inner.borrow().get(k).map(|v| v.clone()) - } - - #[cfg(feature = "concurrent")] - pub fn insert(&self, k: K, v: V) -> Option { - self.inner.insert(k, v) - } - - #[cfg(not(feature = "concurrent"))] - pub fn insert(&self, k: K, v: V) -> Option { - self.inner.borrow_mut().insert(k, v) - } -} - -pub(crate) struct HygieneRemover; - -impl VisitMut for HygieneRemover { - noop_visit_mut_type!(fail); - - fn visit_mut_syntax_context(&mut self, n: &mut SyntaxContext) { - *n = SyntaxContext::empty(); - } -} - -#[cfg(feature = "rayon")] -pub(crate) use rayon::join; - -#[cfg(not(feature = "rayon"))] -pub(crate) fn join(op_a: A, op_b: B) -> (RA, RB) -where - A: FnOnce() -> RA, - B: FnOnce() -> RB, -{ - (op_a(), op_b()) -} - -#[cfg(feature = "rayon")] -pub(crate) use rayon::iter::IntoParallelIterator; - -/// Fake trait -#[cfg(not(feature = "rayon"))] -pub(crate) trait IntoParallelIterator: Sized + IntoIterator { - fn into_par_iter(self) -> ::IntoIter { - self.into_iter() - } -} - -#[cfg(not(feature = "rayon"))] -impl IntoParallelIterator for T where T: IntoIterator {} - -fn metadata(key: &str, value: &str) -> PropOrSpread { - PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { - key: PropName::Ident(IdentName::new(key.into(), DUMMY_SP)), - value: Lit::Str(Str { - span: DUMMY_SP, - value: value.into(), - raw: None, - }) - .into(), - }))) -} - -#[derive(Debug, Default)] -pub(crate) struct ExportMetadata { - pub injected: bool, - pub export_ctxt: Option, -} - -impl ExportMetadata { - pub fn into_with(self) -> Box { - let mut obj = Some(Box::new(ObjectLit { - span: DUMMY_SP, - props: Vec::new(), - })); - - self.encode(&mut obj); - - obj.unwrap() - } - - pub fn encode(&self, to: &mut Option>) { - let mut props = Vec::new(); - - if self.injected { - props.push(metadata("__swc_bundler__injected__", "1")); - } - - if let Some(export_ctxt) = self.export_ctxt { - props.push(metadata( - "__swc_bundler__export_ctxt__", - &export_ctxt.as_u32().to_string(), - )); - } - - if to.is_none() { - *to = Some(Box::new(ObjectLit { - span: DUMMY_SP, - props, - })); - } else { - let obj = to.as_mut().unwrap(); - obj.props.extend(props); - } - } - - pub fn decode(with: Option<&ObjectLit>) -> Self { - let mut data = ExportMetadata::default(); - - if let Some(with) = with { - for prop in &with.props { - if let PropOrSpread::Prop(p) = prop { - if let Prop::KeyValue(KeyValueProp { - key: PropName::Ident(IdentName { sym, .. }), - value, - .. - }) = &**p - { - if *sym == "__swc_bundler__injected__" { - if let Expr::Lit(Lit::Str(Str { value, .. })) = &**value { - if value == "1" { - data.injected = true; - } - } - } else if *sym == "__swc_bundler__export_ctxt__" { - if let Expr::Lit(Lit::Str(Str { value, .. })) = &**value { - if let Some(value) = value.as_str() { - if let Ok(v) = value.parse() { - data.export_ctxt = Some(SyntaxContext::from_u32(v)); - } - } - } - } - } - } - } - } - - data - } -} - -pub(crate) fn is_injected(with: &ObjectLit) -> bool { - ExportMetadata::decode(Some(with)).injected -} diff --git a/crates/swc_bundler/tests/.cache/deno/00011a1bcca0c2e5d1dc3fcc4164a67b715dcf43.ts b/crates/swc_bundler/tests/.cache/deno/00011a1bcca0c2e5d1dc3fcc4164a67b715dcf43.ts deleted file mode 100644 index e36242d4711c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/00011a1bcca0c2e5d1dc3fcc4164a67b715dcf43.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/interaction_guild_member.ts - - -import { GuildMemberWithUser } from "../members/guild_member.ts"; - -/** https://discord.com/developers/docs/resources/guild#guild-member-object */ -export interface InteractionGuildMember extends GuildMemberWithUser { - /** Total permissions of the member in the channel, including overwrites, returned when in the interaction object */ - permissions: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0001ff668a4b2872431d6fffb5cbe9dd7f226525.ts b/crates/swc_bundler/tests/.cache/deno/0001ff668a4b2872431d6fffb5cbe9dd7f226525.ts deleted file mode 100644 index e4b1ba58dcfc..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0001ff668a4b2872431d6fffb5cbe9dd7f226525.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/flags/mod.ts - - -export * from "./flags.ts"; -export * from "./normalize.ts"; -export * from "./types.ts"; -export * from "./validate_flags.ts"; -export * from "./types/boolean.ts"; -export * from "./types/number.ts"; -export * from "./types/string.ts"; -export { ValidationError } from "./_errors.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/0004535d5f93eb2ada7a36c4a14755f0a944c39f.ts b/crates/swc_bundler/tests/.cache/deno/0004535d5f93eb2ada7a36c4a14755f0a944c39f.ts deleted file mode 100644 index 12ecd79a71dc..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0004535d5f93eb2ada7a36c4a14755f0a944c39f.ts +++ /dev/null @@ -1,68 +0,0 @@ -// Loaded from https://deno.land/std/fs/ensure_file.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import * as path from "../path/mod.ts"; -import { ensureDir, ensureDirSync } from "./ensure_dir.ts"; -import { getFileInfoType } from "./_util.ts"; - -/** - * Ensures that the file exists. - * If the file that is requested to be created is in directories that do not - * exist. - * these directories are created. If the file already exists, - * it is NOTMODIFIED. - * Requires the `--allow-read` and `--allow-write` flag. - */ -export async function ensureFile(filePath: string): Promise { - try { - // if file exists - const stat = await Deno.lstat(filePath); - if (!stat.isFile) { - throw new Error( - `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`, - ); - } - } catch (err) { - // if file not exists - if (err instanceof Deno.errors.NotFound) { - // ensure dir exists - await ensureDir(path.dirname(filePath)); - // create file - await Deno.writeFile(filePath, new Uint8Array()); - return; - } - - throw err; - } -} - -/** - * Ensures that the file exists. - * If the file that is requested to be created is in directories that do not - * exist, - * these directories are created. If the file already exists, - * it is NOT MODIFIED. - * Requires the `--allow-read` and `--allow-write` flag. - */ -export function ensureFileSync(filePath: string): void { - try { - // if file exists - const stat = Deno.lstatSync(filePath); - if (!stat.isFile) { - throw new Error( - `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`, - ); - } - } catch (err) { - // if file not exists - if (err instanceof Deno.errors.NotFound) { - // ensure dir exists - ensureDirSync(path.dirname(filePath)); - // create file - Deno.writeFileSync(filePath, new Uint8Array()); - return; - } - throw err; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/000eaaf9c0385c727c48e5dd5638a0230d00c3dd.ts b/crates/swc_bundler/tests/.cache/deno/000eaaf9c0385c727c48e5dd5638a0230d00c3dd.ts deleted file mode 100644 index 8897e6870b8c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/000eaaf9c0385c727c48e5dd5638a0230d00c3dd.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/commands/create_guild_application_command.ts - - -import { ApplicationCommandOption } from "./application_command_option.ts"; - -/** https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command-json-params */ -export interface CreateGuildApplicationCommand { - /** 1-31 character name matching lowercase `^[\w-]{1,32}$` */ - name: string; - /** 1-100 character description */ - description: string; - /** The parameters for the command */ - options?: ApplicationCommandOption[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/000ffa42c9218a387d09c7be59f9609249baa988.ts b/crates/swc_bundler/tests/.cache/deno/000ffa42c9218a387d09c7be59f9609249baa988.ts deleted file mode 100644 index 6471345238f2..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/000ffa42c9218a387d09c7be59f9609249baa988.ts +++ /dev/null @@ -1,61 +0,0 @@ -// Loaded from https://deno.land/x/god_crypto@v0.2.0/src/rsa.ts - - -import { power_mod } from "./math.ts"; -import { eme_oaep_encode, eme_oaep_decode } from "./eme_oaep.ts"; -import { os2ip, i2osp } from "./primitives.ts"; -import { concat, random_bytes } from "./helper.ts"; - -/** - * @param n public key modulus - * @param e public key exponent - * @param m message representative - */ -export function rsaep(n: bigint, e: bigint, m: bigint): bigint { - return power_mod(m, e, n); -} - -/** - * @param n private key modulus - * @param d private key exponent - * @param c ciphertext representative - */ -export function rsadp(n: bigint, d: bigint, c: bigint): bigint { - return power_mod(c, d, n); -} - -export function rsa_oaep_encrypt(bytes: number, n: bigint, e: bigint, m: Uint8Array, algorithm: "sha1" | "sha256") { - const em = eme_oaep_encode(new Uint8Array(0), m, bytes, algorithm); - const msg = os2ip(em); - const c = rsaep(n, e, msg); - return i2osp(c, bytes); -} - -export function rsa_oaep_decrypt(bytes: number, n: bigint, d: bigint, c: Uint8Array, algorithm: "sha1" | "sha256") { - const em = rsadp(n, d, os2ip(c)); - const m = eme_oaep_decode(new Uint8Array(0), i2osp(em, bytes), bytes, algorithm); - return m; -} - -export function rsa_pkcs1_encrypt(bytes: number, n: bigint, e: bigint, m: Uint8Array) { - const p = concat([0x00, 0x02], random_bytes(bytes - m.length - 3), [0x00], m); - const msg = os2ip(p); - const c = rsaep(n, e, msg); - return i2osp(c, bytes); -} - -export function rsa_pkcs1_decrypt(bytes: number, n: bigint, d: bigint, c: Uint8Array) { - const em = i2osp(rsadp(n, d, os2ip(c)), bytes); - - if (em[0] !== 0) throw "Decryption error"; - if (em[1] !== 0x02) throw "Decryption error"; - - let psCursor = 2; - for(; psCursor < em.length; psCursor++) { - if (em[psCursor] === 0x00) break; - } - - if (psCursor < 10) throw "Decryption error"; - - return em.slice(psCursor + 1); -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/002f5d1cbfd5e28f9167bc34bbab797dd6d45867.ts b/crates/swc_bundler/tests/.cache/deno/002f5d1cbfd5e28f9167bc34bbab797dd6d45867.ts deleted file mode 100644 index 5df5dc83839f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/002f5d1cbfd5e28f9167bc34bbab797dd6d45867.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/common.ts - - -export const pngSignature = [137, 80, 78, 71, 13, 10, 26, 10]; - -const crcTable: number[] = []; -for (let n = 0; n < 256; n++) { - let c = n; - for (let k = 0; k < 8; k++) { - if (c & 1) { - c = 0xedb88320 ^ (c >>> 1); - } else { - c = c >>> 1; - } - } - crcTable[n] = c; -} - -const initialCrc = 0xffffffff; -function updateCrc( - currentCrc: number, - data: Uint8Array, - length: number, -): number { - let c = currentCrc; - for (let n = 0; n < length; n++) { - c = crcTable[(c ^ data[n]) & 0xff] ^ (c >>> 8); - } - return c; -} - -export function crc(data: Uint8Array, length: number): number { - return (updateCrc(initialCrc, data, length) ^ initialCrc) >>> 0; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0046e5420144af71c85b6f4b9d027a4872b958aa.ts b/crates/swc_bundler/tests/.cache/deno/0046e5420144af71c85b6f4b9d027a4872b958aa.ts deleted file mode 100644 index 771fe33c7ce1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0046e5420144af71c85b6f4b9d027a4872b958aa.ts +++ /dev/null @@ -1,114 +0,0 @@ -// Loaded from https://deno.land/std/encoding/hex.ts - - -// Ported from Go -// https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -const hexTable = new TextEncoder().encode("0123456789abcdef"); - -/** - * ErrInvalidByte takes an invalid byte and returns an Error. - * @param byte - */ -export function errInvalidByte(byte: number): Error { - return new Error( - "encoding/hex: invalid byte: " + - new TextDecoder().decode(new Uint8Array([byte])), - ); -} - -/** ErrLength returns an error about odd string length. */ -export function errLength(): Error { - return new Error("encoding/hex: odd length hex string"); -} - -// fromHexChar converts a hex character into its value. -function fromHexChar(byte: number): number { - // '0' <= byte && byte <= '9' - if (48 <= byte && byte <= 57) return byte - 48; - // 'a' <= byte && byte <= 'f' - if (97 <= byte && byte <= 102) return byte - 97 + 10; - // 'A' <= byte && byte <= 'F' - if (65 <= byte && byte <= 70) return byte - 65 + 10; - - throw errInvalidByte(byte); -} - -/** - * EncodedLen returns the length of an encoding of n source bytes. Specifically, - * it returns n * 2. - * @param n - */ -export function encodedLen(n: number): number { - return n * 2; -} - -/** - * Encode encodes `src` into `encodedLen(src.length)` bytes. - * @param src - */ -export function encode(src: Uint8Array): Uint8Array { - const dst = new Uint8Array(encodedLen(src.length)); - for (let i = 0; i < dst.length; i++) { - const v = src[i]; - dst[i * 2] = hexTable[v >> 4]; - dst[i * 2 + 1] = hexTable[v & 0x0f]; - } - return dst; -} - -/** - * EncodeToString returns the hexadecimal encoding of `src`. - * @param src - */ -export function encodeToString(src: Uint8Array): string { - return new TextDecoder().decode(encode(src)); -} - -/** - * Decode decodes `src` into `decodedLen(src.length)` bytes - * If the input is malformed an error will be thrown - * the error. - * @param src - */ -export function decode(src: Uint8Array): Uint8Array { - const dst = new Uint8Array(decodedLen(src.length)); - for (let i = 0; i < dst.length; i++) { - const a = fromHexChar(src[i * 2]); - const b = fromHexChar(src[i * 2 + 1]); - dst[i] = (a << 4) | b; - } - - if (src.length % 2 == 1) { - // Check for invalid char before reporting bad length, - // since the invalid char (if present) is an earlier problem. - fromHexChar(src[dst.length * 2]); - throw errLength(); - } - - return dst; -} - -/** - * DecodedLen returns the length of decoding `x` source bytes. - * Specifically, it returns `x / 2`. - * @param x - */ -export function decodedLen(x: number): number { - return x >>> 1; -} - -/** - * DecodeString returns the bytes represented by the hexadecimal string `s`. - * DecodeString expects that src contains only hexadecimal characters and that - * src has even length. - * If the input is malformed, DecodeString will throw an error. - * @param s the `string` to decode to `Uint8Array` - */ -export function decodeString(s: string): Uint8Array { - return decode(new TextEncoder().encode(s)); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0046ef139334d849e0580670a5e984a126560b34.ts b/crates/swc_bundler/tests/.cache/deno/0046ef139334d849e0580670a5e984a126560b34.ts deleted file mode 100644 index 26776f55f781..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0046ef139334d849e0580670a5e984a126560b34.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/io/mod.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -export * from "./bufio.ts"; -export * from "./ioutil.ts"; -export * from "./readers.ts"; -export * from "./writers.ts"; -export * from "./streams.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/00640c542630e1b962728650765ab970308277b3.ts b/crates/swc_bundler/tests/.cache/deno/00640c542630e1b962728650765ab970308277b3.ts deleted file mode 100644 index b7176edd08e0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/00640c542630e1b962728650765ab970308277b3.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Loaded from https://deno.land/x/validasaur/src/rules/required_when.ts - - -import type { Validity, Rule } from "../types.ts"; -import type { ValidationUtils } from "../interfaces.ts"; -import { required } from "./required.ts"; -import { optionallyValid } from "../utils.ts"; - -export function requiredWhen( - callback: ( - fieldValue: any, - validationUtils: ValidationUtils, - ) => boolean | Promise, -): Rule { - return async function requiredWhenRule( - value: any, - utils: ValidationUtils, - ): Promise { - const result = callback(value, utils); - const isRequired = result instanceof Promise ? await result : result; - if (isRequired) { - return required(value); - } - return optionallyValid(true); - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/007133b016f8a1fc63b289080efa0359d29eea83.ts b/crates/swc_bundler/tests/.cache/deno/007133b016f8a1fc63b289080efa0359d29eea83.ts deleted file mode 100644 index f2b0ca324433..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/007133b016f8a1fc63b289080efa0359d29eea83.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/channels/channel_types.ts - - -/** https://discord.com/developers/docs/resources/channel#channel-object-channel-types */ -export enum DiscordChannelTypes { - /** A text channel within a server */ - GuildText, - /** A direct message between users */ - DM, - /** A voice channel within a server */ - GuildVoice, - /** A direct message between multiple users */ - GroupDm, - /** An organizational category that contains up to 50 channels */ - GuildCategory, - /** A channel that users can follow and crosspost into their own server */ - GuildNews, - /** A channel in which game developers can sell their game on Discord */ - GuildStore, - /** A temporary sub-channel within a GUILD_NEWS channel */ - GuildNewsThread = 10, - /** A temporary sub-channel within a GUILD_TEXT channel */ - GuildPublicThread, - /** A temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission */ - GuildPivateThread, - /** A voice channel for hosting events with an audience */ - GuildStageVoice = 13, -} - -export type ChannelTypes = DiscordChannelTypes; -export const ChannelTypes = DiscordChannelTypes; diff --git a/crates/swc_bundler/tests/.cache/deno/0087dc7fd03e2d3f1c521aa350f2b1607ad513be.ts b/crates/swc_bundler/tests/.cache/deno/0087dc7fd03e2d3f1c521aa350f2b1607ad513be.ts deleted file mode 100644 index f5e54a722268..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0087dc7fd03e2d3f1c521aa350f2b1607ad513be.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/guilds/GUILD_DELETE.ts - - -import { eventHandlers } from "../../bot.ts"; -import { cacheHandlers } from "../../cache.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { UnavailableGuild } from "../../types/guilds/unavailable_guild.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; -import { ws } from "../../ws/ws.ts"; - -export async function handleGuildDelete(data: DiscordGatewayPayload, shardId: number) { - const payload = data.d as UnavailableGuild; - - const guild = await cacheHandlers.get("guilds", snowflakeToBigint(payload.id)); - if (!guild) return; - - await cacheHandlers.delete("guilds", guild.id); - - if (payload.unavailable) { - const shard = ws.shards.get(shardId); - if (shard) shard.unavailableGuildIds.add(guild.id); - await cacheHandlers.set("unavailableGuilds", guild.id, Date.now()); - - eventHandlers.guildUnavailable?.(guild); - } else { - eventHandlers.guildDelete?.(guild); - } - - cacheHandlers.forEach("messages", (message) => { - eventHandlers.debug?.("loop", `1. Running forEach messages loop in CHANNEL_DELTE file.`); - if (message.guildId === guild.id) { - cacheHandlers.delete("messages", message.id); - } - }); - - cacheHandlers.forEach("channels", (channel) => { - eventHandlers.debug?.("loop", `2. Running forEach channels loop in CHANNEL_DELTE file.`); - if (channel.guildId === guild.id) { - cacheHandlers.delete("channels", channel.id); - } - }); - - cacheHandlers.forEach("members", (member) => { - eventHandlers.debug?.("loop", `3. Running forEach members loop in CHANNEL_DELTE file.`); - if (!member.guilds.has(guild.id)) return; - - member.guilds.delete(guild.id); - - if (!member.guilds.size) { - return cacheHandlers.delete("members", member.id); - } - - cacheHandlers.set("members", member.id, member); - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/00ac2e3568aa701b50dbe03658b1969f4fa89905.ts b/crates/swc_bundler/tests/.cache/deno/00ac2e3568aa701b50dbe03658b1969f4fa89905.ts deleted file mode 100644 index 5e6a592f76f5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/00ac2e3568aa701b50dbe03658b1969f4fa89905.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isBtcAddress.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -// supports Bech32 addresses -/** - * @ignore - */ -const btc = /^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/; - -export const isBtcAddress = (str: string) => { - assertString(str); - return btc.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/00cadceb739e8646ce070b20898b7ec735abf64d.ts b/crates/swc_bundler/tests/.cache/deno/00cadceb739e8646ce070b20898b7ec735abf64d.ts deleted file mode 100644 index 8b816657b081..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/00cadceb739e8646ce070b20898b7ec735abf64d.ts +++ /dev/null @@ -1,63 +0,0 @@ -// Loaded from https://deno.land/x/validasaur/src/rules/validate_array.ts - - -import type { Validity, Rule } from "../types.ts"; -import type { RawValidationResult, ValidationUtils } from "../interfaces.ts"; -import { invalid, isOptionalValue } from "../utils.ts"; -import { required } from "./required.ts"; -import { validateValue } from "../validate.ts"; - -export interface ValidateArrayOptions { - minLength?: number; - maxLength?: number; -} - -export function validateArray( - isRequired: boolean, - rules: Rule[], - { minLength, maxLength }: ValidateArrayOptions = { - minLength: 0, - }, -): Rule[] { - return [ - ...(isRequired ? [required] : []), - async function ruleArray( - value: any, - utils: ValidationUtils, - ): Promise { - if (isRequired === false && isOptionalValue(value)) { - return; - } - - if (!Array.isArray(value)) { - return invalid("validateArray:arrayCheck", { value }, true); - } - - if (typeof minLength === "number" && value.length < minLength) { - return invalid("validateArray:minLengthCheck", { - value, - minLength: minLength, - }); - } - - if (typeof maxLength === "number" && value.length > maxLength) { - return invalid("validateArray:maxLengthCheck", { - value, - maxLength: maxLength, - }); - } - - const errors: RawValidationResult = {}; - for (let i in value) { - const errs = await validateValue(value[i], rules, utils); - if (errs.length) { - errors[i.toString()] = [...errs]; - } - } - - if (Object.keys(errors).length > 0) { - return invalid("validateArray", { value, errors }, true); - } - }, - ]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/00e80e1fcecb7f5bb763e9c4d41a4fc8646c763e.ts b/crates/swc_bundler/tests/.cache/deno/00e80e1fcecb7f5bb763e9c4d41a4fc8646c763e.ts deleted file mode 100644 index 235f9548c2ca..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/00e80e1fcecb7f5bb763e9c4d41a4fc8646c763e.ts +++ /dev/null @@ -1,57 +0,0 @@ -// Loaded from https://deno.land/x/encodeurl@1.0.0/mod.ts - - -/*! - * encodeurl - * Copyright(c) 2016 Douglas Christopher Wilson - * Copyright (c) 2020 Henry Zhuang - * MIT Licensed - */ - -/** - * RegExp to match non-URL code points, *after* encoding (i.e. not including "%") - * and including invalid escape sequences. - * @private - */ - -const ENCODE_CHARS_REGEXP = - /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g; - -/** - * RegExp to match unmatched surrogate pair. - * @private - */ - -const UNMATCHED_SURROGATE_PAIR_REGEXP = - /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g; - -/** - * String to replace unmatched surrogate pair with. - * @private - */ - -const UNMATCHED_SURROGATE_PAIR_REPLACE = "$1\uFFFD$2"; - -/** - * Encode a URL to a percent-encoded form, excluding already-encoded sequences. - * - * This function will take an already-encoded URL and encode all the non-URL - * code points. This function will not encode the "%" character unless it is - * not part of a valid sequence (`%20` will be left as-is, but `%foo` will - * be encoded as `%25foo`). - * - * This encode is meant to be "safe" and does not throw errors. It will try as - * hard as it can to properly encode the given URL, including replacing any raw, - * unpaired surrogate pairs with the Unicode replacement character prior to - * encoding. - * - * @param {string} url - * @return {string} - * @public - */ - -export function encodeUrl(url: string): string { - return String(url) - .replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE) - .replace(ENCODE_CHARS_REGEXP, encodeURI); -} diff --git a/crates/swc_bundler/tests/.cache/deno/010ed334fc1d1e67f2d47e70a3bba7078ca7c879.ts b/crates/swc_bundler/tests/.cache/deno/010ed334fc1d1e67f2d47e70a3bba7078ca7c879.ts deleted file mode 100644 index 35a62eb885a4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/010ed334fc1d1e67f2d47e70a3bba7078ca7c879.ts +++ /dev/null @@ -1,152 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/rest/process_queue.ts - - -import { eventHandlers } from "../bot.ts"; -import { DiscordHTTPResponseCodes } from "../types/codes/http_response_codes.ts"; -import { delay } from "../util/utils.ts"; -import { rest } from "./rest.ts"; - -/** Processes the queue by looping over each path separately until the queues are empty. */ -export async function processQueue(id: string) { - const queue = rest.pathQueues.get(id); - if (!queue) return; - - while (queue.length) { - rest.eventHandlers.debug?.("loop", "Running while loop in processQueue function."); - // IF THE BOT IS GLOBALLY RATELIMITED TRY AGAIN - if (rest.globallyRateLimited) { - setTimeout(async () => { - eventHandlers.debug?.("loop", `Running setTimeout in processQueue function.`); - await processQueue(id); - }, 1000); - - break; - } - // SELECT THE FIRST ITEM FROM THIS QUEUE - const [queuedRequest] = queue; - // IF THIS DOESNT HAVE ANY ITEMS JUST CANCEL, THE CLEANER WILL REMOVE IT. - if (!queuedRequest) return; - - const basicURL = rest.simplifyUrl(queuedRequest.request.url, queuedRequest.request.method.toUpperCase()); - - // IF THIS URL IS STILL RATE LIMITED, TRY AGAIN - const urlResetIn = rest.checkRateLimits(basicURL); - if (urlResetIn) { - // PAUSE FOR THIS SPECIFC REQUEST - await delay(urlResetIn); - continue; - } - - // IF A BUCKET EXISTS, CHECK THE BUCKET'S RATE LIMITS - const bucketResetIn = queuedRequest.payload.bucketId ? rest.checkRateLimits(queuedRequest.payload.bucketId) : false; - // THIS BUCKET IS STILL RATELIMITED, RE-ADD TO QUEUE - if (bucketResetIn) continue; - - // EXECUTE THE REQUEST - - // IF THIS IS A GET REQUEST, CHANGE THE BODY TO QUERY PARAMETERS - const query = - queuedRequest.request.method.toUpperCase() === "GET" && queuedRequest.payload.body - ? Object.entries(queuedRequest.payload.body) - .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value as string)}`) - .join("&") - : ""; - const urlToUse = - queuedRequest.request.method.toUpperCase() === "GET" && query - ? `${queuedRequest.request.url}?${query}` - : queuedRequest.request.url; - - // CUSTOM HANDLER FOR USER TO LOG OR WHATEVER WHENEVER A FETCH IS MADE - rest.eventHandlers.fetching(queuedRequest.payload); - - try { - const response = await fetch(urlToUse, rest.createRequestBody(queuedRequest)); - - rest.eventHandlers.fetched(queuedRequest.payload); - const bucketIdFromHeaders = rest.processRequestHeaders(basicURL, response.headers); - // SET THE BUCKET Id IF IT WAS PRESENT - if (bucketIdFromHeaders) { - queuedRequest.payload.bucketId = bucketIdFromHeaders; - } - - if (response.status < 200 || response.status >= 400) { - rest.eventHandlers.error("httpError", queuedRequest.payload, response); - - let error = "REQUEST_UNKNOWN_ERROR"; - switch (response.status) { - case DiscordHTTPResponseCodes.BadRequest: - error = "The request was improperly formatted, or the server couldn't understand it."; - break; - case DiscordHTTPResponseCodes.Unauthorized: - error = "The Authorization header was missing or invalid."; - break; - case DiscordHTTPResponseCodes.Forbidden: - error = "The Authorization token you passed did not have permission to the resource."; - break; - case DiscordHTTPResponseCodes.NotFound: - error = "The resource at the location specified doesn't exist."; - break; - case DiscordHTTPResponseCodes.MethodNotAllowed: - error = "The HTTP method used is not valid for the location specified."; - break; - case DiscordHTTPResponseCodes.GatewayUnavailable: - error = "There was not a gateway available to process your request. Wait a bit and retry."; - break; - } - - queuedRequest.request.reject?.(new Error(`[${response.status}] ${error}`)); - - // If Rate limited should not remove from queue - if (response.status !== 429) queue.shift(); - continue; - } - - // SOMETIMES DISCORD RETURNS AN EMPTY 204 RESPONSE THAT CAN'T BE MADE TO JSON - if (response.status === 204) { - rest.eventHandlers.fetchSuccess(queuedRequest.payload); - // REMOVE FROM QUEUE - queue.shift(); - queuedRequest.request.respond({ status: 204 }); - } else { - // CONVERT THE RESPONSE TO JSON - const json = await response.json(); - // IF THE RESPONSE WAS RATE LIMITED, HANDLE ACCORDINGLY - if (json.retry_after || json.message === "You are being rate limited.") { - // IF IT HAS MAXED RETRIES SOMETHING SERIOUSLY WRONG. CANCEL OUT. - if (queuedRequest.payload.retryCount >= rest.maxRetryCount) { - rest.eventHandlers.retriesMaxed(queuedRequest.payload); - queuedRequest.request.respond({ - status: 200, - body: JSON.stringify({ - error: "The request was rate limited and it maxed out the retries limit.", - }), - }); - // REMOVE ITEM FROM QUEUE TO PREVENT RETRY - queue.shift(); - continue; - } - - // SINCE IT WAS RATELIMITE, RETRY AGAIN - continue; - } - - rest.eventHandlers.fetchSuccess(queuedRequest.payload); - // REMOVE FROM QUEUE - queue.shift(); - queuedRequest.request.respond({ - status: 200, - body: JSON.stringify(json), - }); - } - } catch (error) { - // SOMETHING WENT WRONG, LOG AND RESPOND WITH ERROR - rest.eventHandlers.fetchFailed(queuedRequest.payload, error); - queuedRequest.request.reject?.(error); - // REMOVE FROM QUEUE - queue.shift(); - } - } - - // ONCE QUEUE IS DONE, WE CAN TRY CLEANING UP - rest.cleanupQueues(); -} diff --git a/crates/swc_bundler/tests/.cache/deno/013993bd641a8f773adbcb8f51d7fa01cc2065ad.ts b/crates/swc_bundler/tests/.cache/deno/013993bd641a8f773adbcb8f51d7fa01cc2065ad.ts deleted file mode 100644 index 61acf0d26601..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/013993bd641a8f773adbcb8f51d7fa01cc2065ad.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/std@0.79.0/_util/os.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -export const osType = (() => { - if (globalThis.Deno != null) { - return Deno.build.os; - } - - // deno-lint-ignore no-explicit-any - const navigator = (globalThis as any).navigator; - if (navigator?.appVersion?.includes?.("Win") ?? false) { - return "windows"; - } - - return "linux"; -})(); - -export const isWindows = osType === "windows"; diff --git a/crates/swc_bundler/tests/.cache/deno/013995dd8fd3b251611b4cc58c38d2c5fd957f74.ts b/crates/swc_bundler/tests/.cache/deno/013995dd8fd3b251611b4cc58c38d2c5fd957f74.ts deleted file mode 100644 index d7525c3d8f86..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/013995dd8fd3b251611b4cc58c38d2c5fd957f74.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/std@0.69.0/_util/assert.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -export class DenoStdInternalError extends Error { - constructor(message: string) { - super(message); - this.name = "DenoStdInternalError"; - } -} - -/** Make an assertion, if not `true`, then throw. */ -export function assert(expr: unknown, msg = ""): asserts expr { - if (!expr) { - throw new DenoStdInternalError(msg); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/013da1a69449f69887e4259f172d5b80f642e78c.ts b/crates/swc_bundler/tests/.cache/deno/013da1a69449f69887e4259f172d5b80f642e78c.ts deleted file mode 100644 index e035b7419c71..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/013da1a69449f69887e4259f172d5b80f642e78c.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueArgumentNamesRule.js - - -import { GraphQLError } from '../../error/GraphQLError.js'; - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -export function UniqueArgumentNamesRule(context) { - let knownArgNames = Object.create(null); - return { - Field() { - knownArgNames = Object.create(null); - }, - - Directive() { - knownArgNames = Object.create(null); - }, - - Argument(node) { - const argName = node.name.value; - - if (knownArgNames[argName]) { - context.reportError(new GraphQLError(`There can be only one argument named "${argName}".`, [knownArgNames[argName], node.name])); - } else { - knownArgNames[argName] = node.name; - } - - return false; - } - - }; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/01474d64962c420e64b489dc2c1ef19664ef6574.ts b/crates/swc_bundler/tests/.cache/deno/01474d64962c420e64b489dc2c1ef19664ef6574.ts deleted file mode 100644 index a0f0e28889cb..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/01474d64962c420e64b489dc2c1ef19664ef6574.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/std@0.74.0/fs/exists.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** - * Test whether or not the given path exists by checking with the file system - */ -export async function exists(filePath: string): Promise { - try { - await Deno.lstat(filePath); - return true; - } catch (err) { - if (err instanceof Deno.errors.NotFound) { - return false; - } - - throw err; - } -} - -/** - * Test whether or not the given path exists by checking with the file system - */ -export function existsSync(filePath: string): boolean { - try { - Deno.lstatSync(filePath); - return true; - } catch (err) { - if (err instanceof Deno.errors.NotFound) { - return false; - } - throw err; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/017111745f34ea7e1ee5489286bba848979bba8d.ts b/crates/swc_bundler/tests/.cache/deno/017111745f34ea7e1ee5489286bba848979bba8d.ts deleted file mode 100644 index 745ca54f0fbe..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/017111745f34ea7e1ee5489286bba848979bba8d.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/mod.ts - - -export * from "./source/index.js"; diff --git a/crates/swc_bundler/tests/.cache/deno/01815f0bfc7c38ccb35716808b637adb22658131.ts b/crates/swc_bundler/tests/.cache/deno/01815f0bfc7c38ccb35716808b637adb22658131.ts deleted file mode 100644 index 90999307a5cf..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/01815f0bfc7c38ccb35716808b637adb22658131.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/pako/lib/zlib/adler32.js - - -// Note: adler32 takes 12% for level 0 and 2% for level 6. -// It isn't worth it to make additional optimizations as in original. -// Small size is preferable. - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -export function adler32(adler, buf, len, pos) { - var s1 = (adler & 0xffff) |0, - s2 = ((adler >>> 16) & 0xffff) |0, - n = 0; - - while (len !== 0) { - // Set limit ~ twice less than 5552, to keep - // s2 in 31-bits, because we force signed ints. - // in other case %= will fail. - n = len > 2000 ? 2000 : len; - len -= n; - - do { - s1 = (s1 + buf[pos++]) |0; - s2 = (s2 + s1) |0; - } while (--n); - - s1 %= 65521; - s2 %= 65521; - } - - return (s1 | (s2 << 16)) |0; -} diff --git a/crates/swc_bundler/tests/.cache/deno/01dc08ae3d8fc0122627ab537a8afbd684ecbdea.ts b/crates/swc_bundler/tests/.cache/deno/01dc08ae3d8fc0122627ab537a8afbd684ecbdea.ts deleted file mode 100644 index 5986a291249c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/01dc08ae3d8fc0122627ab537a8afbd684ecbdea.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_isRegExp.js - - -export default function _isRegExp(x) { - return Object.prototype.toString.call(x) === '[object RegExp]'; -} diff --git a/crates/swc_bundler/tests/.cache/deno/01f6a4bddb7dd4a2399c436cf5ac1e48aeae7e53.ts b/crates/swc_bundler/tests/.cache/deno/01f6a4bddb7dd4a2399c436cf5ac1e48aeae7e53.ts deleted file mode 100644 index f685cd5dee85..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/01f6a4bddb7dd4a2399c436cf5ac1e48aeae7e53.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/command/mod.ts - - -export * from "./types.ts"; -export * from "./command.ts"; -export * from "./completions/mod.ts"; -export * from "./help/mod.ts"; -export * from "./types/action_list.ts"; -export * from "./types/boolean.ts"; -export * from "./types/child_command.ts"; -export * from "./types/number.ts"; -export * from "./types/string.ts"; -export * from "./type.ts"; -export { ValidationError } from "../flags/_errors.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/01f9532d107c1bd2d05d91b3f51d3e57711ef2b5.ts b/crates/swc_bundler/tests/.cache/deno/01f9532d107c1bd2d05d91b3f51d3e57711ef2b5.ts deleted file mode 100644 index 3ad969948542..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/01f9532d107c1bd2d05d91b3f51d3e57711ef2b5.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/ws/mod.ts - - -export * from "./cleanup_loading_shards.ts"; -export * from "./create_shard.ts"; -export * from "./events.ts"; -export * from "./handle_discord_payload.ts"; -export * from "./handle_on_message.ts"; -export * from "./heartbeat.ts"; -export * from "./identify.ts"; -export * from "./resharder.ts"; -export * from "./resume.ts"; -export * from "./spawn_shards.ts"; -export * from "./start_gateway_options.ts"; -export * from "./start_gateway.ts"; -export * from "./tell_cluster_to_identify.ts"; -export * from "./ws.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/020be644443b8947fbca69ea92ebd2ece761d2d0.ts b/crates/swc_bundler/tests/.cache/deno/020be644443b8947fbca69ea92ebd2ece761d2d0.ts deleted file mode 100644 index 93325ac1b87a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/020be644443b8947fbca69ea92ebd2ece761d2d0.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Loaded from https://deno.land/x/djwt@v1.9/_signature.ts - - -import type { Algorithm } from "./_algorithm.ts"; -import { - base64url, - convertHexToUint8Array, - HmacSha256, - HmacSha512, - RSA, -} from "./_depts.ts"; - -function assertNever(alg: never, message: string): never { - throw new RangeError(message); -} - -export function convertHexToBase64url(input: string): string { - return base64url.encode(convertHexToUint8Array(input)); -} - -/** - * Do a constant time string comparison. Always compare the complete strings - * against each other to get a constant time. This method does not short-cut - * if the two string's length differs. - * CREDIT: https://github.com/Bruce17/safe-compare - */ -function safeCompare(a: string, b: string) { - const strA = String(a); - const lenA = strA.length; - let strB = String(b); - let result = 0; - - if (lenA !== strB.length) { - strB = strA; - result = 1; - } - - for (var i = 0; i < lenA; i++) { - result |= (strA.charCodeAt(i) ^ strB.charCodeAt(i)); - } - - return result === 0; -} - -async function encrypt( - algorithm: Algorithm, - key: string, - message: string, -): Promise { - switch (algorithm) { - case "none": - return ""; - case "HS256": - return new HmacSha256(key).update(message).toString(); - case "HS512": - return new HmacSha512(key).update(message).toString(); - case "RS256": - return ( - await new RSA(RSA.parseKey(key)).sign(message, { hash: "sha256" }) - ).hex(); - default: - assertNever( - algorithm, - "no matching crypto algorithm in the header: " + algorithm, - ); - } -} - -export async function create( - algorithm: Algorithm, - key: string, - input: string, -): Promise { - return convertHexToBase64url(await encrypt(algorithm, key, input)); -} - -export async function verify({ - signature, - key, - algorithm, - signingInput, -}: { - signature: string; - key: string; - algorithm: Algorithm; - signingInput: string; -}): Promise { - switch (algorithm) { - case "none": - case "HS256": - case "HS512": { - return safeCompare( - signature, - (await encrypt(algorithm, key, signingInput)), - ); - } - case "RS256": { - return await new RSA(RSA.parseKey(key)).verify( - convertHexToUint8Array(signature), - signingInput, - { hash: "sha256" }, - ); - } - default: - assertNever( - algorithm, - "no matching crypto algorithm in the header: " + algorithm, - ); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/020cccee8635a75fe889ea33c2a663e761999e24.ts b/crates/swc_bundler/tests/.cache/deno/020cccee8635a75fe889ea33c2a663e761999e24.ts deleted file mode 100644 index b103d9c0ee9c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/020cccee8635a75fe889ea33c2a663e761999e24.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/guilds/get_audit_logs.ts - - -import { rest } from "../../rest/rest.ts"; -import type { AuditLog } from "../../types/audit_log/audit_log.ts"; -import type { GetGuildAuditLog } from "../../types/audit_log/get_guild_audit_log.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; -import { snakelize } from "../../util/utils.ts"; - -/** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */ -export async function getAuditLogs(guildId: bigint, options: Partial) { - await requireBotGuildPermissions(guildId, ["VIEW_AUDIT_LOG"]); - - return await rest.runMethod( - "get", - endpoints.GUILD_AUDIT_LOGS(guildId), - snakelize({ - ...options, - limit: options.limit && options.limit >= 1 && options.limit <= 100 ? options.limit : 50, - }) - ); -} diff --git a/crates/swc_bundler/tests/.cache/deno/020e7c93fbe1e18a705db3506ade9f67fb9bf81b.ts b/crates/swc_bundler/tests/.cache/deno/020e7c93fbe1e18a705db3506ade9f67fb9bf81b.ts deleted file mode 100644 index cfb272b93670..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/020e7c93fbe1e18a705db3506ade9f67fb9bf81b.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/subscription/index.js - - -export { subscribe, createSourceEventStream } from './subscribe.js'; \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/022b6a900d4aee51362ccb4701c84a4d771ec2d3.ts b/crates/swc_bundler/tests/.cache/deno/022b6a900d4aee51362ccb4701c84a4d771ec2d3.ts deleted file mode 100644 index 6eb6cbf9e3f8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/022b6a900d4aee51362ccb4701c84a4d771ec2d3.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Loaded from https://deno.land/x/case/paramCase.ts - - -import normalCase from "./normalCase.ts"; - -export default function paramCase(value: string, locale?: string): string { - return normalCase(value, locale, "-"); -} diff --git a/crates/swc_bundler/tests/.cache/deno/02935e5502cec01d27691615f6fdbae907e86c3c.ts b/crates/swc_bundler/tests/.cache/deno/02935e5502cec01d27691615f6fdbae907e86c3c.ts deleted file mode 100644 index 480193baac32..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/02935e5502cec01d27691615f6fdbae907e86c3c.ts +++ /dev/null @@ -1,525 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/fmt/colors.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors -// on npm. -// -// ``` -// import { bgBlue, red, bold } from "https://deno.land/std/fmt/colors.ts"; -// console.log(bgBlue(red(bold("Hello world!")))); -// ``` -// -// This module supports `NO_COLOR` environmental variable disabling any coloring -// if `NO_COLOR` is set. -// -// This module is browser compatible. - -const noColor = globalThis.Deno?.noColor ?? true; - -interface Code { - open: string; - close: string; - regexp: RegExp; -} - -/** RGB 8-bits per channel. Each in range `0->255` or `0x00->0xff` */ -interface Rgb { - r: number; - g: number; - b: number; -} - -let enabled = !noColor; - -/** - * Set changing text color to enabled or disabled - * @param value - */ -export function setColorEnabled(value: boolean): void { - if (noColor) { - return; - } - - enabled = value; -} - -/** Get whether text color change is enabled or disabled. */ -export function getColorEnabled(): boolean { - return enabled; -} - -/** - * Builds color code - * @param open - * @param close - */ -function code(open: number[], close: number): Code { - return { - open: `\x1b[${open.join(";")}m`, - close: `\x1b[${close}m`, - regexp: new RegExp(`\\x1b\\[${close}m`, "g"), - }; -} - -/** - * Applies color and background based on color code and its associated text - * @param str text to apply color settings to - * @param code color code to apply - */ -function run(str: string, code: Code): string { - return enabled - ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` - : str; -} - -/** - * Reset the text modified - * @param str text to reset - */ -export function reset(str: string): string { - return run(str, code([0], 0)); -} - -/** - * Make the text bold. - * @param str text to make bold - */ -export function bold(str: string): string { - return run(str, code([1], 22)); -} - -/** - * The text emits only a small amount of light. - * @param str text to dim - */ -export function dim(str: string): string { - return run(str, code([2], 22)); -} - -/** - * Make the text italic. - * @param str text to make italic - */ -export function italic(str: string): string { - return run(str, code([3], 23)); -} - -/** - * Make the text underline. - * @param str text to underline - */ -export function underline(str: string): string { - return run(str, code([4], 24)); -} - -/** - * Invert background color and text color. - * @param str text to invert its color - */ -export function inverse(str: string): string { - return run(str, code([7], 27)); -} - -/** - * Make the text hidden. - * @param str text to hide - */ -export function hidden(str: string): string { - return run(str, code([8], 28)); -} - -/** - * Put horizontal line through the center of the text. - * @param str text to strike through - */ -export function strikethrough(str: string): string { - return run(str, code([9], 29)); -} - -/** - * Set text color to black. - * @param str text to make black - */ -export function black(str: string): string { - return run(str, code([30], 39)); -} - -/** - * Set text color to red. - * @param str text to make red - */ -export function red(str: string): string { - return run(str, code([31], 39)); -} - -/** - * Set text color to green. - * @param str text to make green - */ -export function green(str: string): string { - return run(str, code([32], 39)); -} - -/** - * Set text color to yellow. - * @param str text to make yellow - */ -export function yellow(str: string): string { - return run(str, code([33], 39)); -} - -/** - * Set text color to blue. - * @param str text to make blue - */ -export function blue(str: string): string { - return run(str, code([34], 39)); -} - -/** - * Set text color to magenta. - * @param str text to make magenta - */ -export function magenta(str: string): string { - return run(str, code([35], 39)); -} - -/** - * Set text color to cyan. - * @param str text to make cyan - */ -export function cyan(str: string): string { - return run(str, code([36], 39)); -} - -/** - * Set text color to white. - * @param str text to make white - */ -export function white(str: string): string { - return run(str, code([37], 39)); -} - -/** - * Set text color to gray. - * @param str text to make gray - */ -export function gray(str: string): string { - return brightBlack(str); -} - -/** - * Set text color to bright black. - * @param str text to make bright-black - */ -export function brightBlack(str: string): string { - return run(str, code([90], 39)); -} - -/** - * Set text color to bright red. - * @param str text to make bright-red - */ -export function brightRed(str: string): string { - return run(str, code([91], 39)); -} - -/** - * Set text color to bright green. - * @param str text to make bright-green - */ -export function brightGreen(str: string): string { - return run(str, code([92], 39)); -} - -/** - * Set text color to bright yellow. - * @param str text to make bright-yellow - */ -export function brightYellow(str: string): string { - return run(str, code([93], 39)); -} - -/** - * Set text color to bright blue. - * @param str text to make bright-blue - */ -export function brightBlue(str: string): string { - return run(str, code([94], 39)); -} - -/** - * Set text color to bright magenta. - * @param str text to make bright-magenta - */ -export function brightMagenta(str: string): string { - return run(str, code([95], 39)); -} - -/** - * Set text color to bright cyan. - * @param str text to make bright-cyan - */ -export function brightCyan(str: string): string { - return run(str, code([96], 39)); -} - -/** - * Set text color to bright white. - * @param str text to make bright-white - */ -export function brightWhite(str: string): string { - return run(str, code([97], 39)); -} - -/** - * Set background color to black. - * @param str text to make its background black - */ -export function bgBlack(str: string): string { - return run(str, code([40], 49)); -} - -/** - * Set background color to red. - * @param str text to make its background red - */ -export function bgRed(str: string): string { - return run(str, code([41], 49)); -} - -/** - * Set background color to green. - * @param str text to make its background green - */ -export function bgGreen(str: string): string { - return run(str, code([42], 49)); -} - -/** - * Set background color to yellow. - * @param str text to make its background yellow - */ -export function bgYellow(str: string): string { - return run(str, code([43], 49)); -} - -/** - * Set background color to blue. - * @param str text to make its background blue - */ -export function bgBlue(str: string): string { - return run(str, code([44], 49)); -} - -/** - * Set background color to magenta. - * @param str text to make its background magenta - */ -export function bgMagenta(str: string): string { - return run(str, code([45], 49)); -} - -/** - * Set background color to cyan. - * @param str text to make its background cyan - */ -export function bgCyan(str: string): string { - return run(str, code([46], 49)); -} - -/** - * Set background color to white. - * @param str text to make its background white - */ -export function bgWhite(str: string): string { - return run(str, code([47], 49)); -} - -/** - * Set background color to bright black. - * @param str text to make its background bright-black - */ -export function bgBrightBlack(str: string): string { - return run(str, code([100], 49)); -} - -/** - * Set background color to bright red. - * @param str text to make its background bright-red - */ -export function bgBrightRed(str: string): string { - return run(str, code([101], 49)); -} - -/** - * Set background color to bright green. - * @param str text to make its background bright-green - */ -export function bgBrightGreen(str: string): string { - return run(str, code([102], 49)); -} - -/** - * Set background color to bright yellow. - * @param str text to make its background bright-yellow - */ -export function bgBrightYellow(str: string): string { - return run(str, code([103], 49)); -} - -/** - * Set background color to bright blue. - * @param str text to make its background bright-blue - */ -export function bgBrightBlue(str: string): string { - return run(str, code([104], 49)); -} - -/** - * Set background color to bright magenta. - * @param str text to make its background bright-magenta - */ -export function bgBrightMagenta(str: string): string { - return run(str, code([105], 49)); -} - -/** - * Set background color to bright cyan. - * @param str text to make its background bright-cyan - */ -export function bgBrightCyan(str: string): string { - return run(str, code([106], 49)); -} - -/** - * Set background color to bright white. - * @param str text to make its background bright-white - */ -export function bgBrightWhite(str: string): string { - return run(str, code([107], 49)); -} - -/* Special Color Sequences */ - -/** - * Clam and truncate color codes - * @param n - * @param max number to truncate to - * @param min number to truncate from - */ -function clampAndTruncate(n: number, max = 255, min = 0): number { - return Math.trunc(Math.max(Math.min(n, max), min)); -} - -/** - * Set text color using paletted 8bit colors. - * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit - * @param str text color to apply paletted 8bit colors to - * @param color code - */ -export function rgb8(str: string, color: number): string { - return run(str, code([38, 5, clampAndTruncate(color)], 39)); -} - -/** - * Set background color using paletted 8bit colors. - * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit - * @param str text color to apply paletted 8bit background colors to - * @param color code - */ -export function bgRgb8(str: string, color: number): string { - return run(str, code([48, 5, clampAndTruncate(color)], 49)); -} - -/** - * Set text color using 24bit rgb. - * `color` can be a number in range `0x000000` to `0xffffff` or - * an `Rgb`. - * - * To produce the color magenta: - * - * rgb24("foo", 0xff00ff); - * rgb24("foo", {r: 255, g: 0, b: 255}); - * @param str text color to apply 24bit rgb to - * @param color code - */ -export function rgb24(str: string, color: number | Rgb): string { - if (typeof color === "number") { - return run( - str, - code( - [38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], - 39, - ), - ); - } - return run( - str, - code( - [ - 38, - 2, - clampAndTruncate(color.r), - clampAndTruncate(color.g), - clampAndTruncate(color.b), - ], - 39, - ), - ); -} - -/** - * Set background color using 24bit rgb. - * `color` can be a number in range `0x000000` to `0xffffff` or - * an `Rgb`. - * - * To produce the color magenta: - * - * bgRgb24("foo", 0xff00ff); - * bgRgb24("foo", {r: 255, g: 0, b: 255}); - * @param str text color to apply 24bit rgb to - * @param color code - */ -export function bgRgb24(str: string, color: number | Rgb): string { - if (typeof color === "number") { - return run( - str, - code( - [48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], - 49, - ), - ); - } - return run( - str, - code( - [ - 48, - 2, - clampAndTruncate(color.r), - clampAndTruncate(color.g), - clampAndTruncate(color.b), - ], - 49, - ), - ); -} - -// https://github.com/chalk/ansi-regex/blob/2b56fb0c7a07108e5b54241e8faec160d393aedb/index.js -const ANSI_PATTERN = new RegExp( - [ - "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", - "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", - ].join("|"), - "g", -); - -/** - * Remove ANSI escape codes from the string. - * @param string to remove ANSI escape codes from - */ -export function stripColor(string: string): string { - return string.replace(ANSI_PATTERN, ""); -} diff --git a/crates/swc_bundler/tests/.cache/deno/02afa43de67db405fc53f955efba75216682ef07.ts b/crates/swc_bundler/tests/.cache/deno/02afa43de67db405fc53f955efba75216682ef07.ts deleted file mode 100644 index f0372cd20003..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/02afa43de67db405fc53f955efba75216682ef07.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Loaded from https://deno.land/std@0.78.0/encoding/_yaml/mark.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { repeat } from "./utils.ts"; - -export class Mark { - constructor( - public name: string, - public buffer: string, - public position: number, - public line: number, - public column: number, - ) {} - - public getSnippet(indent = 4, maxLength = 75): string | null { - if (!this.buffer) return null; - - let head = ""; - let start = this.position; - - while ( - start > 0 && - "\x00\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1 - ) { - start -= 1; - if (this.position - start > maxLength / 2 - 1) { - head = " ... "; - start += 5; - break; - } - } - - let tail = ""; - let end = this.position; - - while ( - end < this.buffer.length && - "\x00\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1 - ) { - end += 1; - if (end - this.position > maxLength / 2 - 1) { - tail = " ... "; - end -= 5; - break; - } - } - - const snippet = this.buffer.slice(start, end); - return `${repeat(" ", indent)}${head}${snippet}${tail}\n${ - repeat( - " ", - indent + this.position - start + head.length, - ) - }^`; - } - - public toString(compact?: boolean): string { - let snippet, - where = ""; - - if (this.name) { - where += `in "${this.name}" `; - } - - where += `at line ${this.line + 1}, column ${this.column + 1}`; - - if (!compact) { - snippet = this.getSnippet(); - - if (snippet) { - where += `:\n${snippet}`; - } - } - - return where; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/02bfa7ac84cde68442aeb8e2b62e0ec94dbd0a41.ts b/crates/swc_bundler/tests/.cache/deno/02bfa7ac84cde68442aeb8e2b62e0ec94dbd0a41.ts deleted file mode 100644 index fd340e718f6d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/02bfa7ac84cde68442aeb8e2b62e0ec94dbd0a41.ts +++ /dev/null @@ -1,390 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/path/glob.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -import { osType } from "../_util/os.ts"; -import { join, normalize } from "./mod.ts"; -import { SEP, SEP_PATTERN } from "./separator.ts"; - -export interface GlobOptions { - /** Extended glob syntax. - * See https://www.linuxjournal.com/content/bash-extended-globbing. Defaults - * to true. */ - extended?: boolean; - /** Globstar syntax. - * See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * If false, `**` is treated like `*`. Defaults to true. */ - globstar?: boolean; - /** Operating system. Defaults to the native OS. */ - os?: typeof Deno.build.os; -} - -export type GlobToRegExpOptions = GlobOptions; - -// deno-fmt-ignore -const regExpEscapeChars = ["!", "$", "(", ")", "*", "+", ".", "=", "?", "[", "\\", "^", "{", "|"]; -const rangeEscapeChars = ["-", "\\", "]"]; - -/** Convert a glob string to a regular expression. - * - * Tries to match bash glob expansion as closely as possible. - * - * Basic glob syntax: - * - `*` - Matches everything without leaving the path segment. - * - `{foo,bar}` - Matches `foo` or `bar`. - * - `[abcd]` - Matches `a`, `b`, `c` or `d`. - * - `[a-d]` - Matches `a`, `b`, `c` or `d`. - * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`. - * - `[[::]]` - Matches any character belonging to ``. - * - `[[:alnum:]]` - Matches any digit or letter. - * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`. - * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes - * for a complete list of supported character classes. - * - `\` - Escapes the next character for an `os` other than `"windows"`. - * - \` - Escapes the next character for `os` set to `"windows"`. - * - `/` - Path separator. - * - `\` - Additional path separator only for `os` set to `"windows"`. - * - * Extended syntax: - * - Requires `{ extended: true }`. - * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`. - * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same. - * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`. - * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`. - * - `!(foo|bar)` - Matches anything other than `{foo,bar}`. - * - See https://www.linuxjournal.com/content/bash-extended-globbing. - * - * Globstar syntax: - * - Requires `{ globstar: true }`. - * - `**` - Matches any number of any path segments. - * - Must comprise its entire path segment in the provided glob. - * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * - * Note the following properties: - * - The generated `RegExp` is anchored at both start and end. - * - Repeating and trailing separators are tolerated. Trailing separators in the - * provided glob have no meaning and are discarded. - * - Absolute globs will only match absolute paths, etc. - * - Empty globs will match nothing. - * - Any special glob syntax must be contained to one path segment. For example, - * `?(foo|bar/baz)` is invalid. The separator will take precendence and the - * first segment ends with an unclosed group. - * - If a path segment ends with unclosed groups or a dangling escape prefix, a - * parse error has occured. Every character for that segment is taken - * literally in this event. - * - * Limitations: - * - A negative group like `!(foo|bar)` will wrongly be converted to a negative - * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly - * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively, - * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if - * the group occurs not nested at the end of the segment. */ -export function globToRegExp( - glob: string, - { extended = true, globstar: globstarOption = true, os = osType }: - GlobToRegExpOptions = {}, -): RegExp { - if (glob == "") { - return /(?!)/; - } - - const sep = os == "windows" ? "(?:\\\\|/)+" : "/+"; - const sepMaybe = os == "windows" ? "(?:\\\\|/)*" : "/*"; - const seps = os == "windows" ? ["\\", "/"] : ["/"]; - const globstar = os == "windows" - ? "(?:[^\\\\/]*(?:\\\\|/|$)+)*" - : "(?:[^/]*(?:/|$)+)*"; - const wildcard = os == "windows" ? "[^\\\\/]*" : "[^/]*"; - const escapePrefix = os == "windows" ? "`" : "\\"; - - // Remove trailing separators. - let newLength = glob.length; - for (; newLength > 1 && seps.includes(glob[newLength - 1]); newLength--); - glob = glob.slice(0, newLength); - - let regExpString = ""; - - // Terminates correctly. Trust that `j` is incremented every iteration. - for (let j = 0; j < glob.length;) { - let segment = ""; - const groupStack = []; - let inRange = false; - let inEscape = false; - let endsWithSep = false; - let i = j; - - // Terminates with `i` at the non-inclusive end of the current segment. - for (; i < glob.length && !seps.includes(glob[i]); i++) { - if (inEscape) { - inEscape = false; - const escapeChars = inRange ? rangeEscapeChars : regExpEscapeChars; - segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - continue; - } - - if (glob[i] == escapePrefix) { - inEscape = true; - continue; - } - - if (glob[i] == "[") { - if (!inRange) { - inRange = true; - segment += "["; - if (glob[i + 1] == "!") { - i++; - segment += "^"; - } else if (glob[i + 1] == "^") { - i++; - segment += "\\^"; - } - continue; - } else if (glob[i + 1] == ":") { - let k = i + 1; - let value = ""; - while (glob[k + 1] != null && glob[k + 1] != ":") { - value += glob[k + 1]; - k++; - } - if (glob[k + 1] == ":" && glob[k + 2] == "]") { - i = k + 2; - if (value == "alnum") segment += "\\dA-Za-z"; - else if (value == "alpha") segment += "A-Za-z"; - else if (value == "ascii") segment += "\x00-\x7F"; - else if (value == "blank") segment += "\t "; - else if (value == "cntrl") segment += "\x00-\x1F\x7F"; - else if (value == "digit") segment += "\\d"; - else if (value == "graph") segment += "\x21-\x7E"; - else if (value == "lower") segment += "a-z"; - else if (value == "print") segment += "\x20-\x7E"; - else if (value == "punct") { - segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~"; - } else if (value == "space") segment += "\\s\v"; - else if (value == "upper") segment += "A-Z"; - else if (value == "word") segment += "\\w"; - else if (value == "xdigit") segment += "\\dA-Fa-f"; - continue; - } - } - } - - if (glob[i] == "]" && inRange) { - inRange = false; - segment += "]"; - continue; - } - - if (inRange) { - if (glob[i] == "\\") { - segment += `\\\\`; - } else { - segment += glob[i]; - } - continue; - } - - if ( - glob[i] == ")" && groupStack.length > 0 && - groupStack[groupStack.length - 1] != "BRACE" - ) { - segment += ")"; - const type = groupStack.pop()!; - if (type == "!") { - segment += wildcard; - } else if (type != "@") { - segment += type; - } - continue; - } - - if ( - glob[i] == "|" && groupStack.length > 0 && - groupStack[groupStack.length - 1] != "BRACE" - ) { - segment += "|"; - continue; - } - - if (glob[i] == "+" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("+"); - segment += "(?:"; - continue; - } - - if (glob[i] == "@" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("@"); - segment += "(?:"; - continue; - } - - if (glob[i] == "?") { - if (extended && glob[i + 1] == "(") { - i++; - groupStack.push("?"); - segment += "(?:"; - } else { - segment += "."; - } - continue; - } - - if (glob[i] == "!" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("!"); - segment += "(?!"; - continue; - } - - if (glob[i] == "{") { - groupStack.push("BRACE"); - segment += "(?:"; - continue; - } - - if (glob[i] == "}" && groupStack[groupStack.length - 1] == "BRACE") { - groupStack.pop(); - segment += ")"; - continue; - } - - if (glob[i] == "," && groupStack[groupStack.length - 1] == "BRACE") { - segment += "|"; - continue; - } - - if (glob[i] == "*") { - if (extended && glob[i + 1] == "(") { - i++; - groupStack.push("*"); - segment += "(?:"; - } else { - const prevChar = glob[i - 1]; - let numStars = 1; - while (glob[i + 1] == "*") { - i++; - numStars++; - } - const nextChar = glob[i + 1]; - if ( - globstarOption && numStars == 2 && - [...seps, undefined].includes(prevChar) && - [...seps, undefined].includes(nextChar) - ) { - segment += globstar; - endsWithSep = true; - } else { - segment += wildcard; - } - } - continue; - } - - segment += regExpEscapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - } - - // Check for unclosed groups or a dangling backslash. - if (groupStack.length > 0 || inRange || inEscape) { - // Parse failure. Take all characters from this segment literally. - segment = ""; - for (const c of glob.slice(j, i)) { - segment += regExpEscapeChars.includes(c) ? `\\${c}` : c; - endsWithSep = false; - } - } - - regExpString += segment; - if (!endsWithSep) { - regExpString += i < glob.length ? sep : sepMaybe; - endsWithSep = true; - } - - // Terminates with `i` at the start of the next segment. - while (seps.includes(glob[i])) i++; - - // Check that the next value of `j` is indeed higher than the current value. - if (!(i > j)) { - throw new Error("Assertion failure: i > j (potential infinite loop)"); - } - j = i; - } - - regExpString = `^${regExpString}$`; - return new RegExp(regExpString); -} - -/** Test whether the given string is a glob */ -export function isGlob(str: string): boolean { - const chars: Record = { "{": "}", "(": ")", "[": "]" }; - const regex = - /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; - - if (str === "") { - return false; - } - - let match: RegExpExecArray | null; - - while ((match = regex.exec(str))) { - if (match[2]) return true; - let idx = match.index + match[0].length; - - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - const open = match[1]; - const close = open ? chars[open] : null; - if (open && close) { - const n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - - str = str.slice(idx); - } - - return false; -} - -/** Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. */ -export function normalizeGlob( - glob: string, - { globstar = false }: GlobOptions = {}, -): string { - if (glob.match(/\0/g)) { - throw new Error(`Glob contains invalid characters: "${glob}"`); - } - if (!globstar) { - return normalize(glob); - } - const s = SEP_PATTERN.source; - const badParentPattern = new RegExp( - `(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, - "g", - ); - return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); -} - -/** Like join(), but doesn't collapse "**\/.." when `globstar` is true. */ -export function joinGlobs( - globs: string[], - { extended = false, globstar = false }: GlobOptions = {}, -): string { - if (!globstar || globs.length == 0) { - return join(...globs); - } - if (globs.length === 0) return "."; - let joined: string | undefined; - for (const glob of globs) { - const path = glob; - if (path.length > 0) { - if (!joined) joined = path; - else joined += `${SEP}${path}`; - } - } - if (!joined) return "."; - return normalizeGlob(joined, { extended, globstar }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/02db72652992953a61416af10d0e488d6a114481.ts b/crates/swc_bundler/tests/.cache/deno/02db72652992953a61416af10d0e488d6a114481.ts deleted file mode 100644 index 73fc0412b5d7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/02db72652992953a61416af10d0e488d6a114481.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/ws/heartbeat.ts - - -import { DiscordGatewayOpcodes } from "../types/codes/gateway_opcodes.ts"; -import { delay } from "../util/utils.ts"; -import { identify } from "./identify.ts"; -import { ws } from "./ws.ts"; - -export async function heartbeat(shardId: number, interval: number) { - ws.log("HEARTBEATING_STARTED", { shardId, interval }); - - const shard = ws.shards.get(shardId); - if (!shard) return; - - ws.log("HEARTBEATING_DETAILS", { shardId, interval, shard }); - - // The first heartbeat is special so we send it without setInterval: https://discord.com/developers/docs/topics/gateway#heartbeating - await delay(Math.floor(shard.heartbeat.interval * Math.random())); - - if (shard.ws.readyState !== WebSocket.OPEN) return; - - shard.ws.send( - JSON.stringify({ - op: DiscordGatewayOpcodes.Heartbeat, - d: shard.previousSequenceNumber, - }) - ); - - shard.heartbeat.keepAlive = true; - shard.heartbeat.acknowledged = false; - shard.heartbeat.lastSentAt = Date.now(); - shard.heartbeat.interval = interval; - - shard.heartbeat.intervalId = setInterval(() => { - ws.log("DEBUG", `Running setInterval in heartbeat file.`); - const currentShard = ws.shards.get(shardId); - if (!currentShard) return; - - ws.log("HEARTBEATING", { shardId, shard: currentShard }); - - if (currentShard.ws.readyState === WebSocket.CLOSED || !currentShard.heartbeat.keepAlive) { - ws.log("HEARTBEATING_CLOSED", { shardId, shard: currentShard }); - - // STOP THE HEARTBEAT - return clearInterval(shard.heartbeat.intervalId); - } - - if (!currentShard.heartbeat.acknowledged) { - ws.closeWS(currentShard.ws, 3066, "Did not receive an ACK in time."); - return identify(shardId, ws.maxShards); - } - - if (currentShard.ws.readyState !== WebSocket.OPEN) return; - - currentShard.heartbeat.acknowledged = false; - - currentShard.ws.send( - JSON.stringify({ - op: DiscordGatewayOpcodes.Heartbeat, - d: currentShard.previousSequenceNumber, - }) - ); - }, shard.heartbeat.interval); -} diff --git a/crates/swc_bundler/tests/.cache/deno/02e85e08c4a126f8a100950ecb56cf3d85566557.ts b/crates/swc_bundler/tests/.cache/deno/02e85e08c4a126f8a100950ecb56cf3d85566557.ts deleted file mode 100644 index 4e2b460a5ee7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/02e85e08c4a126f8a100950ecb56cf3d85566557.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/channels/THREAD_DELETE.ts - - -import { eventHandlers } from "../../bot.ts"; -import { cacheHandlers } from "../../cache.ts"; -import { Channel } from "../../types/channels/channel.ts"; -import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; - -export async function handleThreadDelete(data: DiscordGatewayPayload) { - const payload = data.d as Channel; - - const cachedChannel = await cacheHandlers.get("channels", snowflakeToBigint(payload.id)); - if (!cachedChannel) return; - - await cacheHandlers.delete("channels", snowflakeToBigint(payload.id)); - cacheHandlers.forEach("messages", (message) => { - eventHandlers.debug?.("loop", `Running forEach messages loop in CHANNEL_DELTE file.`); - if (message.channelId === snowflakeToBigint(payload.id)) { - cacheHandlers.delete("messages", message.id); - } - }); - - eventHandlers.threadDelete?.(cachedChannel); -} diff --git a/crates/swc_bundler/tests/.cache/deno/02f1f752554e9c3f05fe3472f405d989a016815d.ts b/crates/swc_bundler/tests/.cache/deno/02f1f752554e9c3f05fe3472f405d989a016815d.ts deleted file mode 100644 index 80ae80fd83d8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/02f1f752554e9c3f05fe3472f405d989a016815d.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/equals.js - - -import _curry2 from './internal/_curry2.js'; -import _equals from './internal/_equals.js'; - - -/** - * Returns `true` if its arguments are equivalent, `false` otherwise. Handles - * cyclical data structures. - * - * Dispatches symmetrically to the `equals` methods of both arguments, if - * present. - * - * @func - * @memberOf R - * @since v0.15.0 - * @category Relation - * @sig a -> b -> Boolean - * @param {*} a - * @param {*} b - * @return {Boolean} - * @example - * - * R.equals(1, 1); //=> true - * R.equals(1, '1'); //=> false - * R.equals([1, 2, 3], [1, 2, 3]); //=> true - * - * const a = {}; a.v = a; - * const b = {}; b.v = b; - * R.equals(a, b); //=> true - */ -var equals = _curry2(function equals(a, b) { - return _equals(a, b, [], []); -}); -export default equals; diff --git a/crates/swc_bundler/tests/.cache/deno/02fec2e21e7ad66e6023abe2223435a89f34b31b.ts b/crates/swc_bundler/tests/.cache/deno/02fec2e21e7ad66e6023abe2223435a89f34b31b.ts deleted file mode 100644 index e930aa3dec31..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/02fec2e21e7ad66e6023abe2223435a89f34b31b.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isUUID.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * @ignore - */ -const uuid = { - 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, - 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, - 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, - all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i, -}; - -export const isUUID = (str: string, version: 3 | 4 | 5 | 'all' = 'all') => { - assertString(str); - const pattern = (uuid as any)[version]; - return pattern && pattern.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/03076ce0e8c0d32d269eb5f3055675ccfefa5698.ts b/crates/swc_bundler/tests/.cache/deno/03076ce0e8c0d32d269eb5f3055675ccfefa5698.ts deleted file mode 100644 index 00d1912e0a0b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/03076ce0e8c0d32d269eb5f3055675ccfefa5698.ts +++ /dev/null @@ -1,443 +0,0 @@ -// Loaded from https://deno.land/x/status@0.1.0/codes.ts - - -// Copyright 2020 Filippo Rossi. All rights reserved. MIT license. - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.3 - * - * The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing. - */ -export const ACCEPTED = 202; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.3 - * - * This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response. - */ -export const BAD_GATEWAY = 502; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.1 - * - * This response means that server could not understand the request due to invalid syntax. - */ -export const BAD_REQUEST = 400; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8 - * - * This response is sent when a request conflicts with the current state of the server. - */ -export const CONFLICT = 409; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1 - * - * This interim response indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished. - */ -export const CONTINUE = 100; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2 - * - * The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request. - */ -export const CREATED = 201; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.14 - * - * This response code means the expectation indicated by the Expect request header field can't be met by the server. - */ -export const EXPECTATION_FAILED = 417; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.5 - * - * The request failed due to failure of a previous request. - */ -export const FAILED_DEPENDENCY = 424; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3 - * - * The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to give proper response. Unlike 401, the client's identity is known to the server. - */ -export const FORBIDDEN = 403; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.5 - * - * This error response is given when the server is acting as a gateway and cannot get a response in time. - */ -export const GATEWAY_TIMEOUT = 504; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9 - * - * This response would be sent when the requested content has been permenantly deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for "limited-time, promotional services". APIs should not feel compelled to indicate resources that have been deleted with this status code. - */ -export const GONE = 410; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.6 - * - * The HTTP version used in the request is not supported by the server. - */ -export const HTTP_VERSION_NOT_SUPPORTED = 505; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc2324#section-2.3.2 - * - * Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout. - */ -export const IM_A_TEAPOT = 418; - -/** - * UNOFFICIAL w/ NO DOCS - */ -export const INSUFFICIENT_SPACE_ON_RESOURCE = 419; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6 - * - * The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process. - */ -export const INSUFFICIENT_STORAGE = 507; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.1 - * - * The server has encountered a situation it doesn't know how to handle. - */ -export const INTERNAL_SERVER_ERROR = 500; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.10 - * - * Server rejected the request because the Content-Length header field is not defined and the server requires it. - */ -export const LENGTH_REQUIRED = 411; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.4 - * - * The resource that is being accessed is locked. - */ -export const LOCKED = 423; - -/** - * @deprecated - * A deprecated response used by the Spring Framework when a method has failed. - */ -export const METHOD_FAILURE = 420; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5 - * - * The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code. - */ -export const METHOD_NOT_ALLOWED = 405; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.2 - * - * This response code means that URI of requested resource has been changed. Probably, new URI would be given in the response. - */ -export const MOVED_PERMANENTLY = 301; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.3 - * - * This response code means that URI of requested resource has been changed temporarily. New changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests. - */ -export const MOVED_TEMPORARILY = 302; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.2 - * - * A Multi-Status response conveys information about multiple resources in situations where multiple status codes might be appropriate. - */ -export const MULTI_STATUS = 207; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.1 - * - * The request has more than one possible responses. User-agent or user should choose one of them. There is no standardized way to choose one of the responses. - */ -export const MULTIPLE_CHOICES = 300; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-6 - * - * The 511 status code indicates that the client needs to authenticate to gain network access. - */ -export const NETWORK_AUTHENTICATION_REQUIRED = 511; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5 - * - * There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones. - */ -export const NO_CONTENT = 204; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4 - * This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response. - */ -export const NON_AUTHORITATIVE_INFORMATION = 203; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.6 - * - * This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content following the criteria given by the user agent. - */ -export const NOT_ACCEPTABLE = 406; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.4 - * - * The server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurence on the web. - */ -export const NOT_FOUND = 404; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2 - * - * The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD. - */ -export const NOT_IMPLEMENTED = 501; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1 - * - * This is used for caching purposes. It is telling to client that response has not been modified. So, client can continue to use same cached version of response. - */ -export const NOT_MODIFIED = 304; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1 - * - * The request has succeeded. The meaning of a success varies depending on the HTTP method: - * GET: The resource has been fetched and is transmitted in the message body. - * HEAD: The entity headers are in the message body. - * POST: The resource describing the result of the action is transmitted in the message body. - * TRACE: The message body contains the request message as received by the server - */ -export const OK = 200; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.1 - * - * This response code is used because of range header sent by the client to separate download into multiple streams. - */ -export const PARTIAL_CONTENT = 206; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2 - * - * This response code is reserved for future use. Initial aim for creating this code was using it for digital payment systems however this is not used currently. - */ -export const PAYMENT_REQUIRED = 402; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7538#section-3 - * - * This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request. - */ -export const PERMANENT_REDIRECT = 308; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.2 - * - * The client has indicated preconditions in its headers which the server does not meet. - */ -export const PRECONDITION_FAILED = 412; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-3 - * - * The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. - */ -export const PRECONDITION_REQUIRED = 428; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.1 - * - * This code indicates that the server has received and is processing the request, but no response is available yet. - */ -export const PROCESSING = 102; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.2 - * - * This is similar to 401 but authentication is needed to be done by a proxy. - */ -export const PROXY_AUTHENTICATION_REQUIRED = 407; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5 - * - * The server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields. - */ -export const REQUEST_HEADER_FIELDS_TOO_LARGE = 431; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7 - * - * This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message. - */ -export const REQUEST_TIMEOUT = 408; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11 - * - * Request entity is larger than limits defined by server; the server might close the connection or return an Retry-After header field. - */ -export const REQUEST_TOO_LONG = 413; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.12 - * - * The URI requested by the client is longer than the server is willing to interpret. - */ -export const REQUEST_URI_TOO_LONG = 414; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7233#section-4.4 - * - * The range specified by the Range header field in the request can't be fulfilled; it's possible that the range is outside the size of the target URI's data. - */ -export const REQUESTED_RANGE_NOT_SATISFIABLE = 416; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.6 - * - * This response code is sent after accomplishing request to tell user agent reset document view which sent this request. - */ -export const RESET_CONTENT = 205; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.4 - * - * Server sent this response to directing client to get requested resource to another URI with an GET request. - */ -export const SEE_OTHER = 303; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.4 - * - * The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached. - */ -export const SERVICE_UNAVAILABLE = 503; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2 - * - * This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too. - */ -export const SWITCHING_PROTOCOLS = 101; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.7 - * - * Server sent this response to directing client to get requested resource to another URI with same method that used prior request. This has the same semantic than the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request. - */ -export const TEMPORARY_REDIRECT = 307; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4 - * - * The user has sent too many requests in a given amount of time ("rate limiting"). - */ -export const TOO_MANY_REQUESTS = 429; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1 - * - * Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. - */ -export const UNAUTHORIZED = 401; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3 - * - * The request was well-formed but was unable to be followed due to semantic errors. - */ -export const UNPROCESSABLE_ENTITY = 422; - -/** - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13 - * - * The media format of the requested data is not supported by the server, so the server is rejecting the request. - */ -export const UNSUPPORTED_MEDIA_TYPE = 415; - -/** - * @deprecated - * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.4.6 - * - * Was defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy. - */ -export const USE_PROXY = 305; - -/** - * Array with all the supported status codes. - */ -export const ALL: number[] = [ - ACCEPTED, - BAD_GATEWAY, - BAD_REQUEST, - CONFLICT, - CONTINUE, - CREATED, - EXPECTATION_FAILED, - FAILED_DEPENDENCY, - FORBIDDEN, - GATEWAY_TIMEOUT, - GONE, - HTTP_VERSION_NOT_SUPPORTED, - IM_A_TEAPOT, - INSUFFICIENT_SPACE_ON_RESOURCE, - INSUFFICIENT_STORAGE, - INTERNAL_SERVER_ERROR, - LENGTH_REQUIRED, - LOCKED, - METHOD_FAILURE, - METHOD_NOT_ALLOWED, - MOVED_PERMANENTLY, - MOVED_TEMPORARILY, - MULTI_STATUS, - MULTIPLE_CHOICES, - NETWORK_AUTHENTICATION_REQUIRED, - NO_CONTENT, - NON_AUTHORITATIVE_INFORMATION, - NOT_ACCEPTABLE, - NOT_FOUND, - NOT_IMPLEMENTED, - NOT_MODIFIED, - OK, - PARTIAL_CONTENT, - PAYMENT_REQUIRED, - PERMANENT_REDIRECT, - PRECONDITION_FAILED, - PRECONDITION_REQUIRED, - PROCESSING, - PROXY_AUTHENTICATION_REQUIRED, - REQUEST_HEADER_FIELDS_TOO_LARGE, - REQUEST_TIMEOUT, - REQUEST_TOO_LONG, - REQUEST_URI_TOO_LONG, - REQUESTED_RANGE_NOT_SATISFIABLE, - RESET_CONTENT, - SEE_OTHER, - SERVICE_UNAVAILABLE, - SWITCHING_PROTOCOLS, - TEMPORARY_REDIRECT, - TOO_MANY_REQUESTS, - UNAUTHORIZED, - UNPROCESSABLE_ENTITY, - UNSUPPORTED_MEDIA_TYPE, - USE_PROXY, -]; diff --git a/crates/swc_bundler/tests/.cache/deno/032aa2cac902835a8f309213d42a7695689ed373.ts b/crates/swc_bundler/tests/.cache/deno/032aa2cac902835a8f309213d42a7695689ed373.ts deleted file mode 100644 index aeb11fe24f92..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/032aa2cac902835a8f309213d42a7695689ed373.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/commands/guild_application_command_permissions.ts - - -import { ApplicationCommandPermissions } from "./application_command_permissions.ts"; - -/** https://discord.com/developers/docs/interactions/slash-commands#guildapplicationcommandpermissions */ -export interface GuildApplicationCommandPermissions { - /** The id of the command */ - id: string; - /** The id of the application to command belongs to */ - applicationId: string; - /** The id of the guild */ - guildId: string; - /** The permissions for the command in the guild */ - permissions: ApplicationCommandPermissions[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/03316c24461b68ab740623d666246afa37407d86.ts b/crates/swc_bundler/tests/.cache/deno/03316c24461b68ab740623d666246afa37407d86.ts deleted file mode 100644 index d6b5561d2d45..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/03316c24461b68ab740623d666246afa37407d86.ts +++ /dev/null @@ -1,181 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/mod.ts - - -import { handleChannelCreate } from "./channels/CHANNEL_CREATE.ts"; -import { handleChannelDelete } from "./channels/CHANNEL_DELETE.ts"; -import { handleChannelPinsUpdate } from "./channels/CHANNEL_PINS_UPDATE.ts"; -import { handleChannelUpdate } from "./channels/CHANNEL_UPDATE.ts"; -import { handleStageInstanceCreate } from "./channels/STAGE_INSTANCE_CREATE.ts"; -import { handleStageInstanceUpdate } from "./channels/STAGE_INSTANCE_UPDATE.ts"; -import { handleStageInstanceDelete } from "./channels/STAGE_INSTANCE_DELETE.ts"; -import { handleThreadCreate } from "./channels/THREAD_CREATE.ts"; -import { handleThreadDelete } from "./channels/THREAD_DELETE.ts"; -import { handleThreadListSync } from "./channels/THREAD_LIST_SYNC.ts"; -import { handleThreadMembersUpdate } from "./channels/THREAD_MEMBERS_UPDATE.ts"; -import { handleThreadMemberUpdate } from "./channels/THREAD_MEMBER_UPDATE.ts"; -import { handleThreadUpdate } from "./channels/THREAD_UPDATE.ts"; -import { handleApplicationCommandCreate } from "./commands/APPLICATION_COMMAND_CREATE.ts"; -import { handleApplicationCommandDelete } from "./commands/APPLICATION_COMMAND_DELETE.ts"; -import { handleApplicationCommandUpdate } from "./commands/APPLICATION_COMMAND_UPDATE.ts"; -import { handleGuildEmojisUpdate } from "./emojis/GUILD_EMOJIS_UPDATE.ts"; -import { handleGuildBanAdd } from "./guilds/GUILD_BAN_ADD.ts"; -import { handleGuildBanRemove } from "./guilds/GUILD_BAN_REMOVE.ts"; -import { handleGuildCreate } from "./guilds/GUILD_CREATE.ts"; -import { handleGuildDelete } from "./guilds/GUILD_DELETE.ts"; -import { handleGuildIntegrationsUpdate } from "./guilds/GUILD_INTEGRATIONS_UPDATE.ts"; -import { handleGuildUpdate } from "./guilds/GUILD_UPDATE.ts"; -import { handleIntegrationCreate } from "./integrations/INTEGRATION_CREATE.ts"; -import { handleIntegrationDelete } from "./integrations/INTEGRATION_DELETE.ts"; -import { handleIntegrationUpdate } from "./integrations/INTEGRATION_UPDATE.ts"; -import { handleInteractionCreate } from "./interactions/INTERACTION_CREATE.ts"; -import { handleInviteCreate } from "./invites/INVITE_CREATE.ts"; -import { handleGuildMembersChunk } from "./members/GUILD_MEMBERS_CHUNK.ts"; -import { handleGuildMemberAdd } from "./members/GUILD_MEMBER_ADD.ts"; -import { handleGuildMemberRemove } from "./members/GUILD_MEMBER_REMOVE.ts"; -import { handleGuildMemberUpdate } from "./members/GUILD_MEMBER_UPDATE.ts"; -import { handleMessageCreate } from "./messages/MESSAGE_CREATE.ts"; -import { handleMessageDelete } from "./messages/MESSAGE_DELETE.ts"; -import { handleMessageDeleteBulk } from "./messages/MESSAGE_DELETE_BULK.ts"; -import { handleMessageReactionAdd } from "./messages/MESSAGE_REACTION_ADD.ts"; -import { handleMessageReactionRemove } from "./messages/MESSAGE_REACTION_REMOVE.ts"; -import { handleMessageReactionRemoveAll } from "./messages/MESSAGE_REACTION_REMOVE_ALL.ts"; -import { handleMessageReactionRemoveEmoji } from "./messages/MESSAGE_REACTION_REMOVE_EMOJI.ts"; -import { handleMessageUpdate } from "./messages/MESSAGE_UPDATE.ts"; -import { handlePresenceUpdate } from "./misc/PRESENCE_UPDATE.ts"; -import { handleReady } from "./misc/READY.ts"; -import { handleTypingStart } from "./misc/TYPING_START.ts"; -import { handleUserUpdate } from "./misc/USER_UPDATE.ts"; -import { handleGuildRoleCreate } from "./roles/GUILD_ROLE_CREATE.ts"; -import { handleGuildRoleDelete } from "./roles/GUILD_ROLE_DELETE.ts"; -import { handleGuildRoleUpdate } from "./roles/GUILD_ROLE_UPDATE.ts"; -import { handleVoiceServerUpdate } from "./voice/VOICE_SERVER_UPDATE.ts"; -import { handleVoiceStateUpdate } from "./voice/VOICE_STATE_UPDATE.ts"; -import { handleWebhooksUpdate } from "./webhooks/WEBHOOKS_UPDATE.ts"; - -export { - handleApplicationCommandCreate, - handleApplicationCommandDelete, - handleApplicationCommandUpdate, - handleChannelCreate, - handleChannelDelete, - handleChannelPinsUpdate, - handleChannelUpdate, - handleGuildBanAdd, - handleGuildBanRemove, - handleGuildCreate, - handleGuildDelete, - handleGuildEmojisUpdate, - handleGuildIntegrationsUpdate, - handleGuildMemberAdd, - handleGuildMemberRemove, - handleGuildMembersChunk, - handleGuildMemberUpdate, - handleGuildRoleCreate, - handleGuildRoleDelete, - handleGuildRoleUpdate, - handleGuildUpdate, - handleIntegrationCreate, - handleIntegrationDelete, - handleIntegrationUpdate, - handleInteractionCreate, - handleInviteCreate, - handleMessageCreate, - handleMessageDelete, - handleMessageDeleteBulk, - handleMessageReactionAdd, - handleMessageReactionRemove, - handleMessageReactionRemoveAll, - handleMessageReactionRemoveEmoji, - handleMessageUpdate, - handlePresenceUpdate, - handleReady, - handleStageInstanceCreate, - handleStageInstanceDelete, - handleStageInstanceUpdate, - handleThreadCreate, - handleThreadDelete, - handleThreadListSync, - handleThreadMembersUpdate, - handleThreadMemberUpdate, - handleThreadUpdate, - handleTypingStart, - handleUserUpdate, - handleVoiceServerUpdate, - handleVoiceStateUpdate, - handleWebhooksUpdate, -}; - -export let handlers = { - // misc - READY: handleReady, - // channels - CHANNEL_CREATE: handleChannelCreate, - CHANNEL_DELETE: handleChannelDelete, - CHANNEL_PINS_UPDATE: handleChannelPinsUpdate, - CHANNEL_UPDATE: handleChannelUpdate, - THREAD_CREATE: handleThreadCreate, - THREAD_UPDATE: handleThreadUpdate, - THREAD_DELETE: handleThreadDelete, - THREAD_LIST_SYNC: handleThreadListSync, - THREAD_MEMBER_UPDATE: handleThreadMemberUpdate, - THREAD_MEMBERS_UPDATE: handleThreadMembersUpdate, - STAGE_INSTANCE_CREATE: handleStageInstanceCreate, - STAGE_INSTANCE_UPDATE: handleStageInstanceUpdate, - STAGE_INSTANCE_DELETE: handleStageInstanceDelete, - - // commands - APPLICATION_COMMAND_CREATE: handleApplicationCommandCreate, - APPLICATION_COMMAND_DELETE: handleApplicationCommandDelete, - APPLICATION_COMMAND_UPDATE: handleApplicationCommandUpdate, - // guilds - GUILD_BAN_ADD: handleGuildBanAdd, - GUILD_BAN_REMOVE: handleGuildBanRemove, - GUILD_CREATE: handleGuildCreate, - GUILD_DELETE: handleGuildDelete, - GUILD_EMOJIS_UPDATE: handleGuildEmojisUpdate, - GUILD_INTEGRATIONS_UPDATE: handleGuildIntegrationsUpdate, - GUILD_MEMBER_ADD: handleGuildMemberAdd, - GUILD_MEMBER_REMOVE: handleGuildMemberRemove, - GUILD_MEMBER_UPDATE: handleGuildMemberUpdate, - GUILD_MEMBERS_CHUNK: handleGuildMembersChunk, - GUILD_ROLE_CREATE: handleGuildRoleCreate, - GUILD_ROLE_DELETE: handleGuildRoleDelete, - GUILD_ROLE_UPDATE: handleGuildRoleUpdate, - GUILD_UPDATE: handleGuildUpdate, - // interactions - INTERACTION_CREATE: handleInteractionCreate, - // invites - INVITE_CREATE: handleInviteCreate, - INVITE_DELETE: handleInviteCreate, - // messages - MESSAGE_CREATE: handleMessageCreate, - MESSAGE_DELETE_BULK: handleMessageDeleteBulk, - MESSAGE_DELETE: handleMessageDelete, - MESSAGE_REACTION_ADD: handleMessageReactionAdd, - MESSAGE_REACTION_REMOVE_ALL: handleMessageReactionRemoveAll, - MESSAGE_REACTION_REMOVE_EMOJI: handleMessageReactionRemoveEmoji, - MESSAGE_REACTION_REMOVE: handleMessageReactionRemove, - MESSAGE_UPDATE: handleMessageUpdate, - // presence - PRESENCE_UPDATE: handlePresenceUpdate, - TYPING_START: handleTypingStart, - USER_UPDATE: handleUserUpdate, - // voice - VOICE_SERVER_UPDATE: handleVoiceServerUpdate, - VOICE_STATE_UPDATE: handleVoiceStateUpdate, - // webhooks - WEBHOOKS_UPDATE: handleWebhooksUpdate, - // integrations - INTEGRATION_CREATE: handleIntegrationCreate, - INTEGRATION_UPDATE: handleIntegrationUpdate, - INTEGRATION_DELETE: handleIntegrationDelete, -}; - -export type Handlers = typeof handlers; - -export function updateHandlers(newHandlers: Handlers) { - handlers = { - ...handlers, - ...newHandlers, - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/033dbd979aae4e58ee6710f96505a1823483cb3d.ts b/crates/swc_bundler/tests/.cache/deno/033dbd979aae4e58ee6710f96505a1823483cb3d.ts deleted file mode 100644 index 3e7756485db6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/033dbd979aae4e58ee6710f96505a1823483cb3d.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/io/readers.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// Based on https://github.com/golang/go/blob/0452f9460f50f0f0aba18df43dc2b31906fb66cc/src/io/io.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -import { Buffer } from "./buffer.ts"; - -/** Reader utility for strings */ -export class StringReader extends Buffer { - constructor(s: string) { - super(new TextEncoder().encode(s).buffer); - } -} - -/** Reader utility for combining multiple readers */ -export class MultiReader implements Deno.Reader { - private readonly readers: Deno.Reader[]; - private currentIndex = 0; - - constructor(...readers: Deno.Reader[]) { - this.readers = readers; - } - - async read(p: Uint8Array): Promise { - const r = this.readers[this.currentIndex]; - if (!r) return null; - const result = await r.read(p); - if (result === null) { - this.currentIndex++; - return 0; - } - return result; - } -} - -/** - * A `LimitedReader` reads from `reader` but limits the amount of data returned to just `limit` bytes. - * Each call to `read` updates `limit` to reflect the new amount remaining. - * `read` returns `null` when `limit` <= `0` or - * when the underlying `reader` returns `null`. - */ -export class LimitedReader implements Deno.Reader { - constructor(public reader: Deno.Reader, public limit: number) {} - - async read(p: Uint8Array): Promise { - if (this.limit <= 0) { - return null; - } - - if (p.length > this.limit) { - p = p.subarray(0, this.limit); - } - const n = await this.reader.read(p); - if (n == null) { - return null; - } - - this.limit -= n; - return n; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/03752eb1923228fe872d7ee78c263867fa3cb43f.ts b/crates/swc_bundler/tests/.cache/deno/03752eb1923228fe872d7ee78c263867fa3cb43f.ts deleted file mode 100644 index fc1e9d768d35..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/03752eb1923228fe872d7ee78c263867fa3cb43f.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/discordeno/file_content.ts - - -export interface FileContent { - /** The file blob */ - blob: Blob; - /** The name of the file */ - name: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/03890a1957ff2569db77447abb160e420ce1176f.ts b/crates/swc_bundler/tests/.cache/deno/03890a1957ff2569db77447abb160e420ce1176f.ts deleted file mode 100644 index 7050ff7ac636..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/03890a1957ff2569db77447abb160e420ce1176f.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/interactions/get_original_interaction_response.ts - - -import { applicationId } from "../../bot.ts"; -import { rest } from "../../rest/rest.ts"; -import { structures } from "../../structures/mod.ts"; -import type { Message } from "../../types/messages/message.ts"; -import { endpoints } from "../../util/constants.ts"; - -/** Returns the initial Interactio response. Functions the same as Get Webhook Message */ -export async function getOriginalInteractionResponse(token: string) { - const result = await rest.runMethod("get", endpoints.INTERACTION_ORIGINAL_ID_TOKEN(applicationId, token)); - - return await structures.createDiscordenoMessage(result); -} diff --git a/crates/swc_bundler/tests/.cache/deno/03a2696060909a82e9151b4f1aced5810a318823.ts b/crates/swc_bundler/tests/.cache/deno/03a2696060909a82e9151b4f1aced5810a318823.ts deleted file mode 100644 index cd7b1f392092..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/03a2696060909a82e9151b4f1aced5810a318823.ts +++ /dev/null @@ -1,512 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/iobuffer/IOBuffer.ts - - -import { decode, encode } from './utf8.ts'; - -const defaultByteLength = 1024 * 8; - -type InputData = number | ArrayBufferLike | ArrayBufferView | IOBuffer; - -interface IOBufferOptions { - /** - * Ignore the first n bytes of the ArrayBuffer. - */ - offset?: number; -} - -export class IOBuffer { - /** - * Reference to the internal ArrayBuffer object. - */ - public buffer: ArrayBufferLike; - - /** - * Byte length of the internal ArrayBuffer. - */ - public byteLength: number; - - /** - * Byte offset of the internal ArrayBuffer. - */ - public byteOffset: number; - - /** - * Byte length of the internal ArrayBuffer. - */ - public length: number; - - /** - * The current offset of the buffer's pointer. - */ - public offset: number; - - private lastWrittenByte: number; - private littleEndian: boolean; - - private _data: DataView; - private _mark: number; - private _marks: number[]; - - /** - * @param data - The data to construct the IOBuffer with. - * If data is a number, it will be the new buffer's length
- * If data is `undefined`, the buffer will be initialized with a default length of 8Kb
- * If data is an ArrayBuffer, SharedArrayBuffer, an ArrayBufferView (Typed Array) or an IOBuffer instance - * a view will be created over the underlying ArrayBuffer. - * @param options - */ - public constructor( - data: InputData = defaultByteLength, - options: IOBufferOptions = {}, - ) { - let dataIsGiven = false; - if (typeof data === 'number') { - data = new ArrayBuffer(data); - } else { - dataIsGiven = true; - this.lastWrittenByte = data.byteLength; - } - - const offset = options.offset ? options.offset >>> 0 : 0; - const byteLength = data.byteLength - offset; - let dvOffset = offset; - if (ArrayBuffer.isView(data) || data instanceof IOBuffer) { - if (data.byteLength !== data.buffer.byteLength) { - dvOffset = data.byteOffset + offset; - } - data = data.buffer; - } - if (dataIsGiven) { - this.lastWrittenByte = byteLength; - } else { - this.lastWrittenByte = 0; - } - this.buffer = data; - this.length = byteLength; - this.byteLength = byteLength; - this.byteOffset = dvOffset; - this.offset = 0; - this.littleEndian = true; - this._data = new DataView(this.buffer, dvOffset, byteLength); - this._mark = 0; - this._marks = []; - } - - /** - * Checks if the memory allocated to the buffer is sufficient to store more - * bytes after the offset. - * @param byteLength - The needed memory in bytes. - * @returns `true` if there is sufficient space and `false` otherwise. - */ - public available(byteLength = 1): boolean { - return this.offset + byteLength <= this.length; - } - - /** - * Check if little-endian mode is used for reading and writing multi-byte - * values. - * @returns `true` if little-endian mode is used, `false` otherwise. - */ - public isLittleEndian(): boolean { - return this.littleEndian; - } - - /** - * Set little-endian mode for reading and writing multi-byte values. - */ - public setLittleEndian(): this { - this.littleEndian = true; - return this; - } - - /** - * Check if big-endian mode is used for reading and writing multi-byte values. - * @returns `true` if big-endian mode is used, `false` otherwise. - */ - public isBigEndian(): boolean { - return !this.littleEndian; - } - - /** - * Switches to big-endian mode for reading and writing multi-byte values. - */ - public setBigEndian(): this { - this.littleEndian = false; - return this; - } - - /** - * Move the pointer n bytes forward. - * @param n - Number of bytes to skip. - */ - public skip(n = 1): this { - this.offset += n; - return this; - } - - /** - * Move the pointer to the given offset. - * @param offset - */ - public seek(offset: number): this { - this.offset = offset; - return this; - } - - /** - * Store the current pointer offset. - * @see {@link IOBuffer#reset} - */ - public mark(): this { - this._mark = this.offset; - return this; - } - - /** - * Move the pointer back to the last pointer offset set by mark. - * @see {@link IOBuffer#mark} - */ - public reset(): this { - this.offset = this._mark; - return this; - } - - /** - * Push the current pointer offset to the mark stack. - * @see {@link IOBuffer#popMark} - */ - public pushMark(): this { - this._marks.push(this.offset); - return this; - } - - /** - * Pop the last pointer offset from the mark stack, and set the current - * pointer offset to the popped value. - * @see {@link IOBuffer#pushMark} - */ - public popMark(): this { - const offset = this._marks.pop(); - if (offset === undefined) { - throw new Error('Mark stack empty'); - } - this.seek(offset); - return this; - } - - /** - * Move the pointer offset back to 0. - */ - public rewind(): this { - this.offset = 0; - return this; - } - - /** - * Make sure the buffer has sufficient memory to write a given byteLength at - * the current pointer offset. - * If the buffer's memory is insufficient, this method will create a new - * buffer (a copy) with a length that is twice (byteLength + current offset). - * @param byteLength - */ - public ensureAvailable(byteLength = 1): this { - if (!this.available(byteLength)) { - const lengthNeeded = this.offset + byteLength; - const newLength = lengthNeeded * 2; - const newArray = new Uint8Array(newLength); - newArray.set(new Uint8Array(this.buffer)); - this.buffer = newArray.buffer; - this.length = this.byteLength = newLength; - this._data = new DataView(this.buffer); - } - return this; - } - - /** - * Read a byte and return false if the byte's value is 0, or true otherwise. - * Moves pointer forward by one byte. - */ - public readBoolean(): boolean { - return this.readUint8() !== 0; - } - - /** - * Read a signed 8-bit integer and move pointer forward by 1 byte. - */ - public readInt8(): number { - return this._data.getInt8(this.offset++); - } - - /** - * Read an unsigned 8-bit integer and move pointer forward by 1 byte. - */ - public readUint8(): number { - return this._data.getUint8(this.offset++); - } - - /** - * Alias for {@link IOBuffer#readUint8}. - */ - public readByte(): number { - return this.readUint8(); - } - - /** - * Read `n` bytes and move pointer forward by `n` bytes. - */ - public readBytes(n = 1): Uint8Array { - const bytes = new Uint8Array(n); - for (let i = 0; i < n; i++) { - bytes[i] = this.readByte(); - } - return bytes; - } - - /** - * Read a 16-bit signed integer and move pointer forward by 2 bytes. - */ - public readInt16(): number { - const value = this._data.getInt16(this.offset, this.littleEndian); - this.offset += 2; - return value; - } - - /** - * Read a 16-bit unsigned integer and move pointer forward by 2 bytes. - */ - public readUint16(): number { - const value = this._data.getUint16(this.offset, this.littleEndian); - this.offset += 2; - return value; - } - - /** - * Read a 32-bit signed integer and move pointer forward by 4 bytes. - */ - public readInt32(): number { - const value = this._data.getInt32(this.offset, this.littleEndian); - this.offset += 4; - return value; - } - - /** - * Read a 32-bit unsigned integer and move pointer forward by 4 bytes. - */ - public readUint32(): number { - const value = this._data.getUint32(this.offset, this.littleEndian); - this.offset += 4; - return value; - } - - /** - * Read a 32-bit floating number and move pointer forward by 4 bytes. - */ - public readFloat32(): number { - const value = this._data.getFloat32(this.offset, this.littleEndian); - this.offset += 4; - return value; - } - - /** - * Read a 64-bit floating number and move pointer forward by 8 bytes. - */ - public readFloat64(): number { - const value = this._data.getFloat64(this.offset, this.littleEndian); - this.offset += 8; - return value; - } - - /** - * Read a 1-byte ASCII character and move pointer forward by 1 byte. - */ - public readChar(): string { - return String.fromCharCode(this.readInt8()); - } - - /** - * Read `n` 1-byte ASCII characters and move pointer forward by `n` bytes. - */ - public readChars(n = 1): string { - let result = ''; - for (let i = 0; i < n; i++) { - result += this.readChar(); - } - return result; - } - - /** - * Read the next `n` bytes, return a UTF-8 decoded string and move pointer - * forward by `n` bytes. - */ - public readUtf8(n = 1): string { - return decode(this.readBytes(n)); - } - - /** - * Write 0xff if the passed value is truthy, 0x00 otherwise and move pointer - * forward by 1 byte. - */ - public writeBoolean(value: unknown): this { - this.writeUint8(value ? 0xff : 0x00); - return this; - } - - /** - * Write `value` as an 8-bit signed integer and move pointer forward by 1 byte. - */ - public writeInt8(value: number): this { - this.ensureAvailable(1); - this._data.setInt8(this.offset++, value); - this._updateLastWrittenByte(); - return this; - } - - /** - * Write `value` as an 8-bit unsigned integer and move pointer forward by 1 - * byte. - */ - public writeUint8(value: number): this { - this.ensureAvailable(1); - this._data.setUint8(this.offset++, value); - this._updateLastWrittenByte(); - return this; - } - - /** - * An alias for {@link IOBuffer#writeUint8}. - */ - public writeByte(value: number): this { - return this.writeUint8(value); - } - - /** - * Write all elements of `bytes` as uint8 values and move pointer forward by - * `bytes.length` bytes. - */ - public writeBytes(bytes: ArrayLike): this { - this.ensureAvailable(bytes.length); - for (let i = 0; i < bytes.length; i++) { - this._data.setUint8(this.offset++, bytes[i]); - } - this._updateLastWrittenByte(); - return this; - } - - /** - * Write `value` as a 16-bit signed integer and move pointer forward by 2 - * bytes. - */ - public writeInt16(value: number): this { - this.ensureAvailable(2); - this._data.setInt16(this.offset, value, this.littleEndian); - this.offset += 2; - this._updateLastWrittenByte(); - return this; - } - - /** - * Write `value` as a 16-bit unsigned integer and move pointer forward by 2 - * bytes. - */ - public writeUint16(value: number): this { - this.ensureAvailable(2); - this._data.setUint16(this.offset, value, this.littleEndian); - this.offset += 2; - this._updateLastWrittenByte(); - return this; - } - - /** - * Write `value` as a 32-bit signed integer and move pointer forward by 4 - * bytes. - */ - public writeInt32(value: number): this { - this.ensureAvailable(4); - this._data.setInt32(this.offset, value, this.littleEndian); - this.offset += 4; - this._updateLastWrittenByte(); - return this; - } - - /** - * Write `value` as a 32-bit unsigned integer and move pointer forward by 4 - * bytes. - */ - public writeUint32(value: number): this { - this.ensureAvailable(4); - this._data.setUint32(this.offset, value, this.littleEndian); - this.offset += 4; - this._updateLastWrittenByte(); - return this; - } - - /** - * Write `value` as a 32-bit floating number and move pointer forward by 4 - * bytes. - */ - public writeFloat32(value: number): this { - this.ensureAvailable(4); - this._data.setFloat32(this.offset, value, this.littleEndian); - this.offset += 4; - this._updateLastWrittenByte(); - return this; - } - - /** - * Write `value` as a 64-bit floating number and move pointer forward by 8 - * bytes. - */ - public writeFloat64(value: number): this { - this.ensureAvailable(8); - this._data.setFloat64(this.offset, value, this.littleEndian); - this.offset += 8; - this._updateLastWrittenByte(); - return this; - } - - /** - * Write the charCode of `str`'s first character as an 8-bit unsigned integer - * and move pointer forward by 1 byte. - */ - public writeChar(str: string): this { - return this.writeUint8(str.charCodeAt(0)); - } - - /** - * Write the charCodes of all `str`'s characters as 8-bit unsigned integers - * and move pointer forward by `str.length` bytes. - */ - public writeChars(str: string): this { - for (let i = 0; i < str.length; i++) { - this.writeUint8(str.charCodeAt(i)); - } - return this; - } - - /** - * UTF-8 encode and write `str` to the current pointer offset and move pointer - * forward according to the encoded length. - */ - public writeUtf8(str: string): this { - return this.writeBytes(encode(str)); - } - - /** - * Export a Uint8Array view of the internal buffer. - * The view starts at the byte offset and its length - * is calculated to stop at the last written byte or the original length. - */ - public toArray(): Uint8Array { - return new Uint8Array(this.buffer, this.byteOffset, this.lastWrittenByte); - } - - /** - * Update the last written byte offset - * @private - */ - private _updateLastWrittenByte(): void { - if (this.offset > this.lastWrittenByte) { - this.lastWrittenByte = this.offset; - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/03afd40f15323e4a10de83fb16b022ef4d0fa49c.ts b/crates/swc_bundler/tests/.cache/deno/03afd40f15323e4a10de83fb16b022ef4d0fa49c.ts deleted file mode 100644 index ab86cddc14e1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/03afd40f15323e4a10de83fb16b022ef4d0fa49c.ts +++ /dev/null @@ -1,128 +0,0 @@ -// Loaded from https://deno.land/x/mysql/src/packets/parsers/result.ts - - -import type { BufferReader } from "../../buffer.ts"; -import { - MYSQL_TYPE_DATE, - MYSQL_TYPE_DATETIME, - MYSQL_TYPE_DATETIME2, - MYSQL_TYPE_DECIMAL, - MYSQL_TYPE_DOUBLE, - MYSQL_TYPE_FLOAT, - MYSQL_TYPE_INT24, - MYSQL_TYPE_LONG, - MYSQL_TYPE_LONGLONG, - MYSQL_TYPE_NEWDATE, - MYSQL_TYPE_NEWDECIMAL, - MYSQL_TYPE_SHORT, - MYSQL_TYPE_STRING, - MYSQL_TYPE_TIME, - MYSQL_TYPE_TIME2, - MYSQL_TYPE_TIMESTAMP, - MYSQL_TYPE_TIMESTAMP2, - MYSQL_TYPE_TINY, - MYSQL_TYPE_VAR_STRING, - MYSQL_TYPE_VARCHAR, -} from "../../constant/mysql_types.ts"; - -/** @ignore */ -export interface FieldInfo { - catalog: string; - schema: string; - table: string; - originTable: string; - name: string; - originName: string; - encoding: number; - fieldLen: number; - fieldType: number; - fieldFlag: number; - decimals: number; - defaultVal: string; -} - -/** @ignore */ -export function parseField(reader: BufferReader): FieldInfo { - const catalog = reader.readLenCodeString()!; - const schema = reader.readLenCodeString()!; - const table = reader.readLenCodeString()!; - const originTable = reader.readLenCodeString()!; - const name = reader.readLenCodeString()!; - const originName = reader.readLenCodeString()!; - reader.skip(1); - const encoding = reader.readUint16()!; - const fieldLen = reader.readUint32()!; - const fieldType = reader.readUint8()!; - const fieldFlag = reader.readUint16()!; - const decimals = reader.readUint8()!; - reader.skip(1); - const defaultVal = reader.readLenCodeString()!; - return { - catalog, - schema, - table, - originName, - fieldFlag, - originTable, - fieldLen, - name, - fieldType, - encoding, - decimals, - defaultVal, - }; -} - -/** @ignore */ -export function parseRow(reader: BufferReader, fields: FieldInfo[]): any { - const row: any = {}; - for (const field of fields) { - const name = field.name; - const val = reader.readLenCodeString(); - row[name] = val === null ? null : convertType(field, val); - } - return row; -} - -/** @ignore */ -function convertType(field: FieldInfo, val: string): any { - const { fieldType, fieldLen } = field; - switch (fieldType) { - case MYSQL_TYPE_DECIMAL: - case MYSQL_TYPE_DOUBLE: - case MYSQL_TYPE_FLOAT: - case MYSQL_TYPE_DATETIME2: - return parseFloat(val); - case MYSQL_TYPE_NEWDECIMAL: - return val; // #42 MySQL's decimal type cannot be accurately represented by the Number. - case MYSQL_TYPE_TINY: - case MYSQL_TYPE_SHORT: - case MYSQL_TYPE_LONG: - case MYSQL_TYPE_INT24: - return parseInt(val); - case MYSQL_TYPE_LONGLONG: - if ( - Number(val) < Number.MIN_SAFE_INTEGER || - Number(val) > Number.MAX_SAFE_INTEGER - ) { - return BigInt(val); - } else { - return parseInt(val); - } - case MYSQL_TYPE_VARCHAR: - case MYSQL_TYPE_VAR_STRING: - case MYSQL_TYPE_STRING: - case MYSQL_TYPE_TIME: - case MYSQL_TYPE_TIME2: - return val; - case MYSQL_TYPE_DATE: - case MYSQL_TYPE_TIMESTAMP: - case MYSQL_TYPE_DATETIME: - case MYSQL_TYPE_NEWDATE: - case MYSQL_TYPE_TIMESTAMP2: - case MYSQL_TYPE_DATETIME2: - return new Date(val); - default: - return val; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/04182eda558f91c98c91784a313ad88c9cea253f.ts b/crates/swc_bundler/tests/.cache/deno/04182eda558f91c98c91784a313ad88c9cea253f.ts deleted file mode 100644 index 1e2a211c38dc..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/04182eda558f91c98c91784a313ad88c9cea253f.ts +++ /dev/null @@ -1,175 +0,0 @@ -// Loaded from https://deno.land/x/mongo@v0.20.0/src/collection/collection.ts - - -import { Bson } from "../../deps.ts"; -import { WireProtocol } from "../protocol/mod.ts"; -import { - CountOptions, - DeleteOptions, - DistinctOptions, - Document, - DropOptions, - FindOptions, - InsertOptions, - UpdateOptions, -} from "../types.ts"; -import { FindCursor } from "./commands/find.ts"; -import { AggregateCursor } from "./commands/aggregate.ts"; -import { update } from "./commands/update.ts"; - -export class Collection { - #protocol: WireProtocol; - #dbName: string; - - constructor(protocol: WireProtocol, dbName: string, readonly name: string) { - this.#protocol = protocol; - this.#dbName = dbName; - } - - find(filter?: Document, options?: FindOptions): FindCursor { - return new FindCursor({ - filter, - protocol: this.#protocol, - collectionName: this.name, - dbName: this.#dbName, - options: options ?? {}, - }); - } - - async findOne( - filter?: Document, - options?: FindOptions, - ): Promise { - const cursor = this.find(filter, options); - return await cursor.next(); - } - - async count(filter?: Document, options?: CountOptions): Promise { - const res = await this.#protocol.commandSingle(this.#dbName, { - count: this.name, - query: filter, - ...options, - }); - const { n, ok } = res; - if (ok === 1) { - return n; - } else { - return 0; - } - } - - async insertOne(doc: Document, options?: InsertOptions) { - const { insertedIds } = await this.insertMany([doc], options); - return insertedIds[0]; - } - - async insert(docs: Document | Document[], options?: InsertOptions) { - docs = Array.isArray(docs) ? docs : [docs]; - return this.insertMany(docs as Document[], options); - } - - async insertMany( - docs: Document[], - options?: InsertOptions, - ): Promise<{ insertedIds: Document[]; insertedCount: number }> { - const insertedIds = docs.map((doc) => { - if (!doc._id) { - doc._id = new Bson.ObjectID(); - } - return doc._id; - }); - const res = await this.#protocol.commandSingle(this.#dbName, { - insert: this.name, - documents: docs, - ordered: options?.ordered ?? true, - writeConcern: options?.writeConcern, - bypassDocumentValidation: options?.bypassDocumentValidation, - comment: options?.comment, - }); - const { writeErrors } = res; - if (writeErrors) { - const [{ errmsg }] = writeErrors; - throw new Error(errmsg); - } - return { - insertedIds, - insertedCount: res.n, - }; - } - - async updateOne(filter: Document, update: Document, options?: UpdateOptions) { - const { - upsertedIds = [], - upsertedCount, - matchedCount, - modifiedCount, - } = await this.updateMany(filter, update, { - ...options, - multi: false, - }); - return { - upsertedId: upsertedIds ? upsertedIds[0] : undefined, - upsertedCount, - matchedCount, - modifiedCount, - }; - } - - async updateMany(filter: Document, doc: Document, options?: UpdateOptions) { - return await update(this.#protocol, this.#dbName, this.name, filter, doc, { - ...options, - multi: options?.multi ?? true, - }); - } - - async deleteMany(filter: Document, options?: DeleteOptions): Promise { - const res = await this.#protocol.commandSingle(this.#dbName, { - delete: this.name, - deletes: [ - { - q: filter, - limit: options?.limit ?? 0, - collation: options?.collation, - hint: options?.hint, - comment: options?.comment, - }, - ], - ordered: options?.ordered ?? true, - writeConcern: options?.writeConcern, - }); - return res.n; - } - - delete = this.deleteMany; - - async deleteOne(filter: Document, options?: DeleteOptions) { - return this.delete(filter, { ...options, limit: 1 }); - } - - async drop(options?: DropOptions): Promise { - const res = await this.#protocol.commandSingle(this.#dbName, { - drop: this.name, - ...options, - }); - } - - async distinct(key: string, query?: Document, options?: DistinctOptions) { - const { values } = await this.#protocol.commandSingle(this.#dbName, { - distinct: this.name, - key, - query, - ...options, - }); - return values; - } - - aggregate(pipeline: Document[], options?: any): AggregateCursor { - return new AggregateCursor({ - pipeline, - protocol: this.#protocol, - dbName: this.#dbName, - collectionName: this.name, - options, - }); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/042e5ed5300c9e5f707cd1fb94bbe2a7973adc82.ts b/crates/swc_bundler/tests/.cache/deno/042e5ed5300c9e5f707cd1fb94bbe2a7973adc82.ts deleted file mode 100644 index 1406a564a24b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/042e5ed5300c9e5f707cd1fb94bbe2a7973adc82.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/lensProp.js - - -import _curry1 from './internal/_curry1.js'; -import assoc from './assoc.js'; -import lens from './lens.js'; -import prop from './prop.js'; - - -/** - * Returns a lens whose focus is the specified property. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category Object - * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s - * @sig String -> Lens s a - * @param {String} k - * @return {Lens} - * @see R.view, R.set, R.over - * @example - * - * const xLens = R.lensProp('x'); - * - * R.view(xLens, {x: 1, y: 2}); //=> 1 - * R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} - * R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} - */ -var lensProp = _curry1(function lensProp(k) { - return lens(prop(k), assoc(k)); -}); -export default lensProp; diff --git a/crates/swc_bundler/tests/.cache/deno/0468eb68bbd37eea025b91fc98494fc8f6347920.ts b/crates/swc_bundler/tests/.cache/deno/0468eb68bbd37eea025b91fc98494fc8f6347920.ts deleted file mode 100644 index cf37164f5508..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0468eb68bbd37eea025b91fc98494fc8f6347920.ts +++ /dev/null @@ -1,104 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/discordeno/errors.ts - - -export enum Errors { - // Bot Role errors - BOTS_HIGHEST_ROLE_TOO_LOW = "BOTS_HIGHEST_ROLE_TOO_LOW", - // Channel Errors - CHANNEL_NOT_FOUND = "CHANNEL_NOT_FOUND", - CHANNEL_NOT_IN_GUILD = "CHANNEL_NOT_IN_GUILD", - CHANNEL_NOT_TEXT_BASED = "CHANNEL_NOT_TEXT_BASED", - CHANNEL_NOT_STAGE_VOICE = "CHANNEL_NOT_STAGE_VOICE", - MESSAGE_MAX_LENGTH = "MESSAGE_MAX_LENGTH", - RULES_CHANNEL_CANNOT_BE_DELETED = "RULES_CHANNEL_CANNOT_BE_DELETED", - UPDATES_CHANNEL_CANNOT_BE_DELETED = "UPDATES_CHANNEL_CANNOT_BE_DELETED", - INVALID_TOPIC_LENGTH = "INVALID_TOPIC_LENGTH", - // Guild Errors - GUILD_NOT_DISCOVERABLE = "GUILD_NOT_DISCOVERABLE", - GUILD_WIDGET_NOT_ENABLED = "GUILD_WIDGET_NOT_ENABLED", - GUILD_NOT_FOUND = "GUILD_NOT_FOUND", - MEMBER_NOT_FOUND = "MEMBER_NOT_FOUND", - MEMBER_NOT_IN_VOICE_CHANNEL = "MEMBER_NOT_IN_VOICE_CHANNEL", - MEMBER_SEARCH_LIMIT_TOO_HIGH = "MEMBER_SEARCH_LIMIT_TOO_HIGH", - MEMBER_SEARCH_LIMIT_TOO_LOW = "MEMBER_SEARCH_LIMIT_TOO_LOW", - PRUNE_MAX_DAYS = "PRUNE_MAX_DAYS", - ROLE_NOT_FOUND = "ROLE_NOT_FOUND", - // Thread errors - INVALID_THREAD_PARENT_CHANNEL_TYPE = "INVALID_THREAD_PARENT_CHANNEL_TYPE", - GUILD_NEWS_CHANNEL_ONLY_SUPPORT_PUBLIC_THREADS = "GUILD_NEWS_CHANNEL_ONLY_SUPPORT_PUBLIC_THREADS", - NOT_A_THREAD_CHANNEL = "NOT_A_THREAD_CHANNEL", - // Message Get Errors - INVALID_GET_MESSAGES_LIMIT = "INVALID_GET_MESSAGES_LIMIT", - // Message Delete Errors - DELETE_MESSAGES_MIN = "DELETE_MESSAGES_MIN", - PRUNE_MIN_DAYS = "PRUNE_MIN_DAYS", - // Interaction Errors - INVALID_SLASH_DESCRIPTION = "INVALID_SLASH_DESCRIPTION", - INVALID_SLASH_NAME = "INVALID_SLASH_NAME", - INVALID_SLASH_OPTIONS = "INVALID_SLASH_OPTIONS", - INVALID_SLASH_OPTIONS_CHOICES = "INVALID_SLASH_OPTIONS_CHOICES", - TOO_MANY_SLASH_OPTIONS = "TOO_MANY_SLASH_OPTIONS", - INVALID_SLASH_OPTION_CHOICE_NAME = "INVALID_SLASH_OPTION_CHOICE_NAME", - INVALID_SLASH_OPTIONS_CHOICE_VALUE_TYPE = "INVALID_SLASH_OPTIONS_CHOICE_VALUE_TYPE", - TOO_MANY_SLASH_OPTION_CHOICES = "TOO_MANY_SLASH_OPTION_CHOICES", - ONLY_STRING_OR_INTEGER_OPTIONS_CAN_HAVE_CHOICES = "ONLY_STRING_OR_INTEGER_OPTIONS_CAN_HAVE_CHOICES", - INVALID_SLASH_OPTION_NAME = "INVALID_SLASH_OPTION_NAME", - INVALID_SLASH_OPTION_DESCRIPTION = "INVALID_SLASH_OPTION_DESCRIPTION", - // Webhook Errors - INVALID_WEBHOOK_NAME = "INVALID_WEBHOOK_NAME", - INVALID_WEBHOOK_OPTIONS = "INVALID_WEBHOOK_OPTIONS", - // Permission Errors - MISSING_ADD_REACTIONS = "MISSING_ADD_REACTIONS", - MISSING_ADMINISTRATOR = "MISSING_ADMINISTRATOR", - MISSING_ATTACH_FILES = "MISSING_ATTACH_FILES", - MISSING_BAN_MEMBERS = "MISSING_BAN_MEMBERS", - MISSING_CHANGE_NICKNAME = "MISSING_CHANGE_NICKNAME", - MISSING_CONNECT = "MISSING_CONNECT", - MISSING_CREATE_INSTANT_INVITE = "MISSING_CREATE_INSTANT_INVITE", - MISSING_DEAFEN_MEMBERS = "MISSING_DEAFEN_MEMBERS", - MISSING_EMBED_LINKS = "MISSING_EMBED_LINKS", - MISSING_INTENT_GUILD_MEMBERS = "MISSING_INTENT_GUILD_MEMBERS", - MISSING_KICK_MEMBERS = "MISSING_KICK_MEMBERS", - MISSING_MANAGE_CHANNELS = "MISSING_MANAGE_CHANNELS", - MISSING_MANAGE_EMOJIS = "MISSING_MANAGE_EMOJIS", - MISSING_MANAGE_GUILD = "MISSING_MANAGE_GUILD", - MISSING_MANAGE_MESSAGES = "MISSING_MANAGE_MESSAGES", - MISSING_MANAGE_NICKNAMES = "MISSING_MANAGE_NICKNAMES", - MISSING_MANAGE_ROLES = "MISSING_MANAGE_ROLES", - MISSING_MANAGE_WEBHOOKS = "MISSING_MANAGE_WEBHOOKS", - MISSING_MENTION_EVERYONE = "MISSING_MENTION_EVERYONE", - MISSING_MOVE_MEMBERS = "MISSING_MOVE_MEMBERS", - MISSING_MUTE_MEMBERS = "MISSING_MUTE_MEMBERS", - MISSING_PRIORITY_SPEAKER = "MISSING_PRIORITY_SPEAKER", - MISSING_READ_MESSAGE_HISTORY = "MISSING_READ_MESSAGE_HISTORY", - MISSING_SEND_MESSAGES = "MISSING_SEND_MESSAGES", - MISSING_SEND_TTS_MESSAGES = "MISSING_SEND_TTS_MESSAGES", - MISSING_SPEAK = "MISSING_SPEAK", - MISSING_STREAM = "MISSING_STREAM", - MISSING_USE_VAD = "MISSING_USE_VAD", - MISSING_USE_EXTERNAL_EMOJIS = "MISSING_USE_EXTERNAL_EMOJIS", - MISSING_VIEW_AUDIT_LOG = "MISSING_VIEW_AUDIT_LOG", - MISSING_VIEW_CHANNEL = "MISSING_VIEW_CHANNEL", - MISSING_VIEW_GUILD_INSIGHTS = "MISSING_VIEW_GUILD_INSIGHTS", - // User Errors - NICKNAMES_MAX_LENGTH = "NICKNAMES_MAX_LENGTH", - USERNAME_INVALID_CHARACTER = "USERNAME_INVALID_CHARACTER", - USERNAME_INVALID_USERNAME = "USERNAME_INVALID_USERNAME", - USERNAME_MAX_LENGTH = "USERNAME_MAX_LENGTH", - USERNAME_MIN_LENGTH = "USERNAME_MIN_LENGTH", - NONCE_TOO_LONG = "NONCE_TOO_LONG", - INVITE_MAX_AGE_INVALID = "INVITE_MAX_AGE_INVALID", - INVITE_MAX_USES_INVALID = "INVITE_MAX_USES_INVALID", - // API Errors - RATE_LIMIT_RETRY_MAXED = "RATE_LIMIT_RETRY_MAXED", - REQUEST_CLIENT_ERROR = "REQUEST_CLIENT_ERROR", - REQUEST_SERVER_ERROR = "REQUEST_SERVER_ERROR", - REQUEST_UNKNOWN_ERROR = "REQUEST_UNKNOWN_ERROR", - // Component Errors - TOO_MANY_COMPONENTS = "TOO_MANY_COMPONENTS", - TOO_MANY_ACTION_ROWS = "TOO_MANY_ACTION_ROWS", - LINK_BUTTON_CANNOT_HAVE_CUSTOM_ID = "LINK_BUTTON_CANNOT_HAVE_CUSTOM_ID", - COMPONENT_LABEL_TOO_BIG = "COMPONENT_LABEL_TOO_BIG", - COMPONENT_CUSTOM_ID_TOO_BIG = "COMPONENT_CUSTOM_ID_TOO_BIG", - BUTTON_REQUIRES_CUSTOM_ID = "BUTTON_REQUIRES_CUSTOM_ID", -} diff --git a/crates/swc_bundler/tests/.cache/deno/0487c855c9f9ad28ad81c1a9f1e7446b2a188d09.ts b/crates/swc_bundler/tests/.cache/deno/0487c855c9f9ad28ad81c1a9f1e7446b2a188d09.ts deleted file mode 100644 index c98e352fca3b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0487c855c9f9ad28ad81c1a9f1e7446b2a188d09.ts +++ /dev/null @@ -1,104 +0,0 @@ -// Loaded from https://deno.land/std@0.78.0/encoding/_yaml/schema.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { YAMLError } from "./error.ts"; -import type { KindType, Type } from "./type.ts"; -import type { Any, ArrayObject } from "./utils.ts"; - -function compileList( - schema: Schema, - name: "implicit" | "explicit", - result: Type[], -): Type[] { - const exclude: number[] = []; - - for (const includedSchema of schema.include) { - result = compileList(includedSchema, name, result); - } - - for (const currentType of schema[name]) { - for ( - let previousIndex = 0; - previousIndex < result.length; - previousIndex++ - ) { - const previousType = result[previousIndex]; - if ( - previousType.tag === currentType.tag && - previousType.kind === currentType.kind - ) { - exclude.push(previousIndex); - } - } - - result.push(currentType); - } - - return result.filter((type, index): unknown => !exclude.includes(index)); -} - -export type TypeMap = { [k in KindType | "fallback"]: ArrayObject }; -function compileMap(...typesList: Type[][]): TypeMap { - const result: TypeMap = { - fallback: {}, - mapping: {}, - scalar: {}, - sequence: {}, - }; - - for (const types of typesList) { - for (const type of types) { - if (type.kind !== null) { - result[type.kind][type.tag] = result["fallback"][type.tag] = type; - } - } - } - return result; -} - -export class Schema implements SchemaDefinition { - public static SCHEMA_DEFAULT?: Schema; - - public implicit: Type[]; - public explicit: Type[]; - public include: Schema[]; - - public compiledImplicit: Type[]; - public compiledExplicit: Type[]; - public compiledTypeMap: TypeMap; - - constructor(definition: SchemaDefinition) { - this.explicit = definition.explicit || []; - this.implicit = definition.implicit || []; - this.include = definition.include || []; - - for (const type of this.implicit) { - if (type.loadKind && type.loadKind !== "scalar") { - throw new YAMLError( - // eslint-disable-next-line max-len - "There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.", - ); - } - } - - this.compiledImplicit = compileList(this, "implicit", []); - this.compiledExplicit = compileList(this, "explicit", []); - this.compiledTypeMap = compileMap( - this.compiledImplicit, - this.compiledExplicit, - ); - } - - public static create(): void {} -} - -export interface SchemaDefinition { - implicit?: Any[]; - explicit?: Type[]; - include?: Schema[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/048a424b4a0d2b5ef1753fb52fc81ba3d31d6656.ts b/crates/swc_bundler/tests/.cache/deno/048a424b4a0d2b5ef1753fb52fc81ba3d31d6656.ts deleted file mode 100644 index 354f9c482a6c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/048a424b4a0d2b5ef1753fb52fc81ba3d31d6656.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/users/connection.ts - - -import { Integration } from "../integrations/integration.ts"; -import { DiscordVisibilityTypes } from "./visibility_types.ts"; - -/** https://discord.com/developers/docs/resources/user#connection-objecthttps://discord.com/developers/docs/resources/user#user-object-premium-types */ -export interface Connection { - /** id of the connection account */ - id: string; - /** The username of the connection account */ - name: string; - /** The service of the connection (twitch, youtube) */ - type: string; - /** Whether the connection is revoked */ - revoked?: boolean; - /** An array of partial server integrations */ - integrations?: Integration[]; - /** Whether the connection is verified */ - verified: boolean; - /** Whether friend sync is enabled for this connection */ - friendSync: boolean; - /** Whether activities related to this connection will be shown in presence updates */ - showActivity: boolean; - /** Visibility of this connection */ - visibility: DiscordVisibilityTypes; -} diff --git a/crates/swc_bundler/tests/.cache/deno/04c5beb117daf148add8d6428102a65050829835.ts b/crates/swc_bundler/tests/.cache/deno/04c5beb117daf148add8d6428102a65050829835.ts deleted file mode 100644 index b83e02673f09..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/04c5beb117daf148add8d6428102a65050829835.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/pipe.js - - -import _arity from './internal/_arity.js'; -import _pipe from './internal/_pipe.js'; -import reduce from './reduce.js'; -import tail from './tail.js'; - - -/** - * Performs left-to-right function composition. The first argument may have - * any arity; the remaining arguments must be unary. - * - * In some libraries this function is named `sequence`. - * - * **Note:** The result of pipe is not automatically curried. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z) - * @param {...Function} functions - * @return {Function} - * @see R.compose - * @example - * - * const f = R.pipe(Math.pow, R.negate, R.inc); - * - * f(3, 4); // -(3^4) + 1 - * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) - * @symb R.pipe(f, g, h)(a)(b) = h(g(f(a)))(b) - */ -export default function pipe() { - if (arguments.length === 0) { - throw new Error('pipe requires at least one argument'); - } - return _arity( - arguments[0].length, - reduce(_pipe, arguments[0], tail(arguments)) - ); -} diff --git a/crates/swc_bundler/tests/.cache/deno/04d2cd119ea6b5f6e98c4d7a3c012cac22088f30.ts b/crates/swc_bundler/tests/.cache/deno/04d2cd119ea6b5f6e98c4d7a3c012cac22088f30.ts deleted file mode 100644 index 159c5a8a804e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/04d2cd119ea6b5f6e98c4d7a3c012cac22088f30.ts +++ /dev/null @@ -1,192 +0,0 @@ -// Loaded from https://deno.land/std/log/logger.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { getLevelByName, getLevelName, LogLevels } from "./levels.ts"; -import type { LevelName } from "./levels.ts"; -import type { BaseHandler } from "./handlers.ts"; - -// deno-lint-ignore no-explicit-any -export type GenericFunction = (...args: any[]) => any; - -export interface LogRecordOptions { - msg: string; - args: unknown[]; - level: number; - loggerName: string; -} - -export class LogRecord { - readonly msg: string; - #args: unknown[]; - #datetime: Date; - readonly level: number; - readonly levelName: string; - readonly loggerName: string; - - constructor(options: LogRecordOptions) { - this.msg = options.msg; - this.#args = [...options.args]; - this.level = options.level; - this.loggerName = options.loggerName; - this.#datetime = new Date(); - this.levelName = getLevelName(options.level); - } - get args(): unknown[] { - return [...this.#args]; - } - get datetime(): Date { - return new Date(this.#datetime.getTime()); - } -} - -export interface LoggerOptions { - handlers?: BaseHandler[]; -} - -export class Logger { - #level: LogLevels; - #handlers: BaseHandler[]; - readonly #loggerName: string; - - constructor( - loggerName: string, - levelName: LevelName, - options: LoggerOptions = {}, - ) { - this.#loggerName = loggerName; - this.#level = getLevelByName(levelName); - this.#handlers = options.handlers || []; - } - - get level(): LogLevels { - return this.#level; - } - set level(level: LogLevels) { - this.#level = level; - } - - get levelName(): LevelName { - return getLevelName(this.#level); - } - set levelName(levelName: LevelName) { - this.#level = getLevelByName(levelName); - } - - get loggerName(): string { - return this.#loggerName; - } - - set handlers(hndls: BaseHandler[]) { - this.#handlers = hndls; - } - get handlers(): BaseHandler[] { - return this.#handlers; - } - - /** If the level of the logger is greater than the level to log, then nothing - * is logged, otherwise a log record is passed to each log handler. `msg` data - * passed in is returned. If a function is passed in, it is only evaluated - * if the msg will be logged and the return value will be the result of the - * function, not the function itself, unless the function isn't called, in which - * case undefined is returned. All types are coerced to strings for logging. - */ - private _log( - level: number, - msg: (T extends GenericFunction ? never : T) | (() => T), - ...args: unknown[] - ): T | undefined { - if (this.level > level) { - return msg instanceof Function ? undefined : msg; - } - - let fnResult: T | undefined; - let logMessage: string; - if (msg instanceof Function) { - fnResult = msg(); - logMessage = this.asString(fnResult); - } else { - logMessage = this.asString(msg); - } - const record: LogRecord = new LogRecord({ - msg: logMessage, - args: args, - level: level, - loggerName: this.loggerName, - }); - - this.#handlers.forEach((handler): void => { - handler.handle(record); - }); - - return msg instanceof Function ? fnResult : msg; - } - - asString(data: unknown): string { - if (typeof data === "string") { - return data; - } else if ( - data === null || - typeof data === "number" || - typeof data === "bigint" || - typeof data === "boolean" || - typeof data === "undefined" || - typeof data === "symbol" - ) { - return String(data); - } else if (data instanceof Error) { - return data.stack!; - } else if (typeof data === "object") { - return JSON.stringify(data); - } - return "undefined"; - } - - debug(msg: () => T, ...args: unknown[]): T | undefined; - debug(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T; - debug( - msg: (T extends GenericFunction ? never : T) | (() => T), - ...args: unknown[] - ): T | undefined { - return this._log(LogLevels.DEBUG, msg, ...args); - } - - info(msg: () => T, ...args: unknown[]): T | undefined; - info(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T; - info( - msg: (T extends GenericFunction ? never : T) | (() => T), - ...args: unknown[] - ): T | undefined { - return this._log(LogLevels.INFO, msg, ...args); - } - - warning(msg: () => T, ...args: unknown[]): T | undefined; - warning(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T; - warning( - msg: (T extends GenericFunction ? never : T) | (() => T), - ...args: unknown[] - ): T | undefined { - return this._log(LogLevels.WARNING, msg, ...args); - } - - error(msg: () => T, ...args: unknown[]): T | undefined; - error(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T; - error( - msg: (T extends GenericFunction ? never : T) | (() => T), - ...args: unknown[] - ): T | undefined { - return this._log(LogLevels.ERROR, msg, ...args); - } - - critical(msg: () => T, ...args: unknown[]): T | undefined; - critical( - msg: T extends GenericFunction ? never : T, - ...args: unknown[] - ): T; - critical( - msg: (T extends GenericFunction ? never : T) | (() => T), - ...args: unknown[] - ): T | undefined { - return this._log(LogLevels.CRITICAL, msg, ...args); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/04f2435ab4500b55ef683496a38c20a92bb0b21c.ts b/crates/swc_bundler/tests/.cache/deno/04f2435ab4500b55ef683496a38c20a92bb0b21c.ts deleted file mode 100644 index 80934a820bd7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/04f2435ab4500b55ef683496a38c20a92bb0b21c.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/encoding/_yaml/error.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import type { Mark } from "./mark.ts"; - -export class YAMLError extends Error { - constructor( - message = "(unknown reason)", - protected mark: Mark | string = "", - ) { - super(`${message} ${mark}`); - this.name = this.constructor.name; - } - - public toString(_compact: boolean): string { - return `${this.name}: ${this.message} ${this.mark}`; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/053868eeb53e02742f74c3818b879bfbb1c39417.ts b/crates/swc_bundler/tests/.cache/deno/053868eeb53e02742f74c3818b879bfbb1c39417.ts deleted file mode 100644 index 18f2d3a26d54..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/053868eeb53e02742f74c3818b879bfbb1c39417.ts +++ /dev/null @@ -1,252 +0,0 @@ -// Loaded from https://deno.land/std@0.101.0/datetime/mod.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -import { DateTimeFormatter } from "./formatter.ts"; - -export const SECOND = 1e3; -export const MINUTE = SECOND * 60; -export const HOUR = MINUTE * 60; -export const DAY = HOUR * 24; -export const WEEK = DAY * 7; -const DAYS_PER_WEEK = 7; - -enum Day { - Sun, - Mon, - Tue, - Wed, - Thu, - Fri, - Sat, -} - -/** - * Parse date from string using format string - * @param dateString Date string - * @param format Format string - * @return Parsed date - */ -export function parse(dateString: string, formatString: string): Date { - const formatter = new DateTimeFormatter(formatString); - const parts = formatter.parseToParts(dateString); - const sortParts = formatter.sortDateTimeFormatPart(parts); - return formatter.partsToDate(sortParts); -} - -/** - * Format date using format string - * @param date Date - * @param format Format string - * @return formatted date string - */ -export function format(date: Date, formatString: string): string { - const formatter = new DateTimeFormatter(formatString); - return formatter.format(date); -} - -/** - * Get number of the day in the year - * @return Number of the day in year - */ -export function dayOfYear(date: Date): number { - // Values from 0 to 99 map to the years 1900 to 1999. All other values are the actual year. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date) - // Using setFullYear as a workaround - - const yearStart = new Date(date); - - yearStart.setUTCFullYear(date.getUTCFullYear(), 0, 0); - const diff = date.getTime() - - yearStart.getTime() + - (yearStart.getTimezoneOffset() - date.getTimezoneOffset()) * 60 * 1000; - - return Math.floor(diff / DAY); -} -/** - * Get number of the week in the year (ISO-8601) - * @return Number of the week in year - */ -export function weekOfYear(date: Date): number { - const workingDate = new Date( - Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()), - ); - - const day = workingDate.getUTCDay(); - - const nearestThursday = workingDate.getUTCDate() + - Day.Thu - - (day === Day.Sun ? DAYS_PER_WEEK : day); - - workingDate.setUTCDate(nearestThursday); - - // Get first day of year - const yearStart = new Date(Date.UTC(workingDate.getUTCFullYear(), 0, 1)); - - // return the calculated full weeks to nearest Thursday - return Math.ceil((workingDate.getTime() - yearStart.getTime() + DAY) / WEEK); -} - -/** - * Parse a date to return a IMF formatted string date - * RFC: https://tools.ietf.org/html/rfc7231#section-7.1.1.1 - * IMF is the time format to use when generating times in HTTP - * headers. The time being formatted must be in UTC for Format to - * generate the correct format. - * @param date Date to parse - * @return IMF date formatted string - */ -export function toIMF(date: Date): string { - function dtPad(v: string, lPad = 2): string { - return v.padStart(lPad, "0"); - } - const d = dtPad(date.getUTCDate().toString()); - const h = dtPad(date.getUTCHours().toString()); - const min = dtPad(date.getUTCMinutes().toString()); - const s = dtPad(date.getUTCSeconds().toString()); - const y = date.getUTCFullYear(); - const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; - const months = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", - ]; - return `${days[date.getUTCDay()]}, ${d} ${ - months[date.getUTCMonth()] - } ${y} ${h}:${min}:${s} GMT`; -} - -/** - * Check given year is a leap year or not. - * based on : https://docs.microsoft.com/en-us/office/troubleshoot/excel/determine-a-leap-year - * @param year year in number or Date format - */ -export function isLeap(year: Date | number): boolean { - const yearNumber = year instanceof Date ? year.getFullYear() : year; - return ( - (yearNumber % 4 === 0 && yearNumber % 100 !== 0) || yearNumber % 400 === 0 - ); -} - -export type Unit = - | "milliseconds" - | "seconds" - | "minutes" - | "hours" - | "days" - | "weeks" - | "months" - | "quarters" - | "years"; - -export type DifferenceFormat = Partial>; - -export type DifferenceOptions = { - units?: Unit[]; -}; - -/** - * Calculate difference between two dates. - * @param from Year to calculate difference - * @param to Year to calculate difference with - * @param options Options for determining how to respond - * - * example : - * - * ```typescript - * datetime.difference(new Date("2020/1/1"),new Date("2020/2/2"),{ units : ["days","months"] }) - * ``` - */ -export function difference( - from: Date, - to: Date, - options?: DifferenceOptions, -): DifferenceFormat { - const uniqueUnits = options?.units ? [...new Set(options?.units)] : [ - "milliseconds", - "seconds", - "minutes", - "hours", - "days", - "weeks", - "months", - "quarters", - "years", - ]; - - const bigger = Math.max(from.getTime(), to.getTime()); - const smaller = Math.min(from.getTime(), to.getTime()); - const differenceInMs = bigger - smaller; - - const differences: DifferenceFormat = {}; - - for (const uniqueUnit of uniqueUnits) { - switch (uniqueUnit) { - case "milliseconds": - differences.milliseconds = differenceInMs; - break; - case "seconds": - differences.seconds = Math.floor(differenceInMs / SECOND); - break; - case "minutes": - differences.minutes = Math.floor(differenceInMs / MINUTE); - break; - case "hours": - differences.hours = Math.floor(differenceInMs / HOUR); - break; - case "days": - differences.days = Math.floor(differenceInMs / DAY); - break; - case "weeks": - differences.weeks = Math.floor(differenceInMs / WEEK); - break; - case "months": - differences.months = calculateMonthsDifference(bigger, smaller); - break; - case "quarters": - differences.quarters = Math.floor( - (typeof differences.months !== "undefined" && - differences.months / 4) || - calculateMonthsDifference(bigger, smaller) / 4, - ); - break; - case "years": - differences.years = Math.floor( - (typeof differences.months !== "undefined" && - differences.months / 12) || - calculateMonthsDifference(bigger, smaller) / 12, - ); - break; - } - } - - return differences; -} - -function calculateMonthsDifference(bigger: number, smaller: number): number { - const biggerDate = new Date(bigger); - const smallerDate = new Date(smaller); - const yearsDiff = biggerDate.getFullYear() - smallerDate.getFullYear(); - const monthsDiff = biggerDate.getMonth() - smallerDate.getMonth(); - const calendarDifferences = Math.abs(yearsDiff * 12 + monthsDiff); - const compareResult = biggerDate > smallerDate ? 1 : -1; - biggerDate.setMonth( - biggerDate.getMonth() - compareResult * calendarDifferences, - ); - const isLastMonthNotFull = biggerDate > smallerDate - ? 1 - : -1 === -compareResult - ? 1 - : 0; - const months = compareResult * (calendarDifferences - isLastMonthNotFull); - return months === 0 ? 0 : months; -} diff --git a/crates/swc_bundler/tests/.cache/deno/054091ea47b4a686799fcdcfafda8d47aa16513b.ts b/crates/swc_bundler/tests/.cache/deno/054091ea47b4a686799fcdcfafda8d47aa16513b.ts deleted file mode 100644 index 880acb6f1116..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/054091ea47b4a686799fcdcfafda8d47aa16513b.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/rest/process_request_headers.ts - - -import { rest } from "./rest.ts"; - -/** Processes the rate limit headers and determines if it needs to be ratelimited and returns the bucket id if available */ -export function processRequestHeaders(url: string, headers: Headers) { - let ratelimited = false; - - // GET ALL NECESSARY HEADERS - const remaining = headers.get("x-ratelimit-remaining"); - const retryAfter = headers.get("x-ratelimit-reset-after"); - const reset = Date.now() + Number(retryAfter) * 1000; - const global = headers.get("x-ratelimit-global"); - // undefined override null needed for typings - const bucketId = headers.get("x-ratelimit-bucket") || undefined; - - // IF THERE IS NO REMAINING RATE LIMIT, MARK IT AS RATE LIMITED - if (remaining === "0") { - ratelimited = true; - - // SAVE THE URL AS LIMITED, IMPORTANT FOR NEW REQUESTS BY USER WITHOUT BUCKET - rest.ratelimitedPaths.set(url, { - url, - resetTimestamp: reset, - bucketId, - }); - - // SAVE THE BUCKET AS LIMITED SINCE DIFFERENT URLS MAY SHARE A BUCKET - if (bucketId) { - rest.ratelimitedPaths.set(bucketId, { - url, - resetTimestamp: reset, - bucketId, - }); - } - } - - // IF THERE IS NO REMAINING GLOBAL LIMIT, MARK IT RATE LIMITED GLOBALLY - if (global) { - const retryAfter = headers.get("retry-after"); - const globalReset = Date.now() + Number(retryAfter) * 1000; - rest.eventHandlers.globallyRateLimited(url, globalReset); - rest.globallyRateLimited = true; - ratelimited = true; - - rest.ratelimitedPaths.set("global", { - url: "global", - resetTimestamp: globalReset, - bucketId, - }); - - if (bucketId) { - rest.ratelimitedPaths.set(bucketId, { - url: "global", - resetTimestamp: globalReset, - bucketId, - }); - } - } - - if (ratelimited && !rest.processingRateLimitedPaths) { - rest.processRateLimitedPaths(); - } - return ratelimited ? bucketId : undefined; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0558e83aa94dff0374c8909ac9e804e17d1d898c.ts b/crates/swc_bundler/tests/.cache/deno/0558e83aa94dff0374c8909ac9e804e17d1d898c.ts deleted file mode 100644 index 27d4686d93c1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0558e83aa94dff0374c8909ac9e804e17d1d898c.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/messages/message_types.ts - - -/** https://discord.com/developers/docs/resources/channel#message-object-message-types */ -export enum DiscordMessageTypes { - Default, - RecipientAdd, - RecipientRemove, - Call, - ChannelNameChange, - ChannelIconChange, - ChannelPinnedMessage, - GuildMemberJoin, - UserPremiumGuildSubscription, - UserPremiumGuildSubscriptionTier1, - UserPremiumGuildSubscriptionTier2, - UserPremiumGuildSubscriptionTier3, - ChannelFollowAdd, - GuildDiscoveryDisqualified = 14, - GuildDiscoveryRequalified, - GuildDiscoveryGracePeriodInitialWarning, - GuildDiscoveryGracePeriodFinalWarning, - ThreadCreated, - Reply = 19, - ApplicationCommand, - GuildInviteReminder = 22, -} - -export type MessageTypes = DiscordMessageTypes; -export const MessageTypes = DiscordMessageTypes; diff --git a/crates/swc_bundler/tests/.cache/deno/055c51823e86235b0076115fa0fcfa6a793db7f5.ts b/crates/swc_bundler/tests/.cache/deno/055c51823e86235b0076115fa0fcfa6a793db7f5.ts deleted file mode 100644 index f9c44ad8e59d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/055c51823e86235b0076115fa0fcfa6a793db7f5.ts +++ /dev/null @@ -1,87 +0,0 @@ -// Loaded from https://deno.land/std@0.73.0/io/ioutil.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import type { BufReader } from "./bufio.ts"; -type Reader = Deno.Reader; -type Writer = Deno.Writer; -import { assert } from "../_util/assert.ts"; - -const DEFAULT_BUFFER_SIZE = 32 * 1024; - -/** copy N size at the most. - * If read size is lesser than N, then returns nread - * */ -export async function copyN( - r: Reader, - dest: Writer, - size: number, -): Promise { - let bytesRead = 0; - let buf = new Uint8Array(DEFAULT_BUFFER_SIZE); - while (bytesRead < size) { - if (size - bytesRead < DEFAULT_BUFFER_SIZE) { - buf = new Uint8Array(size - bytesRead); - } - const result = await r.read(buf); - const nread = result ?? 0; - bytesRead += nread; - if (nread > 0) { - let n = 0; - while (n < nread) { - n += await dest.write(buf.slice(n, nread)); - } - assert(n === nread, "could not write"); - } - if (result === null) { - break; - } - } - return bytesRead; -} - -/** Read big endian 16bit short from BufReader */ -export async function readShort(buf: BufReader): Promise { - const high = await buf.readByte(); - if (high === null) return null; - const low = await buf.readByte(); - if (low === null) throw new Deno.errors.UnexpectedEof(); - return (high << 8) | low; -} - -/** Read big endian 32bit integer from BufReader */ -export async function readInt(buf: BufReader): Promise { - const high = await readShort(buf); - if (high === null) return null; - const low = await readShort(buf); - if (low === null) throw new Deno.errors.UnexpectedEof(); - return (high << 16) | low; -} - -const MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER); - -/** Read big endian 64bit long from BufReader */ -export async function readLong(buf: BufReader): Promise { - const high = await readInt(buf); - if (high === null) return null; - const low = await readInt(buf); - if (low === null) throw new Deno.errors.UnexpectedEof(); - const big = (BigInt(high) << 32n) | BigInt(low); - // We probably should provide a similar API that returns BigInt values. - if (big > MAX_SAFE_INTEGER) { - throw new RangeError( - "Long value too big to be represented as a JavaScript number.", - ); - } - return Number(big); -} - -/** Slice number into 64bit big endian byte array */ -export function sliceLongToBytes(d: number, dest = new Array(8)): number[] { - let big = BigInt(d); - for (let i = 0; i < 8; i++) { - dest[7 - i] = Number(big & 0xffn); - big >>= 8n; - } - return dest; -} diff --git a/crates/swc_bundler/tests/.cache/deno/056fcea72bc25d7fa9eafac174ce56b80cf99571.ts b/crates/swc_bundler/tests/.cache/deno/056fcea72bc25d7fa9eafac174ce56b80cf99571.ts deleted file mode 100644 index 3d67887d7a12..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/056fcea72bc25d7fa9eafac174ce56b80cf99571.ts +++ /dev/null @@ -1,353 +0,0 @@ -// Loaded from https://deno.land/x/oak@v6.3.1/cookies.ts - - -// Copyright 2018-2020 the oak authors. All rights reserved. MIT license. - -// This was heavily influenced by -// [cookies](https://github.com/pillarjs/cookies/blob/master/index.js) - -import type { KeyStack } from "./keyStack.ts"; -import type { Request } from "./request.ts"; -import type { Response } from "./response.ts"; - -export interface CookiesOptions { - keys?: KeyStack; - secure?: boolean; -} - -export interface CookiesGetOptions { - signed?: boolean; -} - -export interface CookiesSetDeleteOptions { - domain?: string; - expires?: Date; - httpOnly?: boolean; - maxAge?: number; - overwrite?: boolean; - path?: string; - secure?: boolean; - sameSite?: "strict" | "lax" | "none" | boolean; - signed?: boolean; -} - -type CookieAttributes = CookiesSetDeleteOptions; - -const matchCache: Record = {}; - -// deno-lint-ignore no-control-regex -const FIELD_CONTENT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; -const KEY_REGEXP = /(?:^|;) *([^=]*)=[^;]*/g; -const SAME_SITE_REGEXP = /^(?:lax|none|strict)$/i; - -function getPattern(name: string): RegExp { - if (name in matchCache) { - return matchCache[name]; - } - - return matchCache[name] = new RegExp( - `(?:^|;) *${name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")}=([^;]*)`, - ); -} - -function pushCookie(headers: string[], cookie: Cookie): void { - if (cookie.overwrite) { - for (let i = headers.length - 1; i >= 0; i--) { - if (headers[i].indexOf(`${cookie.name}=`) === 0) { - headers.splice(i, 1); - } - } - } - headers.push(cookie.toHeader()); -} - -function validateCookieProperty( - key: string, - value: string | undefined | null, -): void { - if (value && !FIELD_CONTENT_REGEXP.test(value)) { - throw new TypeError(`The ${key} of the cookie (${value}) is invalid.`); - } -} - -class Cookie implements CookieAttributes { - domain?: string; - expires?: Date; - httpOnly = true; - maxAge?: number; - name: string; - overwrite = false; - path = "/"; - sameSite: "strict" | "lax" | "none" | boolean = false; - secure = false; - signed?: boolean; - value: string; - - /** A logical representation of a cookie, used to internally manage the - * cookie instances. */ - constructor( - name: string, - value: string | null, - attributes: CookieAttributes, - ) { - validateCookieProperty("name", name); - validateCookieProperty("value", value); - this.name = name; - this.value = value ?? ""; - Object.assign(this, attributes); - if (!this.value) { - this.expires = new Date(0); - this.maxAge = undefined; - } - - validateCookieProperty("path", this.path); - validateCookieProperty("domain", this.domain); - if ( - this.sameSite && typeof this.sameSite === "string" && - !SAME_SITE_REGEXP.test(this.sameSite) - ) { - throw new TypeError( - `The sameSite of the cookie ("${this.sameSite}") is invalid.`, - ); - } - } - - toHeader(): string { - let header = this.toString(); - if (this.maxAge) { - this.expires = new Date(Date.now() + (this.maxAge * 1000)); - } - - if (this.path) { - header += `; path=${this.path}`; - } - if (this.expires) { - header += `; expires=${this.expires.toUTCString()}`; - } - if (this.domain) { - header += `; domain=${this.domain}`; - } - if (this.sameSite) { - header += `; samesite=${ - this.sameSite === true ? "strict" : this.sameSite.toLowerCase() - }`; - } - if (this.secure) { - header += "; secure"; - } - if (this.httpOnly) { - header += "; httponly"; - } - - return header; - } - - toString(): string { - return `${this.name}=${this.value}`; - } -} - -/** An interface which allows setting and accessing cookies related to both the - * current request and response. */ -export class Cookies { - #cookieKeys?: string[]; - #keys?: KeyStack; - #request: Request; - #response: Response; - #secure?: boolean; - - #requestKeys = (): string[] => { - if (this.#cookieKeys) { - return this.#cookieKeys; - } - const result = this.#cookieKeys = [] as string[]; - const header = this.#request.headers.get("cookie"); - if (!header) { - return result; - } - let matches: RegExpExecArray | null; - while ((matches = KEY_REGEXP.exec(header))) { - const [, key] = matches; - result.push(key); - } - return result; - }; - - constructor( - request: Request, - response: Response, - options: CookiesOptions = {}, - ) { - const { keys, secure } = options; - this.#keys = keys; - this.#request = request; - this.#response = response; - this.#secure = secure; - } - - /** Set a cookie to be deleted in the response. This is a "shortcut" to - * `.set(name, null, options?)`. */ - delete(name: string, options: CookiesSetDeleteOptions = {}): boolean { - this.set(name, null, options); - return true; - } - - /** Iterate over the request's cookies, yielding up a tuple containing the - * key and the value. - * - * If there are keys set on the application, only keys and values that are - * properly signed will be returned. */ - *entries(): IterableIterator<[string, string]> { - const keys = this.#requestKeys(); - for (const key of keys) { - const value = this.get(key); - if (value) { - yield [key, value]; - } - } - } - - forEach( - callback: (key: string, value: string, cookies: this) => void, - // deno-lint-ignore no-explicit-any - thisArg: any = null, - ): void { - const keys = this.#requestKeys(); - for (const key of keys) { - const value = this.get(key); - if (value) { - callback.call(thisArg, key, value, this); - } - } - } - - /** Get the value of a cookie from the request. - * - * If the cookie is signed, and the signature is invalid, the cookie will - * be set to be deleted in the the response. If the signature uses an "old" - * key, the cookie will be re-signed with the current key and be added to the - * response to be updated. */ - get(name: string, options: CookiesGetOptions = {}): string | undefined { - const signed = options.signed ?? !!this.#keys; - const nameSig = `${name}.sig`; - - const header = this.#request.headers.get("cookie"); - if (!header) { - return; - } - const match = header.match(getPattern(name)); - if (!match) { - return; - } - const [, value] = match; - if (!signed) { - return value; - } - const digest = this.get(nameSig, { signed: false }); - if (!digest) { - return; - } - const data = `${name}=${value}`; - if (!this.#keys) { - throw new TypeError("keys required for signed cookies"); - } - const index = this.#keys.indexOf(data, digest); - - if (index < 0) { - this.delete(nameSig, { path: "/", signed: false }); - } else { - if (index) { - // the key has "aged" and needs to be re-signed - this.set(nameSig, this.#keys.sign(data), { signed: false }); - } - return value; - } - } - - /** Iterate over the request's cookies, yielding up the keys. - * - * If there are keys set on the application, only the keys that are properly - * signed will be returned. */ - *keys(): IterableIterator { - const keys = this.#requestKeys(); - for (const key of keys) { - const value = this.get(key); - if (value) { - yield key; - } - } - } - - /** Set a cookie in the response. - * - * If there are keys set in the application, cookies will be automatically - * signed, unless overridden by the set options. Cookies can be deleted by - * setting the value to `null`. */ - set( - name: string, - value: string | null, - options: CookiesSetDeleteOptions = {}, - ): this { - const request = this.#request; - const response = this.#response; - let headers = response.headers.get("Set-Cookie") ?? [] as string[]; - if (typeof headers === "string") { - headers = [headers]; - } - const secure = this.#secure !== undefined ? this.#secure : request.secure; - const signed = options.signed ?? !!this.#keys; - - if (!secure && options.secure) { - throw new TypeError( - "Cannot send secure cookie over unencrypted connection.", - ); - } - - const cookie = new Cookie(name, value, options); - cookie.secure = options.secure ?? secure; - pushCookie(headers, cookie); - - if (signed) { - if (!this.#keys) { - throw new TypeError(".keys required for signed cookies."); - } - cookie.value = this.#keys.sign(cookie.toString()); - cookie.name += ".sig"; - pushCookie(headers, cookie); - } - - for (const header of headers) { - response.headers.append("Set-Cookie", header); - } - return this; - } - - /** Iterate over the request's cookies, yielding up each value. - * - * If there are keys set on the application, only the values that are - * properly signed will be returned. */ - *values(): IterableIterator { - const keys = this.#requestKeys(); - for (const key of keys) { - const value = this.get(key); - if (value) { - yield value; - } - } - } - - /** Iterate over the request's cookies, yielding up a tuple containing the - * key and the value. - * - * If there are keys set on the application, only keys and values that are - * properly signed will be returned. */ - *[Symbol.iterator](): IterableIterator<[string, string]> { - const keys = this.#requestKeys(); - for (const key of keys) { - const value = this.get(key); - if (value) { - yield [key, value]; - } - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/05813f2855546fdac890dfbc4b16e07212ab3731.ts b/crates/swc_bundler/tests/.cache/deno/05813f2855546fdac890dfbc4b16e07212ab3731.ts deleted file mode 100644 index f943ba2a5d56..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/05813f2855546fdac890dfbc4b16e07212ab3731.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/permissions/permission_strings.ts - - -import { DiscordBitwisePermissionFlags } from "./bitwise_permission_flags.ts"; - -export type PermissionStrings = keyof typeof DiscordBitwisePermissionFlags; -export type Permission = PermissionStrings; diff --git a/crates/swc_bundler/tests/.cache/deno/0598e2f21b0a75467096a0aa8082dcc14ba23a59.ts b/crates/swc_bundler/tests/.cache/deno/0598e2f21b0a75467096a0aa8082dcc14ba23a59.ts deleted file mode 100644 index e98d809d77cf..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0598e2f21b0a75467096a0aa8082dcc14ba23a59.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Loaded from https://deno.land/x/god_crypto@v0.2.0/src/eme_oaep.ts - - -import { createHash } from "https://deno.land/std/hash/mod.ts"; -import { mgf1 } from "./primitives.ts"; -import { concat, xor, random_bytes } from "./helper.ts"; - -/** - * https://tools.ietf.org/html/rfc3447#page-10 - * - * @param label - * @param m - * @param k - * @param algorithm - */ -export function eme_oaep_encode(label: Uint8Array, m: Uint8Array, k: number, algorithm: "sha1" | "sha256"): Uint8Array { - const labelHash = new Uint8Array(createHash(algorithm).update(label).digest()); - - const ps = new Uint8Array(k - labelHash.length * 2 - 2 - m.length); - const db = concat(labelHash, ps, [0x01], m); - const seed = random_bytes(labelHash.length); - const dbMask = mgf1(seed, k - labelHash.length - 1, algorithm); - const maskedDb = xor(db, dbMask); - const seedMask = mgf1(maskedDb, labelHash.length, algorithm); - const maskedSeed = xor(seed, seedMask); - - return concat([0x00], maskedSeed, maskedDb); -} - -export function eme_oaep_decode(label: Uint8Array, c: Uint8Array, k: number, algorithm: "sha1" | "sha256"): Uint8Array { - const labelHash = new Uint8Array(createHash(algorithm).update(label).digest()); - const maskedSeed = c.slice(1, 1 + labelHash.length); - const maskedDb = c.slice(1 + labelHash.length); - const seedMask = mgf1(maskedDb, labelHash.length, algorithm); - const seed = xor(maskedSeed, seedMask); - const dbMask = mgf1(seed, k - labelHash.length - 1, algorithm); - const db = xor(maskedDb, dbMask); - - let ptr = labelHash.length; - while(ptr < db.length && db[ptr] === 0) ptr++; - - return db.slice(ptr + 1); -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/05d629026c1d721c6cbc08637b23fdd0672ea565.ts b/crates/swc_bundler/tests/.cache/deno/05d629026c1d721c6cbc08637b23fdd0672ea565.ts deleted file mode 100644 index b2a9b85baa70..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/05d629026c1d721c6cbc08637b23fdd0672ea565.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Loaded from https://deno.land/std@0.84.0/path/_constants.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. - -// Alphabet chars. -export const CHAR_UPPERCASE_A = 65; /* A */ -export const CHAR_LOWERCASE_A = 97; /* a */ -export const CHAR_UPPERCASE_Z = 90; /* Z */ -export const CHAR_LOWERCASE_Z = 122; /* z */ - -// Non-alphabetic chars. -export const CHAR_DOT = 46; /* . */ -export const CHAR_FORWARD_SLASH = 47; /* / */ -export const CHAR_BACKWARD_SLASH = 92; /* \ */ -export const CHAR_VERTICAL_LINE = 124; /* | */ -export const CHAR_COLON = 58; /* : */ -export const CHAR_QUESTION_MARK = 63; /* ? */ -export const CHAR_UNDERSCORE = 95; /* _ */ -export const CHAR_LINE_FEED = 10; /* \n */ -export const CHAR_CARRIAGE_RETURN = 13; /* \r */ -export const CHAR_TAB = 9; /* \t */ -export const CHAR_FORM_FEED = 12; /* \f */ -export const CHAR_EXCLAMATION_MARK = 33; /* ! */ -export const CHAR_HASH = 35; /* # */ -export const CHAR_SPACE = 32; /* */ -export const CHAR_NO_BREAK_SPACE = 160; /* \u00A0 */ -export const CHAR_ZERO_WIDTH_NOBREAK_SPACE = 65279; /* \uFEFF */ -export const CHAR_LEFT_SQUARE_BRACKET = 91; /* [ */ -export const CHAR_RIGHT_SQUARE_BRACKET = 93; /* ] */ -export const CHAR_LEFT_ANGLE_BRACKET = 60; /* < */ -export const CHAR_RIGHT_ANGLE_BRACKET = 62; /* > */ -export const CHAR_LEFT_CURLY_BRACKET = 123; /* { */ -export const CHAR_RIGHT_CURLY_BRACKET = 125; /* } */ -export const CHAR_HYPHEN_MINUS = 45; /* - */ -export const CHAR_PLUS = 43; /* + */ -export const CHAR_DOUBLE_QUOTE = 34; /* " */ -export const CHAR_SINGLE_QUOTE = 39; /* ' */ -export const CHAR_PERCENT = 37; /* % */ -export const CHAR_SEMICOLON = 59; /* ; */ -export const CHAR_CIRCUMFLEX_ACCENT = 94; /* ^ */ -export const CHAR_GRAVE_ACCENT = 96; /* ` */ -export const CHAR_AT = 64; /* @ */ -export const CHAR_AMPERSAND = 38; /* & */ -export const CHAR_EQUAL = 61; /* = */ - -// Digits -export const CHAR_0 = 48; /* 0 */ -export const CHAR_9 = 57; /* 9 */ diff --git a/crates/swc_bundler/tests/.cache/deno/060431bb79a5fdc17dd38d75812ec1007c8a09ac.ts b/crates/swc_bundler/tests/.cache/deno/060431bb79a5fdc17dd38d75812ec1007c8a09ac.ts deleted file mode 100644 index 602332f464e0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/060431bb79a5fdc17dd38d75812ec1007c8a09ac.ts +++ /dev/null @@ -1,104 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/encoding/_yaml/schema.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { YAMLError } from "./error.ts"; -import type { KindType, Type } from "./type.ts"; -import type { Any, ArrayObject } from "./utils.ts"; - -function compileList( - schema: Schema, - name: "implicit" | "explicit", - result: Type[], -): Type[] { - const exclude: number[] = []; - - for (const includedSchema of schema.include) { - result = compileList(includedSchema, name, result); - } - - for (const currentType of schema[name]) { - for ( - let previousIndex = 0; - previousIndex < result.length; - previousIndex++ - ) { - const previousType = result[previousIndex]; - if ( - previousType.tag === currentType.tag && - previousType.kind === currentType.kind - ) { - exclude.push(previousIndex); - } - } - - result.push(currentType); - } - - return result.filter((type, index): unknown => !exclude.includes(index)); -} - -export type TypeMap = { [k in KindType | "fallback"]: ArrayObject }; -function compileMap(...typesList: Type[][]): TypeMap { - const result: TypeMap = { - fallback: {}, - mapping: {}, - scalar: {}, - sequence: {}, - }; - - for (const types of typesList) { - for (const type of types) { - if (type.kind !== null) { - result[type.kind][type.tag] = result["fallback"][type.tag] = type; - } - } - } - return result; -} - -export class Schema implements SchemaDefinition { - public static SCHEMA_DEFAULT?: Schema; - - public implicit: Type[]; - public explicit: Type[]; - public include: Schema[]; - - public compiledImplicit: Type[]; - public compiledExplicit: Type[]; - public compiledTypeMap: TypeMap; - - constructor(definition: SchemaDefinition) { - this.explicit = definition.explicit || []; - this.implicit = definition.implicit || []; - this.include = definition.include || []; - - for (const type of this.implicit) { - if (type.loadKind && type.loadKind !== "scalar") { - throw new YAMLError( - // eslint-disable-next-line max-len - "There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.", - ); - } - } - - this.compiledImplicit = compileList(this, "implicit", []); - this.compiledExplicit = compileList(this, "explicit", []); - this.compiledTypeMap = compileMap( - this.compiledImplicit, - this.compiledExplicit, - ); - } - - public static create(): void {} -} - -export interface SchemaDefinition { - implicit?: Any[]; - explicit?: Type[]; - include?: Schema[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/06199e7707f73bcd1b860910ef3e1e202d83f6f6.ts b/crates/swc_bundler/tests/.cache/deno/06199e7707f73bcd1b860910ef3e1e202d83f6f6.ts deleted file mode 100644 index 83b7c7210509..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/06199e7707f73bcd1b860910ef3e1e202d83f6f6.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/gzip/writer_gzip.ts - - -import { EventEmitter, Crc32Stream } from "../deps.ts"; -import { concatUint8Array } from "../utils/uint8.ts"; -import { getHeader, putLong } from "./gzip.ts"; -import { Deflate } from "../zlib/mod.ts"; - -type File = Deno.File; - -interface Options { - onceSize?: number; -} - -export default class Writer extends EventEmitter implements Deno.Writer { - private writer!: File; - private bytesWritten = 0; - private path: string; - private chuncks: Uint8Array[] = []; - private onceSize: number; - private chuncksBytes = 0; - private crc32Stream = new Crc32Stream(); - private deflate: Deflate = new Deflate({ raw: true }); - - constructor( - path: string, - options?: Options, - ) { - super(); - this.path = path; - this.onceSize = options?.onceSize ?? 1024 * 1024; - } - - async setup(name?: string, timestamp?: number): Promise { - this.writer = await Deno.open(this.path, { - write: true, - create: true, - truncate: true, - }); - const headers = getHeader({ - timestamp, - name, - }); - await Deno.write(this.writer.rid, headers); - } - - async write(p: Uint8Array): Promise { - const readed = p.byteLength; - const copy = new Uint8Array(p); - this.chuncks.push(copy); - this.chuncksBytes += readed; - this.bytesWritten += readed; - this.crc32Stream.append(copy); - if (readed < 16384) { - const buf = concatUint8Array(this.chuncks); - const compressed = this.deflate.push(buf, true); - await Deno.writeAll(this.writer, compressed); - const tail = this.getTail(); - await Deno.write(this.writer.rid, tail); - } else if (this.chuncksBytes >= this.onceSize) { - const buf = concatUint8Array(this.chuncks); - const compressed = this.deflate.push(buf, false); - await Deno.writeAll(this.writer, compressed); - this.chuncks.length = 0; - this.chuncksBytes = 0; - this.emit("bytesWritten", this.bytesWritten); - } - return readed; - } - - close(): void { - this.emit("bytesWritten", this.bytesWritten); - Deno.close(this.writer.rid); - } - - private getTail() { - const arr: number[] = []; - putLong(parseInt(this.crc32Stream.crc32, 16), arr); - putLong(this.bytesWritten, arr); - return new Uint8Array(arr); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/061dc1bc102d98a87c92425e09bf0203e0434fc9.ts b/crates/swc_bundler/tests/.cache/deno/061dc1bc102d98a87c92425e09bf0203e0434fc9.ts deleted file mode 100644 index e349973205c5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/061dc1bc102d98a87c92425e09bf0203e0434fc9.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/log/levels.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** Get log level numeric values through enum constants - */ -export enum LogLevels { - NOTSET = 0, - DEBUG = 10, - INFO = 20, - WARNING = 30, - ERROR = 40, - CRITICAL = 50, -} - -/** Permitted log level names */ -export const LogLevelNames = Object.keys(LogLevels).filter((key) => - isNaN(Number(key)) -); - -/** Union of valid log level strings */ -export type LevelName = keyof typeof LogLevels; - -const byLevel: Record = { - [String(LogLevels.NOTSET)]: "NOTSET", - [String(LogLevels.DEBUG)]: "DEBUG", - [String(LogLevels.INFO)]: "INFO", - [String(LogLevels.WARNING)]: "WARNING", - [String(LogLevels.ERROR)]: "ERROR", - [String(LogLevels.CRITICAL)]: "CRITICAL", -}; - -/** Returns the numeric log level associated with the passed, - * stringy log level name. - */ -export function getLevelByName(name: LevelName): number { - switch (name) { - case "NOTSET": - return LogLevels.NOTSET; - case "DEBUG": - return LogLevels.DEBUG; - case "INFO": - return LogLevels.INFO; - case "WARNING": - return LogLevels.WARNING; - case "ERROR": - return LogLevels.ERROR; - case "CRITICAL": - return LogLevels.CRITICAL; - default: - throw new Error(`no log level found for "${name}"`); - } -} - -/** Returns the stringy log level name provided the numeric log level */ -export function getLevelName(level: number): LevelName { - const levelName = byLevel[level]; - if (levelName) { - return levelName; - } - throw new Error(`no level name found for level: ${level}`); -} diff --git a/crates/swc_bundler/tests/.cache/deno/064f179d0e57a87f277f9972efaeaa1c11faeb99.ts b/crates/swc_bundler/tests/.cache/deno/064f179d0e57a87f277f9972efaeaa1c11faeb99.ts deleted file mode 100644 index 84afc106b5a4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/064f179d0e57a87f277f9972efaeaa1c11faeb99.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/ws/resharder.ts - - -import { getGatewayBot } from "../helpers/misc/get_gateway_bot.ts"; -import { ws } from "./ws.ts"; - -/** The handler to automatically reshard when necessary. */ -export async function resharder() { - ws.botGatewayData = await getGatewayBot(); - - const percentage = ((ws.botGatewayData.shards - ws.maxShards) / ws.maxShards) * 100; - // Less than necessary% being used so do nothing - if (percentage < ws.reshardPercentage) return; - - // Don't have enough identify rate limits to reshard - if (ws.botGatewayData.sessionStartLimit.remaining < ws.botGatewayData.shards) { - return; - } - - // Begin resharding - ws.maxShards = ws.botGatewayData.shards; - // If more than 100K servers, begin switching to 16x sharding - if (ws.maxShards && ws.useOptimalLargeBotSharding) { - ws.maxShards = Math.ceil( - ws.maxShards / - (ws.botGatewayData.sessionStartLimit.maxConcurrency === 1 - ? 16 - : ws.botGatewayData.sessionStartLimit.maxConcurrency) - ); - } - - ws.spawnShards(ws.firstShardId); -} diff --git a/crates/swc_bundler/tests/.cache/deno/06690f3535d0a01288299061649a51b1ac0435aa.ts b/crates/swc_bundler/tests/.cache/deno/06690f3535d0a01288299061649a51b1ac0435aa.ts deleted file mode 100644 index 099c47574037..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/06690f3535d0a01288299061649a51b1ac0435aa.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Loaded from https://deno.land/std@0.81.0/async/pool.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -/** - * pooledMap transforms values from an (async) iterable into another async - * iterable. The transforms are done concurrently, with a max concurrency - * defined by the poolLimit. - * - * @param poolLimit The maximum count of items being processed concurrently. - * @param array The input array for mapping. - * @param iteratorFn The function to call for every item of the array. - */ -export function pooledMap( - poolLimit: number, - array: Iterable | AsyncIterable, - iteratorFn: (data: T) => Promise, -): AsyncIterableIterator { - // Create the async iterable that is returned from this function. - const res = new TransformStream, R>({ - async transform( - p: Promise, - controller: TransformStreamDefaultController, - ): Promise { - controller.enqueue(await p); - }, - }); - // Start processing items from the iterator - (async (): Promise => { - const writer = res.writable.getWriter(); - const executing: Array> = []; - for await (const item of array) { - const p = Promise.resolve().then(() => iteratorFn(item)); - writer.write(p); - const e: Promise = p.then(() => - executing.splice(executing.indexOf(e), 1) - ); - executing.push(e); - if (executing.length >= poolLimit) { - await Promise.race(executing); - } - } - // Wait until all ongoing events have processed, then close the writer. - await Promise.all(executing); - writer.close(); - })(); - return res.readable.getIterator(); -} diff --git a/crates/swc_bundler/tests/.cache/deno/06840a8904e244f906a89aff3c364599d24554af.ts b/crates/swc_bundler/tests/.cache/deno/06840a8904e244f906a89aff3c364599d24554af.ts deleted file mode 100644 index d2d2d8490a24..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/06840a8904e244f906a89aff3c364599d24554af.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_isObject.js - - -export default function _isObject(x) { - return Object.prototype.toString.call(x) === '[object Object]'; -} diff --git a/crates/swc_bundler/tests/.cache/deno/068c2d45fb9edc362a3af0a37718179290fbd722.ts b/crates/swc_bundler/tests/.cache/deno/068c2d45fb9edc362a3af0a37718179290fbd722.ts deleted file mode 100644 index 2a8d8c38e465..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/068c2d45fb9edc362a3af0a37718179290fbd722.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/assertValidName.js - - -import devAssert from '../jsutils/devAssert.js'; -import { GraphQLError } from '../error/GraphQLError.js'; -const NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/; -/** - * Upholds the spec rules about naming. - */ - -export function assertValidName(name) { - const error = isValidNameError(name); - - if (error) { - throw error; - } - - return name; -} -/** - * Returns an Error if a name is invalid. - */ - -export function isValidNameError(name) { - devAssert(typeof name === 'string', 'Expected name to be a string.'); - - if (name.length > 1 && name[0] === '_' && name[1] === '_') { - return new GraphQLError(`Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`); - } - - if (!NAME_RX.test(name)) { - return new GraphQLError(`Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "${name}" does not.`); - } -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/06ac04fc4e5dd9779a3391910b554b0bd6c0c72c.ts b/crates/swc_bundler/tests/.cache/deno/06ac04fc4e5dd9779a3391910b554b0bd6c0c72c.ts deleted file mode 100644 index a6f66317bfc7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/06ac04fc4e5dd9779a3391910b554b0bd6c0c72c.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/std@0.67.0/path/separator.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** This module is browser compatible. */ - -import { isWindows } from "./_constants.ts"; - -export const SEP = isWindows ? "\\" : "/"; -export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/; diff --git a/crates/swc_bundler/tests/.cache/deno/06bc18457d3941be8672f05312cd12e11aab6884.ts b/crates/swc_bundler/tests/.cache/deno/06bc18457d3941be8672f05312cd12e11aab6884.ts deleted file mode 100644 index 681180b19f86..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/06bc18457d3941be8672f05312cd12e11aab6884.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/ban.ts - - -import { User } from "../users/user.ts"; - -/** https://discord.com/developers/docs/resources/guild#ban-object */ -export interface Ban { - /** The reason for the ban */ - reason: string | null; - /** The banned user */ - user: User; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0707cfdbd33633257119e59325e21b1157e536d0.ts b/crates/swc_bundler/tests/.cache/deno/0707cfdbd33633257119e59325e21b1157e536d0.ts deleted file mode 100644 index 8f755d632db6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0707cfdbd33633257119e59325e21b1157e536d0.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/webhooks/execute_webhook.ts - - -import { Embed } from "../embeds/embed.ts"; -import { AllowedMentions } from "../messages/allowed_mentions.ts"; -import { FileContent } from "../discordeno/file_content.ts"; -import { SnakeCasedPropertiesDeep } from "../util.ts"; - -/** https://discord.com/developers/docs/resources/webhook#execute-webhook */ -export interface ExecuteWebhook { - /** Waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error) */ - wait?: boolean; - /** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */ - threadId?: bigint; - /** The message contents (up to 2000 characters) */ - content?: string; - /** Override the default username of the webhook */ - username?: string; - /** Override the default avatar of the webhook */ - avatarUrl?: string; - /** True if this is a TTS message */ - tts?: boolean; - /** The contents of the file being sent */ - file?: FileContent | FileContent[]; - /** Embedded `rich` content */ - embeds?: Embed[]; - /** Allowed mentions for the message */ - allowedMentions?: AllowedMentions; -} - -export type DiscordExecuteWebhook = SnakeCasedPropertiesDeep>; diff --git a/crates/swc_bundler/tests/.cache/deno/0746b127cd90af92cf12b2ec02c10c123b75903c.ts b/crates/swc_bundler/tests/.cache/deno/0746b127cd90af92cf12b2ec02c10c123b75903c.ts deleted file mode 100644 index 91efe130c55d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0746b127cd90af92cf12b2ec02c10c123b75903c.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/NoUnusedVariablesRule.js - - -import { GraphQLError } from '../../error/GraphQLError.js'; - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -export function NoUnusedVariablesRule(context) { - let variableDefs = []; - return { - OperationDefinition: { - enter() { - variableDefs = []; - }, - - leave(operation) { - const variableNameUsed = Object.create(null); - const usages = context.getRecursiveVariableUsages(operation); - - for (const { - node - } of usages) { - variableNameUsed[node.name.value] = true; - } - - for (const variableDef of variableDefs) { - const variableName = variableDef.variable.name.value; - - if (variableNameUsed[variableName] !== true) { - context.reportError(new GraphQLError(operation.name ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` : `Variable "$${variableName}" is never used.`, variableDef)); - } - } - } - - }, - - VariableDefinition(def) { - variableDefs.push(def); - } - - }; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/07549e322b5884b0b56710f621809fef08d1866e.ts b/crates/swc_bundler/tests/.cache/deno/07549e322b5884b0b56710f621809fef08d1866e.ts deleted file mode 100644 index b1165374640d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/07549e322b5884b0b56710f621809fef08d1866e.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Loaded from https://deno.land/x/tinyhttp@0.1.18/extensions/res/cookie.ts - - -import { Req, Res } from '../../deps.ts' -import * as cookie from 'https://deno.land/std@0.101.0/http/cookie.ts' - -export const setCookie = (req: Request, res: Response) => ( - name: string, - value: string, - options?: Omit -): Response => { - cookie.setCookie(req, { - value, - name, - ...options - }) - - return res -} - -export const clearCookie = (res: Response) => (name: string): Response => { - cookie.deleteCookie(res, name) - - return res -} diff --git a/crates/swc_bundler/tests/.cache/deno/07edaff2f29d36d34886867c4a9100a3250091ca.ts b/crates/swc_bundler/tests/.cache/deno/07edaff2f29d36d34886867c4a9100a3250091ca.ts deleted file mode 100644 index dffdec29c174..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/07edaff2f29d36d34886867c4a9100a3250091ca.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/path/_interface.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -/** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ -export interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; -} - -export type FormatInputPathObject = Partial; diff --git a/crates/swc_bundler/tests/.cache/deno/08120cba5feb53715566490767556b622333fcda.ts b/crates/swc_bundler/tests/.cache/deno/08120cba5feb53715566490767556b622333fcda.ts deleted file mode 100644 index 7fd44b0b51c3..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/08120cba5feb53715566490767556b622333fcda.ts +++ /dev/null @@ -1,132 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isTaxID.ts - - -/** - * An Employer Identification Number (EIN), also known as a Federal Tax Identification Number, - * is used to identify a business entity. - * - * NOTES: - * - Prefix 47 is being reserved for future use - * - Prefixes 26, 27, 45, 46 and 47 were previously assigned by the Philadelphia campus. - * - * See `http://www.irs.gov/Businesses/Small-Businesses-&-Self-Employed/How-EINs-are-Assigned-and-Valid-EIN-Prefixes` - * for more information. - */ - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * Campus prefixes according to locales - */ -/** - * @ignore - */ -const campusPrefix = { - 'en-US': { - andover: ['10', '12'], - atlanta: ['60', '67'], - austin: ['50', '53'], - brookhaven: [ - '01', - '02', - '03', - '04', - '05', - '06', - '11', - '13', - '14', - '16', - '21', - '22', - '23', - '25', - '34', - '51', - '52', - '54', - '55', - '56', - '57', - '58', - '59', - '65', - ], - cincinnati: ['30', '32', '35', '36', '37', '38', '61'], - fresno: ['15', '24'], - internet: ['20', '26', '27', '45', '46', '47'], - kansas: ['40', '44'], - memphis: ['94', '95'], - ogden: ['80', '90'], - philadelphia: [ - '33', - '39', - '41', - '42', - '43', - '46', - '48', - '62', - '63', - '64', - '66', - '68', - '71', - '72', - '73', - '74', - '75', - '76', - '77', - '81', - '82', - '83', - '84', - '85', - '86', - '87', - '88', - '91', - '92', - '93', - '98', - '99', - ], - sba: ['31'], - }, -}; - -/** - * @ignore - */ -const getPrefixes = (locale: string) => { - const prefixes = []; - - for (const location in (campusPrefix as any)[locale]) { - if ((campusPrefix as any)[locale].hasOwnProperty(location)) { - prefixes.push(...(campusPrefix as any)[locale][location]); - } - } - - prefixes.sort(); - - return prefixes; -}; - -// tax id regex formats for various loacles - -/** - * @ignore - */ -const taxIdFormat = { - 'en-US': /^\d{2}[- ]{0,1}\d{7}$/, -}; - -export const isTaxID = (str: string, locale = 'en-US') => { - assertString(str); - if (!(taxIdFormat as any)[locale].test(str)) { - return false; - } - return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/0861ab2da31544114172079b055ce1d743795b1d.ts b/crates/swc_bundler/tests/.cache/deno/0861ab2da31544114172079b055ce1d743795b1d.ts deleted file mode 100644 index 966e2ce8994b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0861ab2da31544114172079b055ce1d743795b1d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/std@0.99.0/_util/assert.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -export class DenoStdInternalError extends Error { - constructor(message: string) { - super(message); - this.name = "DenoStdInternalError"; - } -} - -/** Make an assertion, if not `true`, then throw. */ -export function assert(expr: unknown, msg = ""): asserts expr { - if (!expr) { - throw new DenoStdInternalError(msg); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/086270680629deac2a20a68fb1068f2473e47d4f.ts b/crates/swc_bundler/tests/.cache/deno/086270680629deac2a20a68fb1068f2473e47d4f.ts deleted file mode 100644 index 8e23535f3893..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/086270680629deac2a20a68fb1068f2473e47d4f.ts +++ /dev/null @@ -1,72 +0,0 @@ -// Loaded from https://deno.land/std@0.73.0/async/mux_async_iterator.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { Deferred, deferred } from "./deferred.ts"; - -interface TaggedYieldedValue { - iterator: AsyncIterableIterator; - value: T; -} - -/** The MuxAsyncIterator class multiplexes multiple async iterators into a - * single stream. It currently makes an assumption: - * - The final result (the value returned and not yielded from the iterator) - * does not matter; if there is any, it is discarded. - */ -export class MuxAsyncIterator implements AsyncIterable { - private iteratorCount = 0; - private yields: Array> = []; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - private throws: any[] = []; - private signal: Deferred = deferred(); - - add(iterator: AsyncIterableIterator): void { - ++this.iteratorCount; - this.callIteratorNext(iterator); - } - - private async callIteratorNext( - iterator: AsyncIterableIterator, - ): Promise { - try { - const { value, done } = await iterator.next(); - if (done) { - --this.iteratorCount; - } else { - this.yields.push({ iterator, value }); - } - } catch (e) { - this.throws.push(e); - } - this.signal.resolve(); - } - - async *iterate(): AsyncIterableIterator { - while (this.iteratorCount > 0) { - // Sleep until any of the wrapped iterators yields. - await this.signal; - - // Note that while we're looping over `yields`, new items may be added. - for (let i = 0; i < this.yields.length; i++) { - const { iterator, value } = this.yields[i]; - yield value; - this.callIteratorNext(iterator); - } - - if (this.throws.length) { - for (const e of this.throws) { - throw e; - } - this.throws.length = 0; - } - // Clear the `yields` list and reset the `signal` promise. - this.yields.length = 0; - this.signal = deferred(); - } - } - - [Symbol.asyncIterator](): AsyncIterableIterator { - return this.iterate(); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0889b0a101f4e90270d90a7834853dcb46bf71bc.ts b/crates/swc_bundler/tests/.cache/deno/0889b0a101f4e90270d90a7834853dcb46bf71bc.ts deleted file mode 100644 index b540df33a847..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0889b0a101f4e90270d90a7834853dcb46bf71bc.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/ansi/cursor_position.ts - - -import { cursorPosition } from "./ansi_escapes.ts"; - -/** Cursor position. */ -export interface Cursor { - x: number; - y: number; -} - -/** Cursor position options. */ -export interface CursorPositionOptions { - stdout?: Deno.WriterSync; - stdin?: Deno.ReaderSync & { rid: number }; -} - -/** - * Get cursor position. - * @param options Options. - * ``` - * const cursor: Cursor = getCursorPosition(); - * console.log(cursor); // { x: 0, y: 14} - * ``` - */ -export function getCursorPosition(options: CursorPositionOptions): Cursor { - const stdout: Deno.WriterSync = options?.stdout ?? Deno.stdout; - const stdin: Deno.ReaderSync & { rid: number } = options?.stdin ?? Deno.stdin; - const data = new Uint8Array(8); - - Deno.setRaw(stdin.rid, true); - stdout.writeSync(new TextEncoder().encode(cursorPosition)); - stdin.readSync(data); - Deno.setRaw(stdin.rid, false); - - const [y, x] = new TextDecoder() - .decode(data) - .match(/\[(\d+);(\d+)R/) - ?.slice(1, 3) - .map(Number) ?? [0, 0]; - - return { x, y }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/08ebb50fccb7ae62f9102d66ba379b39e85bc40f.ts b/crates/swc_bundler/tests/.cache/deno/08ebb50fccb7ae62f9102d66ba379b39e85bc40f.ts deleted file mode 100644 index d3f0d1e218fa..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/08ebb50fccb7ae62f9102d66ba379b39e85bc40f.ts +++ /dev/null @@ -1,156 +0,0 @@ -// Loaded from https://deno.land/x/media_types@v2.9.1/mod.ts - - -/*! - * Ported from: https://github.com/jshttp/mime-types and licensed as: - * - * (The MIT License) - * - * Copyright (c) 2014 Jonathan Ong - * Copyright (c) 2015 Douglas Christopher Wilson - * Copyright (c) 2020 the Deno authors - * Copyright (c) 2020 the oak authors - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * 'Software'), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import { db } from "./db.ts"; -import { extname } from "./deps.ts"; - -const EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/; -const TEXT_TYPE_REGEXP = /^text\//i; - -/** A map of extensions for a given media type */ -export const extensions = new Map(); - -/** A map of the media type for a given extension */ -export const types = new Map(); - -/** Internal function to populate the maps based on the Mime DB */ -function populateMaps( - extensions: Map, - types: Map, -): void { - const preference = ["nginx", "apache", undefined, "iana"]; - - for (const type of Object.keys(db)) { - const mime = db[type]; - const exts = mime.extensions; - - if (!exts || !exts.length) { - continue; - } - - extensions.set(type, exts); - - for (const ext of exts) { - const current = types.get(ext); - if (current) { - const from = preference.indexOf(db[current].source); - const to = preference.indexOf(mime.source); - - if ( - current !== "application/octet-stream" && - (from > to || - (from === to && current.substr(0, 12) === "application/")) - ) { - continue; - } - } - - types.set(ext, type); - } - } -} - -// Populate the maps upon module load -populateMaps(extensions, types); - -/** Given a media type return any default charset string. Returns `undefined` - * if not resolvable. - */ -export function charset(type: string): string | undefined { - const m = EXTRACT_TYPE_REGEXP.exec(type); - if (!m) { - return undefined; - } - const [match] = m; - const mime = db[match.toLowerCase()]; - - if (mime && mime.charset) { - return mime.charset; - } - - if (TEXT_TYPE_REGEXP.test(match)) { - return "UTF-8"; - } - - return undefined; -} - -/** Given an extension, lookup the appropriate media type for that extension. - * Likely you should be using `contentType()` though instead. - */ -export function lookup(path: string): string | undefined { - const extension = extname("x." + path) - .toLowerCase() - .substr(1); - - return types.get(extension); -} - -/** Given an extension or media type, return the full `Content-Type` header - * string. Returns `undefined` if not resolvable. - */ -export function contentType(str: string): string | undefined { - let mime = str.includes("/") ? str : lookup(str); - - if (!mime) { - return undefined; - } - - if (!mime.includes("charset")) { - const cs = charset(mime); - if (cs) { - mime += `; charset=${cs.toLowerCase()}`; - } - } - - return mime; -} - -/** Given a media type, return the most appropriate extension or return - * `undefined` if there is none. - */ -export function extension(type: string): string | undefined { - const match = EXTRACT_TYPE_REGEXP.exec(type); - - if (!match) { - return undefined; - } - - const exts = extensions.get(match[1].toLowerCase()); - - if (!exts || !exts.length) { - return undefined; - } - - return exts[0]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/08fb5ffb652d3ab4254036be928c3aa4652e251a.ts b/crates/swc_bundler/tests/.cache/deno/08fb5ffb652d3ab4254036be928c3aa4652e251a.ts deleted file mode 100644 index f9d4d46e11cc..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/08fb5ffb652d3ab4254036be928c3aa4652e251a.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/mod.ts - - -import * as segno from './lib/index.ts'; - -// exporting all functions -export * from './lib/index.ts'; - -// exporting functions namespaced to segno -export { segno }; diff --git a/crates/swc_bundler/tests/.cache/deno/09052193f388a9d79c8450ad354894d5b0b4dd9d.ts b/crates/swc_bundler/tests/.cache/deno/09052193f388a9d79c8450ad354894d5b0b4dd9d.ts deleted file mode 100644 index 0e3200fd2636..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/09052193f388a9d79c8450ad354894d5b0b4dd9d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/emojis/get_emojis.ts - - -import { eventHandlers } from "../../bot.ts"; -import { cacheHandlers } from "../../cache.ts"; -import { rest } from "../../rest/rest.ts"; -import type { Emoji } from "../../types/emojis/emoji.ts"; -import { Errors } from "../../types/discordeno/errors.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; -import { Collection } from "../../util/collection.ts"; -import { endpoints } from "../../util/constants.ts"; - -/** - * Returns a list of emojis for the given guild. - * - * ⚠️ **If you need this, you are probably doing something wrong. Always use cache.guilds.get()?.emojis - */ -export async function getEmojis(guildId: bigint, addToCache = true) { - const result = await rest.runMethod("get", endpoints.GUILD_EMOJIS(guildId)); - - if (addToCache) { - const guild = await cacheHandlers.get("guilds", guildId); - if (!guild) throw new Error(Errors.GUILD_NOT_FOUND); - - result.forEach((emoji) => { - eventHandlers.debug?.("loop", `Running forEach loop in get_emojis file.`); - guild.emojis.set(snowflakeToBigint(emoji.id!), emoji); - }); - - await cacheHandlers.set("guilds", guildId, guild); - } - - return new Collection(result.map((e) => [e.id!, e])); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0921d954843d1a985feac7de57d6c1db75b7500e.ts b/crates/swc_bundler/tests/.cache/deno/0921d954843d1a985feac7de57d6c1db75b7500e.ts deleted file mode 100644 index a3b65246a0c6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0921d954843d1a985feac7de57d6c1db75b7500e.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/path/separator.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** This module is browser compatible. */ - -import { isWindows } from "../_util/os.ts"; - -export const SEP = isWindows ? "\\" : "/"; -export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/; diff --git a/crates/swc_bundler/tests/.cache/deno/09236d67cd7c89114ef7fae5927846001fdb3ee1.ts b/crates/swc_bundler/tests/.cache/deno/09236d67cd7c89114ef7fae5927846001fdb3ee1.ts deleted file mode 100644 index 36747592f7c8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/09236d67cd7c89114ef7fae5927846001fdb3ee1.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Loaded from https://deno.land/x/colorlog@v1.0/mod.ts - - -const reset: String = "\x1b[0m"; -const red: String = "\x1b[31m"; -const green: String = "\x1b[32m"; -const yellow: String = "\x1b[33m"; - -function error(val: any) { - return (red + val + reset); -} - -function success(val: any) { - return (green + val + reset); -} - -function warning(val: any) { - return (yellow + val + reset); -} -function errorLog(val: any) { - console.log(red + val + reset); -} - -function successLog(val: any) { - console.log(green + val + reset); -} - -function warningLog(val: any) { - console.log(yellow + val + reset); -} - -export { error, success, warning, errorLog, successLog, warningLog }; diff --git a/crates/swc_bundler/tests/.cache/deno/09383f7134bcbb64cadf410adb933d67b8a87fc1.ts b/crates/swc_bundler/tests/.cache/deno/09383f7134bcbb64cadf410adb933d67b8a87fc1.ts deleted file mode 100644 index 17272d9a873c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/09383f7134bcbb64cadf410adb933d67b8a87fc1.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/toPairs.js - - -import _curry1 from './internal/_curry1.js'; -import _has from './internal/_has.js'; - - -/** - * Converts an object into an array of key, value arrays. Only the object's - * own properties are used. - * Note that the order of the output array is not guaranteed to be consistent - * across different JS platforms. - * - * @func - * @memberOf R - * @since v0.4.0 - * @category Object - * @sig {String: *} -> [[String,*]] - * @param {Object} obj The object to extract from - * @return {Array} An array of key, value arrays from the object's own properties. - * @see R.fromPairs - * @example - * - * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] - */ -var toPairs = _curry1(function toPairs(obj) { - var pairs = []; - for (var prop in obj) { - if (_has(prop, obj)) { - pairs[pairs.length] = [prop, obj[prop]]; - } - } - return pairs; -}); -export default toPairs; diff --git a/crates/swc_bundler/tests/.cache/deno/095c726f58dc8e8e09e5e723ca294ce0ffa2d12a.ts b/crates/swc_bundler/tests/.cache/deno/095c726f58dc8e8e09e5e723ca294ce0ffa2d12a.ts deleted file mode 100644 index d76c26646d98..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/095c726f58dc8e8e09e5e723ca294ce0ffa2d12a.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_xfilter.js - - -import _curry2 from './_curry2.js'; -import _xfBase from './_xfBase.js'; - - -function XFilter(f, xf) { - this.xf = xf; - this.f = f; -} -XFilter.prototype['@@transducer/init'] = _xfBase.init; -XFilter.prototype['@@transducer/result'] = _xfBase.result; -XFilter.prototype['@@transducer/step'] = function(result, input) { - return this.f(input) ? this.xf['@@transducer/step'](result, input) : result; -}; - -var _xfilter = _curry2(function _xfilter(f, xf) { return new XFilter(f, xf); }); -export default _xfilter; diff --git a/crates/swc_bundler/tests/.cache/deno/0977feb3b53e690b725b21f25dc74eb3561f0dee.ts b/crates/swc_bundler/tests/.cache/deno/0977feb3b53e690b725b21f25dc74eb3561f0dee.ts deleted file mode 100644 index c6ada98f2a27..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0977feb3b53e690b725b21f25dc74eb3561f0dee.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/propEq.js - - -import _curry3 from './internal/_curry3.js'; -import prop from './prop.js'; -import equals from './equals.js'; - - -/** - * Returns `true` if the specified object property is equal, in - * [`R.equals`](#equals) terms, to the given value; `false` otherwise. - * You can test multiple properties with [`R.whereEq`](#whereEq). - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Relation - * @sig String -> a -> Object -> Boolean - * @param {String} name - * @param {*} val - * @param {*} obj - * @return {Boolean} - * @see R.whereEq, R.propSatisfies, R.equals - * @example - * - * const abby = {name: 'Abby', age: 7, hair: 'blond'}; - * const fred = {name: 'Fred', age: 12, hair: 'brown'}; - * const rusty = {name: 'Rusty', age: 10, hair: 'brown'}; - * const alois = {name: 'Alois', age: 15, disposition: 'surly'}; - * const kids = [abby, fred, rusty, alois]; - * const hasBrownHair = R.propEq('hair', 'brown'); - * R.filter(hasBrownHair, kids); //=> [fred, rusty] - */ -var propEq = _curry3(function propEq(name, val, obj) { - return equals(val, prop(name, obj)); -}); -export default propEq; diff --git a/crates/swc_bundler/tests/.cache/deno/098bc7f3867b2ef1ccaad83722f64cf34603e925.ts b/crates/swc_bundler/tests/.cache/deno/098bc7f3867b2ef1ccaad83722f64cf34603e925.ts deleted file mode 100644 index 6fdfb08e0011..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/098bc7f3867b2ef1ccaad83722f64cf34603e925.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/type_is@1.0.1/deps.ts - - -export { lookup } from "https://deno.land/x/media_types/mod.ts"; -export { parse } from "https://deno.land/x/content_type/mod.ts"; -export { test } from "https://deno.land/x/media_typer/mod.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/09d3538bdb461399415f8f68af9da00dd02f839f.ts b/crates/swc_bundler/tests/.cache/deno/09d3538bdb461399415f8f68af9da00dd02f839f.ts deleted file mode 100644 index fed8953b04d3..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/09d3538bdb461399415f8f68af9da00dd02f839f.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_xdrop.js - - -import _curry2 from './_curry2.js'; -import _xfBase from './_xfBase.js'; - - -function XDrop(n, xf) { - this.xf = xf; - this.n = n; -} -XDrop.prototype['@@transducer/init'] = _xfBase.init; -XDrop.prototype['@@transducer/result'] = _xfBase.result; -XDrop.prototype['@@transducer/step'] = function(result, input) { - if (this.n > 0) { - this.n -= 1; - return result; - } - return this.xf['@@transducer/step'](result, input); -}; - -var _xdrop = _curry2(function _xdrop(n, xf) { return new XDrop(n, xf); }); -export default _xdrop; diff --git a/crates/swc_bundler/tests/.cache/deno/09ffbce4c7ea94b418f62b043ae9efa219f6a467.ts b/crates/swc_bundler/tests/.cache/deno/09ffbce4c7ea94b418f62b043ae9efa219f6a467.ts deleted file mode 100644 index 6d12a7374906..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/09ffbce4c7ea94b418f62b043ae9efa219f6a467.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/rest/process_rate_limited_paths.ts - - -import { eventHandlers } from "../bot.ts"; -import { rest } from "./rest.ts"; - -/** This will create a infinite loop running in 1 seconds using tail recursion to keep rate limits clean. When a rate limit resets, this will remove it so the queue can proceed. */ -export function processRateLimitedPaths() { - const now = Date.now(); - - for (const [key, value] of rest.ratelimitedPaths.entries()) { - rest.eventHandlers.debug?.("loop", `Running forEach loop in process_rate_limited_paths file.`); - // IF THE TIME HAS NOT REACHED CANCEL - if (value.resetTimestamp > now) continue; - - // RATE LIMIT IS OVER, DELETE THE RATE LIMITER - rest.ratelimitedPaths.delete(key); - // IF IT WAS GLOBAL ALSO MARK THE GLOBAL VALUE AS FALSE - if (key === "global") rest.globallyRateLimited = false; - } - - // ALL PATHS ARE CLEARED CAN CANCEL OUT! - if (!rest.ratelimitedPaths.size) { - rest.processingRateLimitedPaths = false; - return; - } else { - rest.processingRateLimitedPaths = true; - // RECHECK IN 1 SECOND - setTimeout(() => { - eventHandlers.debug?.("loop", `Running setTimeout in processRateLimitedPaths function.`); - processRateLimitedPaths(); - }, 1000); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0a4173dba5b3054c0ecd1ca376e13a5c81b682a5.ts b/crates/swc_bundler/tests/.cache/deno/0a4173dba5b3054c0ecd1ca376e13a5c81b682a5.ts deleted file mode 100644 index c7b1bf04e5ae..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0a4173dba5b3054c0ecd1ca376e13a5c81b682a5.ts +++ /dev/null @@ -1,1237 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/zlib/zlib/trees.ts - - -//const Z_FILTERED = 1; -//const Z_HUFFMAN_ONLY = 2; -//const Z_RLE = 3; -const Z_FIXED = 4; -//const Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -const Z_BINARY = 0; -const Z_TEXT = 1; -//const Z_ASCII = 1; // = Z_TEXT -const Z_UNKNOWN = 2; - -function zero(buf: any) { - buf.fill(0, 0, buf.length); -} - -// From zutil.h - -const STORED_BLOCK = 0; -const STATIC_TREES = 1; -const DYN_TREES = 2; -/* The three kinds of block type */ - -const MIN_MATCH = 3; -const MAX_MATCH = 258; -/* The minimum and maximum match lengths */ - -// From deflate.h -/* =========================================================================== - * Internal compression state. - */ - -const LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ - -const LITERALS = 256; -/* number of literal bytes 0..255 */ - -const L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ - -const D_CODES = 30; -/* number of distance codes */ - -const BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ - -const HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ - -const MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -const Buf_size = 16; -/* size of bit buffer in bi_buf */ - -/* =========================================================================== - * Constants - */ - -const MAX_BL_BITS = 7; -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -const END_BLOCK = 256; -/* end of block literal code */ - -const REP_3_6 = 16; -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -const REPZ_3_10 = 17; -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -const REPZ_11_138 = 18; -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -/* eslint-disable comma-spacing,array-bracket-spacing */ -const extra_lbits = /* extra bits for each length code */ - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 2, - 2, - 2, - 3, - 3, - 3, - 3, - 4, - 4, - 4, - 4, - 5, - 5, - 5, - 5, - 0, - ]; - -const extra_dbits = /* extra bits for each distance code */ - [ - 0, - 0, - 0, - 0, - 1, - 1, - 2, - 2, - 3, - 3, - 4, - 4, - 5, - 5, - 6, - 6, - 7, - 7, - 8, - 8, - 9, - 9, - 10, - 10, - 11, - 11, - 12, - 12, - 13, - 13, - ]; - -const extra_blbits = /* extra bits for each bit length code */ - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]; - -const bl_order = [ - 16, - 17, - 18, - 0, - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, -]; -/* eslint-enable comma-spacing,array-bracket-spacing */ - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -// We pre-fill arrays with 0 to avoid uninitialized gaps - -const DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - -// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 -const static_ltree = new Array((L_CODES + 2) * 2); -zero(static_ltree); -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -const static_dtree = new Array(D_CODES * 2); -zero(static_dtree); -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -const _dist_code = new Array(DIST_CODE_LEN); -zero(_dist_code); -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -const _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); -zero(_length_code); -/* length code for each normalized match length (0 == MIN_MATCH) */ - -const base_length = new Array(LENGTH_CODES); -zero(base_length); -/* First normalized length for each code (0 = MIN_MATCH) */ - -const base_dist = new Array(D_CODES); -zero(base_dist); -/* First normalized distance for each code (0 = distance of 1) */ - -class StaticTreeDesc { - static_tree: any; /* static tree or NULL */ - extra_bits: any; /* extra bits for each code or NULL */ - extra_base: any; /* base index for extra_bits */ - elems: any; /* max number of elements in the tree */ - max_length: any; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - has_stree: any; - - constructor( - static_tree: any, - extra_bits: any, - extra_base: any, - elems: any, - max_length: any, - ) { - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; - } -} - -let static_l_desc: any; -let static_d_desc: any; -let static_bl_desc: any; - -class TreeDesc { - dyn_tree: any; /* the dynamic tree */ - max_code: any; /* largest code with non zero frequency */ - stat_desc: any; /* the corresponding static tree */ - - constructor(dyn_tree: any, stat_desc: any) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ - } -} - -function d_code(dist: any) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -} - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -function put_short(s: any, w: any) { - // put_byte(s, (uch)((w) & 0xff)); - // put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -function send_bits(s: any, value: any, length: any) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } -} - -function send_code(s: any, c: any, tree: any) { - send_bits(s, tree[c * 2], /*.Code*/ tree[c * 2 + 1] /*.Len*/); -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -function bi_reverse(code: any, len: any) { - let res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -function bi_flush(s: any) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -function gen_bitlen(s: any, desc: any) { - let tree = desc.dyn_tree; - let max_code = desc.max_code; - let stree = desc.stat_desc.static_tree; - let has_stree = desc.stat_desc.has_stree; - let extra = desc.stat_desc.extra_bits; - let base = desc.stat_desc.extra_base; - let max_length = desc.stat_desc.max_length; - let h; /* heap index */ - let n, m; /* iterate over the tree elements */ - let bits; /* bit length */ - let xbits; /* extra bits */ - let f; /* frequency */ - let overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1] /*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1] /*.Dad*/ * 2 + 1] /*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1] /*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2] /*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1] /*.Len*/ + xbits); - } - } - if (overflow === 0) return; - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) bits--; - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) continue; - if (tree[m * 2 + 1] /*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1] /*.Len*/) * tree[m * 2] /*.Freq*/; - tree[m * 2 + 1] /*.Len*/ = bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -function gen_codes(tree: any, max_code: any, bl_count: any) { - let next_code = new Array( - MAX_BITS + 1, - ); /* next code value for each bit length */ - let code = 0; /* running code value */ - let bits; /* bit index */ - let n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1] /*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1] /*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1] /*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1] /*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1] /*.Len*/ = 5; - static_dtree[n * 2] /*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc( - static_ltree, - extra_lbits, - LITERALS + 1, - L_CODES, - MAX_BITS, - ); - static_d_desc = new StaticTreeDesc( - static_dtree, - extra_dbits, - 0, - D_CODES, - MAX_BITS, - ); - static_bl_desc = new StaticTreeDesc( - new Array(0), - extra_blbits, - 0, - BL_CODES, - MAX_BL_BITS, - ); - - //static_init_done = true; -} - -/* =========================================================================== - * Initialize a new block. - */ -function init_block(s: any) { - let n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s.dyn_ltree[n * 2] /*.Freq*/ = 0; - for (n = 0; n < D_CODES; n++) s.dyn_dtree[n * 2] /*.Freq*/ = 0; - for (n = 0; n < BL_CODES; n++) s.bl_tree[n * 2] /*.Freq*/ = 0; - - s.dyn_ltree[END_BLOCK * 2] /*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -function bi_windup(s: any) { - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -function copy_block(s: any, buf: any, len: any, header: any) { - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } - // while (len--) { - // put_byte(s, *buf++); - // } - s.pending_buf.set(s.window.subarray(buf, buf + len), s.pending); - s.pending += len; -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -function smaller(tree: any, n: any, m: any, depth: any) { - let _n2 = n * 2; - let _m2 = m * 2; - return (tree[_n2] /*.Freq*/ < tree[_m2] /*.Freq*/ || - (tree[_n2] /*.Freq*/ === tree[_m2] /*.Freq*/ && depth[n] <= depth[m])); -} - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -function pqdownheap(s: any, tree: any, k: any) // deflate_state *s; -// ct_data *tree; /* the tree to restore */ -// int k; /* node to move down */ -{ - let v = s.heap[k]; - let j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if ( - j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth) - ) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) break; - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; -} - -// inlined manually -// let SMALLEST = 1; - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -function compress_block(s: any, ltree: any, dtree: any) { - let dist; /* distance of matched string */ - let lc; /* match length or unmatched char (if dist == 0) */ - let lx = 0; /* running index in l_buf */ - let code; /* the code to send */ - let extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | - (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); -} - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -function build_tree(s: any, desc: any) { - let tree = desc.dyn_tree; - let stree = desc.stat_desc.static_tree; - let has_stree = desc.stat_desc.has_stree; - let elems = desc.stat_desc.elems; - let n, m; /* iterate over heap elements */ - let max_code = -1; /* largest code with non zero frequency */ - let node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2] /*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - } else { - tree[n * 2 + 1] /*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2] /*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1] /*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1 /*int /2*/); n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/ - ]; - s.heap[1/*SMALLEST*/ - ] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1 /*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/ - ]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2] /*.Freq*/ = tree[n * 2] /*.Freq*/ + tree[m * 2] /*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1] /*.Dad*/ = tree[m * 2 + 1] /*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/ - ] = node++; - pqdownheap(s, tree, 1 /*SMALLEST*/); - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/ - ]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -function scan_tree(s: any, tree: any, max_code: any) { - let n; /* iterates over all tree elements */ - let prevlen = -1; /* last emitted length */ - let curlen; /* length of current code */ - - let nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */ - - let count = 0; /* repeat count of the current code */ - let max_count = 7; /* max repeat count */ - let min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1] /*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1] /*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - s.bl_tree[curlen * 2] /*.Freq*/ += count; - } else if (curlen !== 0) { - if (curlen !== prevlen) s.bl_tree[curlen * 2] /*.Freq*/++; - s.bl_tree[REP_3_6 * 2] /*.Freq*/++; - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2] /*.Freq*/++; - } else { - s.bl_tree[REPZ_11_138 * 2] /*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -function send_tree(s: any, tree: any, max_code: any) { - let n; /* iterates over all tree elements */ - let prevlen = -1; /* last emitted length */ - let curlen; /* length of current code */ - - let nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */ - - let count = 0; /* repeat count of the current code */ - let max_count = 7; /* max repeat count */ - let min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ - /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1] /*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - do { - send_code(s, curlen, s.bl_tree); - } while (--count !== 0); - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -function build_bl_tree(s: any) { - let max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1] /*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -function send_all_trees(s: any, lcodes: any, dcodes: any, blcodes: any) { - let rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1], /*.Len*/ 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -function detect_data_type(s: any) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - let black_mask = 0xf3ffc07f; - let n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2] /*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if ( - s.dyn_ltree[9 * 2] /*.Freq*/ !== 0 || - s.dyn_ltree[10 * 2] /*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2] /*.Freq*/ !== 0 - ) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2] /*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - -let static_init_done = false; - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -export function _tr_init(s: any) { - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Send a stored block - */ -export function _tr_stored_block(s: any, buf: any, stored_len: any, last: any) //DeflateState *s; -//charf *buf; /* input block */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -export function _tr_align(s: any) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -export function _tr_flush_block(s: any, buf: any, stored_len: any, last: any) { - let opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - let max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees( - s, - s.l_desc.max_code + 1, - s.d_desc.max_code + 1, - max_blindex + 1, - ); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -export function _tr_tally(s: any, dist: any, lc: any) { - //let out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2] /*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2] /*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2] /*.Freq*/++; - } - - // (!) This block is disabled in zlib defaults, - // don't enable it for binary compatibility - - //#ifdef TRUNCATE_BLOCK - // /* Try to guess if it is profitable to stop the current block here */ - // if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { - // /* Compute an upper bound for the compressed length */ - // out_length = s.last_lit*8; - // in_length = s.strstart - s.block_start; - // - // for (dcode = 0; dcode < D_CODES; dcode++) { - // out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); - // } - // out_length >>>= 3; - // //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - // // s->last_lit, in_length, out_length, - // // 100L - out_length*100L/in_length)); - // if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { - // return true; - // } - // } - //#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} diff --git a/crates/swc_bundler/tests/.cache/deno/0a4e19efb83fa2243776941917a596463ec6aa51.ts b/crates/swc_bundler/tests/.cache/deno/0a4e19efb83fa2243776941917a596463ec6aa51.ts deleted file mode 100644 index dd274171c5ae..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0a4e19efb83fa2243776941917a596463ec6aa51.ts +++ /dev/null @@ -1,385 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/flags/flags.ts - - -import { getOption, paramCaseToCamelCase } from "./_utils.ts"; -import { - ArgumentFollowsVariadicArgument, - DuplicateOptionName, - InvalidOptionValue, - MissingOptionValue, - RequiredArgumentFollowsOptionalArgument, - UnknownConflictingOption, - UnknownOption, - UnknownRequiredOption, - UnknownType, -} from "./_errors.ts"; -import { normalize } from "./normalize.ts"; -import type { - IFlagArgument, - IFlagOptions, - IFlagsResult, - IParseOptions, - ITypeHandler, -} from "./types.ts"; -import { OptionType } from "./types.ts"; -import { boolean } from "./types/boolean.ts"; -import { number } from "./types/number.ts"; -import { string } from "./types/string.ts"; -import { validateFlags } from "./validate_flags.ts"; - -const Types: Record> = { - [OptionType.STRING]: string, - [OptionType.NUMBER]: number, - [OptionType.BOOLEAN]: boolean, -}; - -/** - * Parse command line arguments. - * @param args Command line arguments e.g: `Deno.args` - * @param opts Parse options. - * ``` - * // example.ts -x 3 -y.z -n5 -abc --beep=boop foo bar baz --deno.land -- --cliffy - * parseFlags(Deno.args); - * ``` - * ``` - * { - * flags: { - * x: "3", - * y: { z: true }, - * n: "5", - * a: true, - * b: true, - * c: true, - * beep: "boop", - * deno: { land: true } - * }, - * unknown: [ "foo", "bar", "baz" ], - * literal: [ "--cliffy" ] - * } - * ``` - */ -// deno-lint-ignore no-explicit-any -export function parseFlags = Record>( - args: string[], - opts: IParseOptions = {}, -): IFlagsResult { - !opts.flags && (opts.flags = []); - - const normalized = normalize(args); - - let inLiteral = false; - let negate = false; - - const flags: Record = {}; - const optionNames: Record = {}; - const literal: string[] = []; - const unknown: string[] = []; - let stopEarly = false; - - opts.flags.forEach((opt) => { - opt.depends?.forEach((flag) => { - if (!opts.flags || !getOption(opts.flags, flag)) { - throw new UnknownRequiredOption(flag, opts.flags ?? []); - } - }); - opt.conflicts?.forEach((flag) => { - if (!opts.flags || !getOption(opts.flags, flag)) { - throw new UnknownConflictingOption(flag, opts.flags ?? []); - } - }); - }); - - for (let i = 0; i < normalized.length; i++) { - let option: IFlagOptions | undefined; - let args: IFlagArgument[] | undefined; - const current = normalized[i]; - - // literal args after -- - if (inLiteral) { - literal.push(current); - continue; - } - - if (current === "--") { - inLiteral = true; - continue; - } - - const isFlag = current.length > 1 && current[0] === "-"; - const next = () => normalized[i + 1]; - - if (isFlag && !stopEarly) { - if (current[2] === "-" || (current[1] === "-" && current.length === 3)) { - throw new UnknownOption(current, opts.flags); - } - - negate = current.startsWith("--no-"); - - option = getOption(opts.flags, current); - // if (option && negate) { - // const positiveName: string = current.replace(/^-+(no-)?/, ""); - // option = getOption(opts.flags, positiveName) ?? option; - // } - - if (!option) { - if (opts.flags.length) { - throw new UnknownOption(current, opts.flags); - } - - option = { - name: current.replace(/^-+/, ""), - optionalValue: true, - type: OptionType.STRING, - }; - } - - const positiveName: string = option.name.replace(/^no-?/, ""); - const propName: string = paramCaseToCamelCase(positiveName); - - if (typeof flags[propName] !== "undefined" && !option.collect) { - throw new DuplicateOptionName(current); - } - - args = option.args?.length ? option.args : [{ - type: option.type, - requiredValue: option.requiredValue, - optionalValue: option.optionalValue, - variadic: option.variadic, - list: option.list, - separator: option.separator, - }]; - - let argIndex = 0; - let inOptionalArg = false; - const previous = flags[propName]; - - parseNext(option, args); - - if (typeof flags[propName] === "undefined") { - if (typeof option.default !== "undefined") { - flags[propName] = typeof option.default === "function" - ? option.default() - : option.default; - } else if (args[argIndex].requiredValue) { - throw new MissingOptionValue(option.name); - } else { - flags[propName] = true; - } - } - - if (typeof option.value !== "undefined") { - flags[propName] = option.value(flags[propName], previous); - } else if (option.collect) { - const value: unknown[] = Array.isArray(previous) ? previous : []; - value.push(flags[propName]); - flags[propName] = value; - } - - optionNames[propName] = option.name; - - opts.option?.(option, flags[propName]); - - /** Parse next argument for current option. */ - // deno-lint-ignore no-inner-declarations - function parseNext(option: IFlagOptions, args: IFlagArgument[]): void { - const arg: IFlagArgument = args[argIndex]; - - if (!arg) { - const flag = next(); - throw new UnknownOption(flag, opts.flags ?? []); - } - - if (!arg.type) { - arg.type = OptionType.BOOLEAN; - } - - if (option.args?.length) { - // make all value's required per default - if ( - (typeof arg.optionalValue === "undefined" || - arg.optionalValue === false) && - typeof arg.requiredValue === "undefined" - ) { - arg.requiredValue = true; - } - } else { - // make non boolean value required per default - if ( - arg.type !== OptionType.BOOLEAN && - (typeof arg.optionalValue === "undefined" || - arg.optionalValue === false) && - typeof arg.requiredValue === "undefined" - ) { - arg.requiredValue = true; - } - } - - if (arg.requiredValue) { - if (inOptionalArg) { - throw new RequiredArgumentFollowsOptionalArgument(option.name); - } - } else { - inOptionalArg = true; - } - - if (negate) { - flags[propName] = false; - return; - } - - let result: unknown; - let increase = false; - - if (arg.list && hasNext(arg)) { - const parsed: unknown[] = next() - .split(arg.separator || ",") - .map((nextValue: string) => { - const value = parseValue(option, arg, nextValue); - if (typeof value === "undefined") { - throw new InvalidOptionValue( - option.name, - arg.type ?? "?", - nextValue, - ); - } - return value; - }); - - if (parsed?.length) { - result = parsed; - } - } else { - if (hasNext(arg)) { - result = parseValue(option, arg, next()); - } else if (arg.optionalValue && arg.type === OptionType.BOOLEAN) { - result = true; - } - } - - if (increase) { - i++; - if (!arg.variadic) { - argIndex++; - } else if (args[argIndex + 1]) { - throw new ArgumentFollowsVariadicArgument(next()); - } - } - - if ( - typeof result !== "undefined" && ((args.length > 1) || arg.variadic) - ) { - if (!flags[propName]) { - flags[propName] = []; - } - - (flags[propName] as Array).push(result); - - if (hasNext(arg)) { - parseNext(option, args); - } - } else { - flags[propName] = result; - } - - /** Check if current option should have an argument. */ - function hasNext(arg: IFlagArgument): boolean { - return !!( - normalized[i + 1] && - (arg.optionalValue || arg.requiredValue || arg.variadic) && - (normalized[i + 1][0] !== "-" || - (arg.type === OptionType.NUMBER && - !isNaN(Number(normalized[i + 1])))) && - arg - ); - } - - /** Parse argument value. */ - function parseValue( - option: IFlagOptions, - arg: IFlagArgument, - value: string, - ): unknown { - const type: string = arg.type || OptionType.STRING; - const result: unknown = opts.parse - ? opts.parse({ - label: "Option", - type, - name: `--${option.name}`, - value, - }) - : parseFlagValue(option, arg, value); - - if (typeof result !== "undefined") { - increase = true; - } - - return result; - } - } - } else { - if (opts.stopEarly) { - stopEarly = true; - } - unknown.push(current); - } - } - - if (opts.flags && opts.flags.length) { - validateFlags( - opts.flags, - flags, - opts.knownFlaks, - opts.allowEmpty, - optionNames, - ); - } - - // convert dotted option keys into nested objects - const result = Object.keys(flags) - .reduce((result: Record, key: string) => { - if (~key.indexOf(".")) { - key.split(".").reduce( - ( - // deno-lint-ignore no-explicit-any - result: Record, - subKey: string, - index: number, - parts: string[], - ) => { - if (index === parts.length - 1) { - result[subKey] = flags[key]; - } else { - result[subKey] = result[subKey] ?? {}; - } - return result[subKey]; - }, - result, - ); - } else { - result[key] = flags[key]; - } - return result; - }, {}); - - return { flags: result as O, unknown, literal }; -} - -function parseFlagValue( - option: IFlagOptions, - arg: IFlagArgument, - value: string, -): unknown { - const type: string = arg.type || OptionType.STRING; - const parseType = Types[type]; - - if (!parseType) { - throw new UnknownType(type, Object.keys(Types)); - } - - return parseType({ - label: "Option", - type, - name: `--${option.name}`, - value, - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0a59d5ac534c81d425e489007f14f71ea6ccbe45.ts b/crates/swc_bundler/tests/.cache/deno/0a59d5ac534c81d425e489007f14f71ea6ccbe45.ts deleted file mode 100644 index 8b7d2c22ff18..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0a59d5ac534c81d425e489007f14f71ea6ccbe45.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Loaded from https://deno.land/std@0.101.0/path/mod.ts - - -// Copyright the Browserify authors. MIT License. -// Ported mostly from https://github.com/browserify/path-browserify/ -// This module is browser compatible. - -import { isWindows } from "../_util/os.ts"; -import * as _win32 from "./win32.ts"; -import * as _posix from "./posix.ts"; - -const path = isWindows ? _win32 : _posix; - -export const win32 = _win32; -export const posix = _posix; -export const { - basename, - delimiter, - dirname, - extname, - format, - fromFileUrl, - isAbsolute, - join, - normalize, - parse, - relative, - resolve, - sep, - toFileUrl, - toNamespacedPath, -} = path; - -export * from "./common.ts"; -export { SEP, SEP_PATTERN } from "./separator.ts"; -export * from "./_interface.ts"; -export * from "./glob.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/0a853a87f6be3cb7b6a6facd3f40ac37ff096b55.ts b/crates/swc_bundler/tests/.cache/deno/0a853a87f6be3cb7b6a6facd3f40ac37ff096b55.ts deleted file mode 100644 index 15d70e93586f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0a853a87f6be3cb7b6a6facd3f40ac37ff096b55.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/path/_constants.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. - -// Alphabet chars. -export const CHAR_UPPERCASE_A = 65; /* A */ -export const CHAR_LOWERCASE_A = 97; /* a */ -export const CHAR_UPPERCASE_Z = 90; /* Z */ -export const CHAR_LOWERCASE_Z = 122; /* z */ - -// Non-alphabetic chars. -export const CHAR_DOT = 46; /* . */ -export const CHAR_FORWARD_SLASH = 47; /* / */ -export const CHAR_BACKWARD_SLASH = 92; /* \ */ -export const CHAR_VERTICAL_LINE = 124; /* | */ -export const CHAR_COLON = 58; /* : */ -export const CHAR_QUESTION_MARK = 63; /* ? */ -export const CHAR_UNDERSCORE = 95; /* _ */ -export const CHAR_LINE_FEED = 10; /* \n */ -export const CHAR_CARRIAGE_RETURN = 13; /* \r */ -export const CHAR_TAB = 9; /* \t */ -export const CHAR_FORM_FEED = 12; /* \f */ -export const CHAR_EXCLAMATION_MARK = 33; /* ! */ -export const CHAR_HASH = 35; /* # */ -export const CHAR_SPACE = 32; /* */ -export const CHAR_NO_BREAK_SPACE = 160; /* \u00A0 */ -export const CHAR_ZERO_WIDTH_NOBREAK_SPACE = 65279; /* \uFEFF */ -export const CHAR_LEFT_SQUARE_BRACKET = 91; /* [ */ -export const CHAR_RIGHT_SQUARE_BRACKET = 93; /* ] */ -export const CHAR_LEFT_ANGLE_BRACKET = 60; /* < */ -export const CHAR_RIGHT_ANGLE_BRACKET = 62; /* > */ -export const CHAR_LEFT_CURLY_BRACKET = 123; /* { */ -export const CHAR_RIGHT_CURLY_BRACKET = 125; /* } */ -export const CHAR_HYPHEN_MINUS = 45; /* - */ -export const CHAR_PLUS = 43; /* + */ -export const CHAR_DOUBLE_QUOTE = 34; /* " */ -export const CHAR_SINGLE_QUOTE = 39; /* ' */ -export const CHAR_PERCENT = 37; /* % */ -export const CHAR_SEMICOLON = 59; /* ; */ -export const CHAR_CIRCUMFLEX_ACCENT = 94; /* ^ */ -export const CHAR_GRAVE_ACCENT = 96; /* ` */ -export const CHAR_AT = 64; /* @ */ -export const CHAR_AMPERSAND = 38; /* & */ -export const CHAR_EQUAL = 61; /* = */ - -// Digits -export const CHAR_0 = 48; /* 0 */ -export const CHAR_9 = 57; /* 9 */ diff --git a/crates/swc_bundler/tests/.cache/deno/0a96f91ab9a6d6c195b5722e00c81d4bc5feb7e6.ts b/crates/swc_bundler/tests/.cache/deno/0a96f91ab9a6d6c195b5722e00c81d4bc5feb7e6.ts deleted file mode 100644 index 8b12d7b83793..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0a96f91ab9a6d6c195b5722e00c81d4bc5feb7e6.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/interactions/commands/get_slash_command_permissions.ts - - -import { applicationId } from "../../../bot.ts"; -import { rest } from "../../../rest/rest.ts"; -import type { GuildApplicationCommandPermissions } from "../../../types/interactions/commands/guild_application_command_permissions.ts"; -import { endpoints } from "../../../util/constants.ts"; - -/** Fetches command permissions for all commands for your application in a guild. Returns an array of GuildApplicationCommandPermissions objects. */ -export async function getSlashCommandPermissions(guildId: bigint) { - return await rest.runMethod( - "get", - endpoints.COMMANDS_PERMISSIONS(applicationId, guildId) - ); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0ab31312a4d3ecab9cdf41f345e7e69882da7d3f.ts b/crates/swc_bundler/tests/.cache/deno/0ab31312a4d3ecab9cdf41f345e7e69882da7d3f.ts deleted file mode 100644 index 9895187cb1ca..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0ab31312a4d3ecab9cdf41f345e7e69882da7d3f.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Loaded from https://deno.land/x/case@v2.1.0/constantCase.ts - - -import upperCase from "./upperCase.ts"; -import snakeCase from "./snakeCase.ts"; - -export default function constantCase(value: string, locale?: string): string { - return upperCase(snakeCase(value, locale), locale); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0afa3c9e6688d294fdfb23eefa94f6c131088a6e.ts b/crates/swc_bundler/tests/.cache/deno/0afa3c9e6688d294fdfb23eefa94f6c131088a6e.ts deleted file mode 100644 index 0d59b3c0dd43..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0afa3c9e6688d294fdfb23eefa94f6c131088a6e.ts +++ /dev/null @@ -1,57 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isMimeType.ts - - -/* - Checks if the provided string matches to a correct Media type format (MIME type) - - This function only checks is the string format follows the - etablished rules by the according RFC specifications. - This function supports 'charset' in textual media types - (https://tools.ietf.org/html/rfc6657). - - This function does not check against all the media types listed - by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml) - because of lightness purposes : it would require to include - all these MIME types in this librairy, which would weigh it - significantly. This kind of effort maybe is not worth for the use that - this function has in this entire librairy. - - More informations in the RFC specifications : - - https://tools.ietf.org/html/rfc2045 - - https://tools.ietf.org/html/rfc2046 - - https://tools.ietf.org/html/rfc7231#section-3.1.1.1 - - https://tools.ietf.org/html/rfc7231#section-3.1.1.5 -*/ - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -// Match simple MIME types -// NB : -// Subtype length must not exceed 100 characters. -// This rule does not comply to the RFC specs (what is the max length ?). -/** - * @ignore - */ -const mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len - -// Handle "charset" in "text/*" -/** - * @ignore - */ -const mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len - -// Handle "boundary" in "multipart/*" -/** - * @ignore - */ -const mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len - -export const isMimeType = (str: string) => { - assertString(str); - return ( - mimeTypeSimple.test(str) || - mimeTypeText.test(str) || - mimeTypeMultipart.test(str) - ); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/0b086b224cfb53ca597f563a04870b8111f3b27d.ts b/crates/swc_bundler/tests/.cache/deno/0b086b224cfb53ca597f563a04870b8111f3b27d.ts deleted file mode 100644 index 1a5d4cfc62f8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0b086b224cfb53ca597f563a04870b8111f3b27d.ts +++ /dev/null @@ -1,168 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/command/completions/_fish_completions_generator.ts - - -import type { Command } from "../command.ts"; -import type { IOption } from "../types.ts"; - -/** Generates fish completions script. */ -interface CompleteOptions { - description?: string; - shortOption?: string; - longOption?: string; - required?: boolean; - standalone?: boolean; - arguments?: string; -} - -/** Fish completions generator. */ -export class FishCompletionsGenerator { - /** Generates fish completions script for given command. */ - public static generate(cmd: Command) { - return new FishCompletionsGenerator(cmd).generate(); - } - - private constructor(protected cmd: Command) {} - - /** Generates fish completions script. */ - private generate(): string { - const path = this.cmd.getPath(); - const version: string | undefined = this.cmd.getVersion() - ? ` v${this.cmd.getVersion()}` - : ""; - - return `#!/usr/bin/env fish -# fish completion support for ${path}${version} - -function __fish_${replaceSpecialChars(this.cmd.getName())}_using_command - set cmds ${getCommandFnNames(this.cmd).join(" ")} - set words (commandline -opc) - set cmd "_" - for word in $words - switch $word - case '-*' - continue - case '*' - set word (string replace -r -a '\\W' '_' $word) - set cmd_tmp $cmd"_$word" - if contains $cmd_tmp $cmds - set cmd $cmd_tmp - end - end - end - if [ "$cmd" = "$argv[1]" ] - return 0 - end - return 1 -end - -${this.generateCompletions(this.cmd).trim()} -`; - } - - private generateCompletions(command: Command): string { - const parent: Command | undefined = command.getParent(); - let result = ``; - - if (parent) { - // command - result += "\n" + this.complete(parent, { - description: command.getShortDescription(), - arguments: command.getName(), - }); - } - - // arguments - const commandArgs = command.getArguments(); - if (commandArgs.length) { - result += "\n" + this.complete(command, { - arguments: commandArgs.length - ? this.getCompletionCommand( - commandArgs[0].action + " " + getCompletionsPath(command), - ) - : undefined, - }); - } - - // options - for (const option of command.getOptions(false)) { - result += "\n" + this.completeOption(command, option); - } - - for (const subCommand of command.getCommands(false)) { - result += this.generateCompletions(subCommand); - } - - return result; - } - - private completeOption(command: Command, option: IOption) { - const shortOption: string | undefined = option.flags - .find((flag) => flag.length === 2) - ?.replace(/^(-)+/, ""); - const longOption: string | undefined = option.flags - .find((flag) => flag.length > 2) - ?.replace(/^(-)+/, ""); - - return this.complete(command, { - description: option.description, - shortOption: shortOption, - longOption: longOption, - // required: option.requiredValue, - required: true, - standalone: option.standalone, - arguments: option.args.length - ? this.getCompletionCommand( - option.args[0].action + " " + getCompletionsPath(command), - ) - : undefined, - }); - } - - private complete(command: Command, options: CompleteOptions) { - const cmd = ["complete"]; - cmd.push("-c", this.cmd.getName()); - cmd.push( - "-n", - `'__fish_${replaceSpecialChars(this.cmd.getName())}_using_command __${ - replaceSpecialChars(command.getPath()) - }'`, - ); - options.shortOption && cmd.push("-s", options.shortOption); - options.longOption && cmd.push("-l", options.longOption); - options.standalone && cmd.push("-x"); - cmd.push("-k"); - cmd.push("-f"); - if (options.arguments) { - options.required && cmd.push("-r"); - cmd.push("-a", options.arguments); - } - options.description && cmd.push("-d", `'${options.description}'`); - return cmd.join(" "); - } - - private getCompletionCommand(cmd: string): string { - return `'(${this.cmd.getName()} completions complete ${cmd.trim()})'`; - } -} - -function getCommandFnNames( - cmd: Command, - cmds: Array = [], -): Array { - cmds.push(`__${replaceSpecialChars(cmd.getPath())}`); - cmd.getCommands(false).forEach((command) => { - getCommandFnNames(command, cmds); - }); - return cmds; -} - -function getCompletionsPath(command: Command): string { - return command.getPath() - .split(" ") - .slice(1) - .join(" "); -} - -function replaceSpecialChars(str: string): string { - return str.replace(/[^a-zA-Z0-9]/g, "_"); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0b0bcf31fcc627ab2d8c38be6aaf7d0f7a9fefa3.ts b/crates/swc_bundler/tests/.cache/deno/0b0bcf31fcc627ab2d8c38be6aaf7d0f7a9fefa3.ts deleted file mode 100644 index 9c663cbe8888..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0b0bcf31fcc627ab2d8c38be6aaf7d0f7a9fefa3.ts +++ /dev/null @@ -1,1003 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/path/win32.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -/** This module is browser compatible. */ -import type { FormatInputPathObject, ParsedPath } from "./_interface.ts"; -import { - CHAR_BACKWARD_SLASH, - CHAR_COLON, - CHAR_DOT, - CHAR_QUESTION_MARK, -} from "./_constants.ts"; - -import { - _format, - assertPath, - isPathSeparator, - isWindowsDeviceRoot, - normalizeString, -} from "./_util.ts"; -import { assert } from "../_util/assert.ts"; - -export const sep = "\\"; -export const delimiter = ";"; - -/** - * Resolves path segments into a `path` - * @param pathSegments to process to path - */ -export function resolve(...pathSegments: string[]): string { - let resolvedDevice = ""; - let resolvedTail = ""; - let resolvedAbsolute = false; - - for (let i = pathSegments.length - 1; i >= -1; i--) { - let path: string; - if (i >= 0) { - path = pathSegments[i]; - } else if (!resolvedDevice) { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a drive-letter-less path without a CWD."); - } - path = Deno.cwd(); - } else { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a relative path without a CWD."); - } - // Windows has the concept of drive-specific current working - // directories. If we've resolved a drive letter but not yet an - // absolute path, get cwd for that drive, or the process cwd if - // the drive cwd is not available. We're sure the device is not - // a UNC path at this points, because UNC paths are always absolute. - path = Deno.env.get(`=${resolvedDevice}`) || Deno.cwd(); - - // Verify that a cwd was found and that it actually points - // to our drive. If not, default to the drive's root. - if ( - path === undefined || - path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\` - ) { - path = `${resolvedDevice}\\`; - } - } - - assertPath(path); - - const len = path.length; - - // Skip empty entries - if (len === 0) continue; - - let rootEnd = 0; - let device = ""; - let isAbsolute = false; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - // If we started with a separator, we know we at least have an - // absolute path of some kind (UNC or otherwise) - isAbsolute = true; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - device = `\\\\${firstPart}\\${path.slice(last)}`; - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator - rootEnd = 1; - isAbsolute = true; - } - - if ( - device.length > 0 && - resolvedDevice.length > 0 && - device.toLowerCase() !== resolvedDevice.toLowerCase() - ) { - // This path points to another device so it is not applicable - continue; - } - - if (resolvedDevice.length === 0 && device.length > 0) { - resolvedDevice = device; - } - if (!resolvedAbsolute) { - resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`; - resolvedAbsolute = isAbsolute; - } - - if (resolvedAbsolute && resolvedDevice.length > 0) break; - } - - // At this point the path should be resolved to a full absolute path, - // but handle relative paths to be safe (might happen when process.cwd() - // fails) - - // Normalize the tail path - resolvedTail = normalizeString( - resolvedTail, - !resolvedAbsolute, - "\\", - isPathSeparator, - ); - - return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || "."; -} - -/** - * Normalizes a `path` - * @param path to normalize - */ -export function normalize(path: string): string { - assertPath(path); - const len = path.length; - if (len === 0) return "."; - let rootEnd = 0; - let device: string | undefined; - let isAbsolute = false; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - // If we started with a separator, we know we at least have an absolute - // path of some kind (UNC or otherwise) - isAbsolute = true; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - // Return the normalized version of the UNC root since there - // is nothing left to process - - return `\\\\${firstPart}\\${path.slice(last)}\\`; - } else if (j !== last) { - // We matched a UNC root with leftovers - - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid unnecessary - // work - return "\\"; - } - - let tail: string; - if (rootEnd < len) { - tail = normalizeString( - path.slice(rootEnd), - !isAbsolute, - "\\", - isPathSeparator, - ); - } else { - tail = ""; - } - if (tail.length === 0 && !isAbsolute) tail = "."; - if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) { - tail += "\\"; - } - if (device === undefined) { - if (isAbsolute) { - if (tail.length > 0) return `\\${tail}`; - else return "\\"; - } else if (tail.length > 0) { - return tail; - } else { - return ""; - } - } else if (isAbsolute) { - if (tail.length > 0) return `${device}\\${tail}`; - else return `${device}\\`; - } else if (tail.length > 0) { - return device + tail; - } else { - return device; - } -} - -/** - * Verifies whether path is absolute - * @param path to verify - */ -export function isAbsolute(path: string): boolean { - assertPath(path); - const len = path.length; - if (len === 0) return false; - - const code = path.charCodeAt(0); - if (isPathSeparator(code)) { - return true; - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (len > 2 && path.charCodeAt(1) === CHAR_COLON) { - if (isPathSeparator(path.charCodeAt(2))) return true; - } - } - return false; -} - -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * @param paths to be joined and normalized - */ -export function join(...paths: string[]): string { - const pathsCount = paths.length; - if (pathsCount === 0) return "."; - - let joined: string | undefined; - let firstPart: string | null = null; - for (let i = 0; i < pathsCount; ++i) { - const path = paths[i]; - assertPath(path); - if (path.length > 0) { - if (joined === undefined) joined = firstPart = path; - else joined += `\\${path}`; - } - } - - if (joined === undefined) return "."; - - // Make sure that the joined path doesn't start with two slashes, because - // normalize() will mistake it for an UNC path then. - // - // This step is skipped when it is very clear that the user actually - // intended to point at an UNC path. This is assumed when the first - // non-empty string arguments starts with exactly two slashes followed by - // at least one more non-slash character. - // - // Note that for normalize() to treat a path as an UNC path it needs to - // have at least 2 components, so we don't filter for that here. - // This means that the user can use join to construct UNC paths from - // a server name and a share name; for example: - // path.join('//server', 'share') -> '\\\\server\\share\\') - let needsReplace = true; - let slashCount = 0; - assert(firstPart != null); - if (isPathSeparator(firstPart.charCodeAt(0))) { - ++slashCount; - const firstLen = firstPart.length; - if (firstLen > 1) { - if (isPathSeparator(firstPart.charCodeAt(1))) { - ++slashCount; - if (firstLen > 2) { - if (isPathSeparator(firstPart.charCodeAt(2))) ++slashCount; - else { - // We matched a UNC path in the first part - needsReplace = false; - } - } - } - } - } - if (needsReplace) { - // Find any more consecutive slashes we need to replace - for (; slashCount < joined.length; ++slashCount) { - if (!isPathSeparator(joined.charCodeAt(slashCount))) break; - } - - // Replace the slashes if needed - if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`; - } - - return normalize(joined); -} - -/** - * It will solve the relative path from `from` to `to`, for instance: - * from = 'C:\\orandea\\test\\aaa' - * to = 'C:\\orandea\\impl\\bbb' - * The output of the function should be: '..\\..\\impl\\bbb' - * @param from relative path - * @param to relative path - */ -export function relative(from: string, to: string): string { - assertPath(from); - assertPath(to); - - if (from === to) return ""; - - const fromOrig = resolve(from); - const toOrig = resolve(to); - - if (fromOrig === toOrig) return ""; - - from = fromOrig.toLowerCase(); - to = toOrig.toLowerCase(); - - if (from === to) return ""; - - // Trim any leading backslashes - let fromStart = 0; - let fromEnd = from.length; - for (; fromStart < fromEnd; ++fromStart) { - if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for (; fromEnd - 1 > fromStart; --fromEnd) { - if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const fromLen = fromEnd - fromStart; - - // Trim any leading backslashes - let toStart = 0; - let toEnd = to.length; - for (; toStart < toEnd; ++toStart) { - if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for (; toEnd - 1 > toStart; --toEnd) { - if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const toLen = toEnd - toStart; - - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for (; i <= length; ++i) { - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `from` is the exact base path for `to`. - // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz' - return toOrig.slice(toStart + i + 1); - } else if (i === 2) { - // We get here if `from` is the device root. - // For example: from='C:\\'; to='C:\\foo' - return toOrig.slice(toStart + i); - } - } - if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `to` is the exact base path for `from`. - // For example: from='C:\\foo\\bar'; to='C:\\foo' - lastCommonSep = i; - } else if (i === 2) { - // We get here if `to` is the device root. - // For example: from='C:\\foo\\bar'; to='C:\\' - lastCommonSep = 3; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (fromCode === CHAR_BACKWARD_SLASH) lastCommonSep = i; - } - - // We found a mismatch before the first common path separator was seen, so - // return the original `to`. - if (i !== length && lastCommonSep === -1) { - return toOrig; - } - - let out = ""; - if (lastCommonSep === -1) lastCommonSep = 0; - // Generate the relative path based on the path difference between `to` and - // `from` - for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { - if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) { - if (out.length === 0) out += ".."; - else out += "\\.."; - } - } - - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) { - return out + toOrig.slice(toStart + lastCommonSep, toEnd); - } else { - toStart += lastCommonSep; - if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart; - return toOrig.slice(toStart, toEnd); - } -} - -/** - * Resolves path to a namespace path - * @param path to resolve to namespace - */ -export function toNamespacedPath(path: string): string { - // Note: this will *probably* throw somewhere. - if (typeof path !== "string") return path; - if (path.length === 0) return ""; - - const resolvedPath = resolve(path); - - if (resolvedPath.length >= 3) { - if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) { - // Possible UNC root - - if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) { - const code = resolvedPath.charCodeAt(2); - if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { - // Matched non-long UNC root, convert the path to a long UNC path - return `\\\\?\\UNC\\${resolvedPath.slice(2)}`; - } - } - } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) { - // Possible device root - - if ( - resolvedPath.charCodeAt(1) === CHAR_COLON && - resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH - ) { - // Matched device root, convert the path to a long UNC path - return `\\\\?\\${resolvedPath}`; - } - } - } - - return path; -} - -/** - * Return the directory name of a `path`. - * @param path to determine name for - */ -export function dirname(path: string): string { - assertPath(path); - const len = path.length; - if (len === 0) return "."; - let rootEnd = -1; - let end = -1; - let matchedSlash = true; - let offset = 0; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - rootEnd = offset = 1; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - return path; - } - if (j !== last) { - // We matched a UNC root with leftovers - - // Offset by 1 to include the separator after the UNC root to - // treat it as a "normal root" on top of a (UNC) root - rootEnd = offset = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = offset = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) rootEnd = offset = 3; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - return path; - } - - for (let i = len - 1; i >= offset; --i) { - if (isPathSeparator(path.charCodeAt(i))) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) { - if (rootEnd === -1) return "."; - else end = rootEnd; - } - return path.slice(0, end); -} - -/** - * Return the last portion of a `path`. Trailing directory separators are ignored. - * @param path to process - * @param ext of path directory - */ -export function basename(path: string, ext = ""): string { - if (ext !== undefined && typeof ext !== "string") { - throw new TypeError('"ext" argument must be a string'); - } - - assertPath(path); - - let start = 0; - let end = -1; - let matchedSlash = true; - let i: number; - - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - if (path.length >= 2) { - const drive = path.charCodeAt(0); - if (isWindowsDeviceRoot(drive)) { - if (path.charCodeAt(1) === CHAR_COLON) start = 2; - } - } - - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { - if (ext.length === path.length && ext === path) return ""; - let extIdx = ext.length - 1; - let firstNonSlashEnd = -1; - for (i = path.length - 1; i >= start; --i) { - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else { - if (firstNonSlashEnd === -1) { - // We saw the first non-path separator, remember this index in case - // we need it if the extension ends up not matching - matchedSlash = false; - firstNonSlashEnd = i + 1; - } - if (extIdx >= 0) { - // Try to match the explicit extension - if (code === ext.charCodeAt(extIdx)) { - if (--extIdx === -1) { - // We matched the extension, so mark this as the end of our path - // component - end = i; - } - } else { - // Extension does not match, so our result is the entire path - // component - extIdx = -1; - end = firstNonSlashEnd; - } - } - } - } - - if (start === end) end = firstNonSlashEnd; - else if (end === -1) end = path.length; - return path.slice(start, end); - } else { - for (i = path.length - 1; i >= start; --i) { - if (isPathSeparator(path.charCodeAt(i))) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ""; - return path.slice(start, end); - } -} - -/** - * Return the extension of the `path`. - * @param path with extension - */ -export function extname(path: string): string { - assertPath(path); - let start = 0; - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - - if ( - path.length >= 2 && - path.charCodeAt(1) === CHAR_COLON && - isWindowsDeviceRoot(path.charCodeAt(0)) - ) { - start = startPart = 2; - } - - for (let i = path.length - 1; i >= start; --i) { - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - return ""; - } - return path.slice(startDot, end); -} - -/** - * Generate a path from `FormatInputPathObject` object. - * @param pathObject with path - */ -export function format(pathObject: FormatInputPathObject): string { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError( - `The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`, - ); - } - return _format("\\", pathObject); -} - -/** - * Return a `ParsedPath` object of the `path`. - * @param path to process - */ -export function parse(path: string): ParsedPath { - assertPath(path); - - const ret: ParsedPath = { root: "", dir: "", base: "", ext: "", name: "" }; - - const len = path.length; - if (len === 0) return ret; - - let rootEnd = 0; - let code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - rootEnd = 1; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - - rootEnd = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - if (len === 3) { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - rootEnd = 3; - } - } else { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - - if (rootEnd > 0) ret.root = path.slice(0, rootEnd); - - let startDot = -1; - let startPart = rootEnd; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Get non-dir info - for (; i >= rootEnd; --i) { - code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - if (end !== -1) { - ret.base = ret.name = path.slice(startPart, end); - } - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - ret.ext = path.slice(startDot, end); - } - - // If the directory is the root, use the entire root as the `dir` including - // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the - // trailing slash (`C:\abc\def` -> `C:\abc`). - if (startPart > 0 && startPart !== rootEnd) { - ret.dir = path.slice(0, startPart - 1); - } else ret.dir = ret.root; - - return ret; -} - -/** - * Converts a file URL to a path string. - * - * fromFileUrl("file:///home/foo"); // "\\home\\foo" - * fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo" - * fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo" - * @param url of a file URL - */ -export function fromFileUrl(url: string | URL): string { - url = url instanceof URL ? url : new URL(url); - if (url.protocol != "file:") { - throw new TypeError("Must be a file URL."); - } - let path = decodeURIComponent( - url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25"), - ).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); - if (url.hostname != "") { - // Note: The `URL` implementation guarantees that the drive letter and - // hostname are mutually exclusive. Otherwise it would not have been valid - // to append the hostname and path like this. - path = `\\\\${url.hostname}${path}`; - } - return path; -} - -/** - * Converts a path string to a file URL. - * - * toFileUrl("\\home\\foo"); // new URL("file:///home/foo") - * toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo") - * toFileUrl("\\\\localhost\\home\\foo"); // new URL("file://localhost/home/foo") - * @param path to convert to file URL - */ -export function toFileUrl(path: string): URL { - if (!isAbsolute(path)) { - throw new TypeError("Must be an absolute path."); - } - const [, hostname, pathname] = path.match( - /^(?:[/\\]{2}([^/\\]+)(?=[/\\][^/\\]))?(.*)/, - )!; - const url = new URL("file:///"); - url.pathname = pathname.replace(/%/g, "%25"); - if (hostname != null) { - url.hostname = hostname; - if (!url.hostname) { - throw new TypeError("Invalid hostname."); - } - } - return url; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0b342060ff1856cd94ca234727849c893a6e0ee4.ts b/crates/swc_bundler/tests/.cache/deno/0b342060ff1856cd94ca234727849c893a6e0ee4.ts deleted file mode 100644 index b7ed287756ae..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0b342060ff1856cd94ca234727849c893a6e0ee4.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Loaded from https://deno.land/std@0.78.0/encoding/_yaml/stringify.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { dump } from "./dumper/dumper.ts"; -import type { DumperStateOptions } from "./dumper/dumper_state.ts"; - -export type DumpOptions = DumperStateOptions; - -/** - * Serializes `object` as a YAML document. - * - * You can disable exceptions by setting the skipInvalid option to true. - */ -export function stringify( - obj: Record, - options?: DumpOptions, -): string { - return dump(obj, options); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0b44fd40571b3b06a493c9a07b00afe7a7377189.ts b/crates/swc_bundler/tests/.cache/deno/0b44fd40571b3b06a493c9a07b00afe7a7377189.ts deleted file mode 100644 index 5a540d6f5e4f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0b44fd40571b3b06a493c9a07b00afe7a7377189.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/messages/message_activity.ts - - -import { DiscordMessageActivityTypes } from "./message_activity_types.ts"; - -/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */ -export interface MessageActivity { - /** Type of message activity */ - type: DiscordMessageActivityTypes; - /** `party_id` from a Rich Presence event */ - partyId?: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0b61675219dbd7c7ea5f54023af19dcf6ac666b9.ts b/crates/swc_bundler/tests/.cache/deno/0b61675219dbd7c7ea5f54023af19dcf6ac666b9.ts deleted file mode 100644 index c46c5df1b997..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0b61675219dbd7c7ea5f54023af19dcf6ac666b9.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/std@0.99.0/path/separator.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -import { isWindows } from "../_util/os.ts"; - -export const SEP = isWindows ? "\\" : "/"; -export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/; diff --git a/crates/swc_bundler/tests/.cache/deno/0b639d8abb7284720ea3d1299bff254ef5b9345f.ts b/crates/swc_bundler/tests/.cache/deno/0b639d8abb7284720ea3d1299bff254ef5b9345f.ts deleted file mode 100644 index ce5126b6d85a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0b639d8abb7284720ea3d1299bff254ef5b9345f.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/members/GUILD_MEMBER_REMOVE.ts - - -import { eventHandlers } from "../../bot.ts"; -import { cacheHandlers } from "../../cache.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { GuildMemberRemove } from "../../types/members/guild_member_remove.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; - -export async function handleGuildMemberRemove(data: DiscordGatewayPayload) { - const payload = data.d as GuildMemberRemove; - const guild = await cacheHandlers.get("guilds", snowflakeToBigint(payload.guildId)); - if (!guild) return; - - guild.memberCount--; - const member = await cacheHandlers.get("members", snowflakeToBigint(payload.user.id)); - eventHandlers.guildMemberRemove?.(guild, payload.user, member); - - member?.guilds.delete(guild.id); - if (member && !member.guilds.size) { - await cacheHandlers.delete("members", member.id); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0b9548184c4b86f602c627692a27bebb67f87ffd.ts b/crates/swc_bundler/tests/.cache/deno/0b9548184c4b86f602c627692a27bebb67f87ffd.ts deleted file mode 100644 index d8f654d58963..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0b9548184c4b86f602c627692a27bebb67f87ffd.ts +++ /dev/null @@ -1,342 +0,0 @@ -// Loaded from https://deno.land/std@0.101.0/testing/_diff.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -interface FarthestPoint { - y: number; - id: number; -} - -export enum DiffType { - removed = "removed", - common = "common", - added = "added", -} - -export interface DiffResult { - type: DiffType; - value: T; - details?: Array>; -} - -const REMOVED = 1; -const COMMON = 2; -const ADDED = 3; - -function createCommon(A: T[], B: T[], reverse?: boolean): T[] { - const common = []; - if (A.length === 0 || B.length === 0) return []; - for (let i = 0; i < Math.min(A.length, B.length); i += 1) { - if ( - A[reverse ? A.length - i - 1 : i] === B[reverse ? B.length - i - 1 : i] - ) { - common.push(A[reverse ? A.length - i - 1 : i]); - } else { - return common; - } - } - return common; -} - -/** - * Renders the differences between the actual and expected values - * @param A Actual value - * @param B Expected value - */ -export function diff(A: T[], B: T[]): Array> { - const prefixCommon = createCommon(A, B); - const suffixCommon = createCommon( - A.slice(prefixCommon.length), - B.slice(prefixCommon.length), - true, - ).reverse(); - A = suffixCommon.length - ? A.slice(prefixCommon.length, -suffixCommon.length) - : A.slice(prefixCommon.length); - B = suffixCommon.length - ? B.slice(prefixCommon.length, -suffixCommon.length) - : B.slice(prefixCommon.length); - const swapped = B.length > A.length; - [A, B] = swapped ? [B, A] : [A, B]; - const M = A.length; - const N = B.length; - if (!M && !N && !suffixCommon.length && !prefixCommon.length) return []; - if (!N) { - return [ - ...prefixCommon.map( - (c): DiffResult => ({ type: DiffType.common, value: c }), - ), - ...A.map( - (a): DiffResult => ({ - type: swapped ? DiffType.added : DiffType.removed, - value: a, - }), - ), - ...suffixCommon.map( - (c): DiffResult => ({ type: DiffType.common, value: c }), - ), - ]; - } - const offset = N; - const delta = M - N; - const size = M + N + 1; - const fp = new Array(size).fill({ y: -1 }); - /** - * INFO: - * This buffer is used to save memory and improve performance. - * The first half is used to save route and last half is used to save diff - * type. - * This is because, when I kept new uint8array area to save type,performance - * worsened. - */ - const routes = new Uint32Array((M * N + size + 1) * 2); - const diffTypesPtrOffset = routes.length / 2; - let ptr = 0; - let p = -1; - - function backTrace( - A: T[], - B: T[], - current: FarthestPoint, - swapped: boolean, - ): Array<{ - type: DiffType; - value: T; - }> { - const M = A.length; - const N = B.length; - const result = []; - let a = M - 1; - let b = N - 1; - let j = routes[current.id]; - let type = routes[current.id + diffTypesPtrOffset]; - while (true) { - if (!j && !type) break; - const prev = j; - if (type === REMOVED) { - result.unshift({ - type: swapped ? DiffType.removed : DiffType.added, - value: B[b], - }); - b -= 1; - } else if (type === ADDED) { - result.unshift({ - type: swapped ? DiffType.added : DiffType.removed, - value: A[a], - }); - a -= 1; - } else { - result.unshift({ type: DiffType.common, value: A[a] }); - a -= 1; - b -= 1; - } - j = routes[prev]; - type = routes[prev + diffTypesPtrOffset]; - } - return result; - } - - function createFP( - slide: FarthestPoint, - down: FarthestPoint, - k: number, - M: number, - ): FarthestPoint { - if (slide && slide.y === -1 && down && down.y === -1) { - return { y: 0, id: 0 }; - } - if ( - (down && down.y === -1) || - k === M || - (slide && slide.y) > (down && down.y) + 1 - ) { - const prev = slide.id; - ptr++; - routes[ptr] = prev; - routes[ptr + diffTypesPtrOffset] = ADDED; - return { y: slide.y, id: ptr }; - } else { - const prev = down.id; - ptr++; - routes[ptr] = prev; - routes[ptr + diffTypesPtrOffset] = REMOVED; - return { y: down.y + 1, id: ptr }; - } - } - - function snake( - k: number, - slide: FarthestPoint, - down: FarthestPoint, - _offset: number, - A: T[], - B: T[], - ): FarthestPoint { - const M = A.length; - const N = B.length; - if (k < -N || M < k) return { y: -1, id: -1 }; - const fp = createFP(slide, down, k, M); - while (fp.y + k < M && fp.y < N && A[fp.y + k] === B[fp.y]) { - const prev = fp.id; - ptr++; - fp.id = ptr; - fp.y += 1; - routes[ptr] = prev; - routes[ptr + diffTypesPtrOffset] = COMMON; - } - return fp; - } - - while (fp[delta + offset].y < N) { - p = p + 1; - for (let k = -p; k < delta; ++k) { - fp[k + offset] = snake( - k, - fp[k - 1 + offset], - fp[k + 1 + offset], - offset, - A, - B, - ); - } - for (let k = delta + p; k > delta; --k) { - fp[k + offset] = snake( - k, - fp[k - 1 + offset], - fp[k + 1 + offset], - offset, - A, - B, - ); - } - fp[delta + offset] = snake( - delta, - fp[delta - 1 + offset], - fp[delta + 1 + offset], - offset, - A, - B, - ); - } - return [ - ...prefixCommon.map( - (c): DiffResult => ({ type: DiffType.common, value: c }), - ), - ...backTrace(A, B, fp[delta + offset], swapped), - ...suffixCommon.map( - (c): DiffResult => ({ type: DiffType.common, value: c }), - ), - ]; -} - -/** - * Renders the differences between the actual and expected strings - * Partially inspired from https://github.com/kpdecker/jsdiff - * @param A Actual string - * @param B Expected string - */ -export function diffstr(A: string, B: string) { - function tokenize(string: string, { wordDiff = false } = {}): string[] { - if (wordDiff) { - // Split string on whitespace symbols - const tokens = string.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); - // Extended Latin character set - const words = - /^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u; - - // Join boundary splits that we do not consider to be boundaries and merge empty strings surrounded by word chars - for (let i = 0; i < tokens.length - 1; i++) { - if ( - !tokens[i + 1] && tokens[i + 2] && words.test(tokens[i]) && - words.test(tokens[i + 2]) - ) { - tokens[i] += tokens[i + 2]; - tokens.splice(i + 1, 2); - i--; - } - } - return tokens.filter((token) => token); - } else { - // Split string on new lines symbols - const tokens = [], lines = string.split(/(\n|\r\n)/); - - // Ignore final empty token when text ends with a newline - if (!lines[lines.length - 1]) { - lines.pop(); - } - - // Merge the content and line separators into single tokens - for (let i = 0; i < lines.length; i++) { - if (i % 2) { - tokens[tokens.length - 1] += lines[i]; - } else { - tokens.push(lines[i]); - } - } - return tokens; - } - } - - // Create details by filtering revelant word-diff for current line - // and merge "space-diff" if surrounded by word-diff for cleaner displays - function createDetails( - line: DiffResult, - tokens: Array>, - ) { - return tokens.filter(({ type }) => - type === line.type || type === DiffType.common - ).map((result, i, t) => { - if ( - (result.type === DiffType.common) && (t[i - 1]) && - (t[i - 1]?.type === t[i + 1]?.type) - ) { - result.type = t[i - 1].type; - } - return result; - }); - } - - // Compute multi-line diff - const diffResult = diff(tokenize(`${A}\n`), tokenize(`${B}\n`)); - const added = [], removed = []; - for (const result of diffResult) { - if (result.type === DiffType.added) { - added.push(result); - } - if (result.type === DiffType.removed) { - removed.push(result); - } - } - - // Compute word-diff - const aLines = added.length < removed.length ? added : removed; - const bLines = aLines === removed ? added : removed; - for (const a of aLines) { - let tokens = [] as Array>, - b: undefined | DiffResult; - // Search another diff line with at least one common token - while (bLines.length) { - b = bLines.shift(); - tokens = diff( - tokenize(a.value, { wordDiff: true }), - tokenize(b?.value ?? "", { wordDiff: true }), - ); - if ( - tokens.some(({ type, value }) => - type === DiffType.common && value.trim().length - ) - ) { - break; - } - } - // Register word-diff details - a.details = createDetails(a, tokens); - if (b) { - b.details = createDetails(b, tokens); - } - } - - return diffResult; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0bc2073c627b10654f8712f63ac65d8c08962ce3.ts b/crates/swc_bundler/tests/.cache/deno/0bc2073c627b10654f8712f63ac65d8c08962ce3.ts deleted file mode 100644 index d5067568c117..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0bc2073c627b10654f8712f63ac65d8c08962ce3.ts +++ /dev/null @@ -1,143 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/graphql.js - - -import isPromise from './jsutils/isPromise.js'; -import { parse } from './language/parser.js'; -import { validate } from './validation/validate.js'; -import { validateSchema } from './type/validate.js'; -import { execute } from './execution/execute.js'; -/** - * This is the primary entry point function for fulfilling GraphQL operations - * by parsing, validating, and executing a GraphQL document along side a - * GraphQL schema. - * - * More sophisticated GraphQL servers, such as those which persist queries, - * may wish to separate the validation and execution phases to a static time - * tooling step, and a server runtime step. - * - * Accepts either an object with named arguments, or individual arguments: - * - * schema: - * The GraphQL type system to use when validating and executing a query. - * source: - * A GraphQL language formatted string representing the requested operation. - * rootValue: - * The value provided as the first argument to resolver functions on the top - * level type (e.g. the query object type). - * contextValue: - * The context value is provided as an argument to resolver functions after - * field arguments. It is used to pass shared information useful at any point - * during executing this query, for example the currently logged in user and - * connections to databases or other services. - * variableValues: - * A mapping of variable name to runtime value to use for all variables - * defined in the requestString. - * operationName: - * The name of the operation to use if requestString contains multiple - * possible operations. Can be omitted if requestString contains only - * one operation. - * fieldResolver: - * A resolver function to use when one is not provided by the schema. - * If not provided, the default field resolver is used (which looks for a - * value or method on the source value with the field's name). - * typeResolver: - * A type resolver function to use when none is provided by the schema. - * If not provided, the default type resolver is used (which looks for a - * `__typename` field or alternatively calls the `isTypeOf` method). - */ - -export function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - /* eslint-enable no-redeclare */ - // Always return a Promise for a consistent API. - return new Promise(resolve => resolve( // Extract arguments from object args if provided. - arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ - schema: argsOrSchema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver - }))); -} -/** - * The graphqlSync function also fulfills GraphQL operations by parsing, - * validating, and executing a GraphQL document along side a GraphQL schema. - * However, it guarantees to complete synchronously (or throw an error) assuming - * that all field resolvers are also synchronous. - */ - -export function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) { - /* eslint-enable no-redeclare */ - // Extract arguments from object args if provided. - const result = arguments.length === 1 ? graphqlImpl(argsOrSchema) : graphqlImpl({ - schema: argsOrSchema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver - }); // Assert that the execution was synchronous. - - if (isPromise(result)) { - throw new Error('GraphQL execution failed to complete synchronously.'); - } - - return result; -} - -function graphqlImpl(args) { - const { - schema, - source, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver - } = args; // Validate Schema - - const schemaValidationErrors = validateSchema(schema); - - if (schemaValidationErrors.length > 0) { - return { - errors: schemaValidationErrors - }; - } // Parse - - - let document; - - try { - document = parse(source); - } catch (syntaxError) { - return { - errors: [syntaxError] - }; - } // Validate - - - const validationErrors = validate(schema, document); - - if (validationErrors.length > 0) { - return { - errors: validationErrors - }; - } // Execute - - - return execute({ - schema, - document, - rootValue, - contextValue, - variableValues, - operationName, - fieldResolver, - typeResolver - }); -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/0c181b6d53e1f4ac21bbbeda6c540c2421e341b6.ts b/crates/swc_bundler/tests/.cache/deno/0c181b6d53e1f4ac21bbbeda6c540c2421e341b6.ts deleted file mode 100644 index 96bc791ab87b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0c181b6d53e1f4ac21bbbeda6c540c2421e341b6.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/x/tinyhttp@0.1.18/extensions/res/send/json.ts - - -import { Req, Res } from '../../../deps.ts' - -export const json = (req: Request, res: Response) => < - T = unknown ->( - body: T -): Response => { - res.headers?.set('Content-Type', 'application/json') - if (typeof body === 'object' && body != null) req.respond({ ...res, body: JSON.stringify(body, null, 2) }) - else if (typeof body === 'string') req.respond({ ...res, body }) - else if (body == null) { - res.headers.delete('Content-Length') - res.headers.delete('Transfer-Encoding') - req.respond(res) - } - - return res -} diff --git a/crates/swc_bundler/tests/.cache/deno/0c1db9c6ccb68158f83bcf73b40db2be98ecad42.ts b/crates/swc_bundler/tests/.cache/deno/0c1db9c6ccb68158f83bcf73b40db2be98ecad42.ts deleted file mode 100644 index 4bb8483e831f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0c1db9c6ccb68158f83bcf73b40db2be98ecad42.ts +++ /dev/null @@ -1,81 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/permissions/bitwise_permission_flags.ts - - -/** https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags */ -export enum DiscordBitwisePermissionFlags { - /** Allows creation of instant invites */ - CREATE_INSTANT_INVITE = 0x00000001, - /** Allows kicking members */ - KICK_MEMBERS = 0x00000002, - /** Allows banning members */ - BAN_MEMBERS = 0x00000004, - /** Allows all permissions and bypasses channel permission overwrites */ - ADMINISTRATOR = 0x00000008, - /** Allows management and editing of channels */ - MANAGE_CHANNELS = 0x00000010, - /** Allows management and editing of the guild */ - MANAGE_GUILD = 0x00000020, - /** Allows for the addition of reactions to messages */ - ADD_REACTIONS = 0x00000040, - /** Allows for viewing of audit logs */ - VIEW_AUDIT_LOG = 0x00000080, - /** Allows for using priority speaker in a voice channel */ - PRIORITY_SPEAKER = 0x00000100, - /** Allows the user to go live */ - STREAM = 0x00000200, - /** Allows guild members to view a channel, which includes reading messages in text channels */ - VIEW_CHANNEL = 0x00000400, - /** Allows for sending messages in a channel */ - SEND_MESSAGES = 0x00000800, - /** Allows for sending of /tts messages */ - SEND_TTS_MESSAGES = 0x00001000, - /** Allows for deletion of other users messages */ - MANAGE_MESSAGES = 0x00002000, - /** Links sent by users with this permission will be auto-embedded */ - EMBED_LINKS = 0x00004000, - /** Allows for uploading images and files */ - ATTACH_FILES = 0x00008000, - /** Allows for reading of message history */ - READ_MESSAGE_HISTORY = 0x00010000, - /** Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel */ - MENTION_EVERYONE = 0x00020000, - /** Allows the usage of custom emojis from other servers */ - USE_EXTERNAL_EMOJIS = 0x00040000, - /** Allows for viewing guild insights */ - VIEW_GUILD_INSIGHTS = 0x00080000, - /** Allows for joining of a voice channel */ - CONNECT = 0x00100000, - /** Allows for speaking in a voice channel */ - SPEAK = 0x00200000, - /** Allows for muting members in a voice channel */ - MUTE_MEMBERS = 0x00400000, - /** Allows for deafening of members in a voice channel */ - DEAFEN_MEMBERS = 0x00800000, - /** Allows for moving of members between voice channels */ - MOVE_MEMBERS = 0x01000000, - /** Allows for using voice-activity-detection in a voice channel */ - USE_VAD = 0x02000000, - /** Allows for modification of own nickname */ - CHANGE_NICKNAME = 0x04000000, - /** Allows for modification of other users nicknames */ - MANAGE_NICKNAMES = 0x08000000, - /** Allows management and editing of roles */ - MANAGE_ROLES = 0x10000000, - /** Allows management and editing of webhooks */ - MANAGE_WEBHOOKS = 0x20000000, - /** Allows management and editing of emojis */ - MANAGE_EMOJIS = 0x40000000, - /** Allows members to use slash commands in text channels */ - USE_SLASH_COMMANDS = 0x80000000, - /** Allows for requesting to speak in stage channels. */ - REQUEST_TO_SPEAK = 0x100000001, - /** Allows for deleting and archiving threads, and viewing all private threads */ - MANAGE_THREADS = 0x0400000000, - /** Allows for creating and participating in threads */ - USE_PUBLIC_THREADS = 0x0800000000, - /** Allows for creating and participating in private threads */ - USE_PRIVATE_THREADS = 0x1000000000, -} - -export type BitwisePermissions = DiscordBitwisePermissionFlags; -export const BitwisePermissions = DiscordBitwisePermissionFlags; diff --git a/crates/swc_bundler/tests/.cache/deno/0c2b38876aaa5edf2c8d409ae47a73efc0318651.ts b/crates/swc_bundler/tests/.cache/deno/0c2b38876aaa5edf2c8d409ae47a73efc0318651.ts deleted file mode 100644 index a41a331fd4be..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0c2b38876aaa5edf2c8d409ae47a73efc0318651.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/guilds/edit_widget.ts - - -import { rest } from "../../rest/rest.ts"; -import type { GuildWidget } from "../../types/guilds/guild_widget.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** Modify a guild widget object for the guild. Requires the MANAGE_GUILD permission. */ -export async function editWidget(guildId: bigint, enabled: boolean, channelId?: string | null) { - await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - - return await rest.runMethod("patch", endpoints.GUILD_WIDGET(guildId), { - enabled, - channel_id: channelId, - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0c370b0dde6a38f8d964c5a397f9161f3283201d.ts b/crates/swc_bundler/tests/.cache/deno/0c370b0dde6a38f8d964c5a397f9161f3283201d.ts deleted file mode 100644 index 024c75171b80..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0c370b0dde6a38f8d964c5a397f9161f3283201d.ts +++ /dev/null @@ -1,257 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/hash/_wasm/wasm.js - - -// deno-lint-ignore-file -//deno-fmt-ignore-file -//deno-lint-ignore-file -import * as base64 from "../../encoding/base64.ts";export const source = base64.decode("AGFzbQEAAAABSQxgAn9/AGACf38Bf2ADf39/AGADf39/AX9gAX8AYAF/AX9gAABgBH9/f38Bf2AFf39/f38AYAV/f39/fwF/YAJ+fwF/YAF/AX4CTQMDd2JnFV9fd2JpbmRnZW5fc3RyaW5nX25ldwABA3diZxBfX3diaW5kZ2VuX3Rocm93AAADd2JnEl9fd2JpbmRnZW5fcmV0aHJvdwAEA6sBqQEAAgEAAAIFAAACAAQABAADAAAAAQcJAAAAAAAAAAAAAAAAAAAAAAICAgIAAAAAAAAAAAAAAAAAAAACAgICBAAAAgAAAQAAAAAAAAAAAAAAAAAECgEEAQIAAAAAAgIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAQEAgICAAEGAAMEAgcEAgQEAwMFBAQAAwQDAQEBAQQABwYBBgYBAAELBQUFBQUFBQAEBAUBcAFpaQUDAQARBgkBfwFBgIDAAAsHoQEJBm1lbW9yeQIAE19fd2JnX2Rlbm9oYXNoX2ZyZWUAhAELY3JlYXRlX2hhc2gABQt1cGRhdGVfaGFzaACFAQtkaWdlc3RfaGFzaACCARFfX3diaW5kZ2VuX21hbGxvYwCNARJfX3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IAJBrARqQgA3AgAgAkG0BGpCADcCACACQbwEakIANwIAIAJBxARqQQA6AAAgAkHFBGpBADYAACACQckEakEAOwAAIAJBywRqQQA6AAAgAkHAADYCiAQgAkEAOwGMBCACQQA2AY4EIAJBmAFqIAJBiARqQcQAEIsBGiACQagDaiIEIAJB1AFqKQIANwMAIAJBoANqIgUgAkHMAWopAgA3AwAgAkGYA2oiCSACQcQBaikCADcDACACQZADaiIKIAJBvAFqKQIANwMAIAJBiANqIgYgAkG0AWopAgA3AwAgAkGAA2oiByACQawBaikCADcDACACQfgCaiIIIAJBpAFqKQIANwMAIAIgAikCnAE3A/ACQeAAQQgQoQEiA0UNGSADQQA2AgggA0IANwMAIAMgAikD8AI3AgwgA0EUaiAIKQMANwIAIANBHGogBykDADcCACADQSRqIAYpAwA3AgAgA0EsaiAKKQMANwIAIANBNGogCSkDADcCACADQTxqIAUpAwA3AgAgA0HEAGogBCkDADcCACADQdQAakHIl8AAKQIANwIAIANBwJfAACkCADcCTEHUgMAAIQRBAAwSCyAAQfiAwABGDQUgAEH4gMAAQQkQgwFFDQUgAEGogcAARg0GIABBqIHAAEEJEIMBRQ0GIABB4ITAAEYNDSAAQeCEwAAgARCDAUUNDSAAQZCFwABGDQ4gAEGQhcAAIAEQgwFFDQ4gAEHAhcAARg0PIABBwIXAACABEIMBRQ0PIABB8IXAAEcEQCAAQfCFwAAgARCDAQ0RCyACQZgBakEAQcgBEJEBGiACQf4CakIANwEAIAJBhgNqQgA3AQAgAkGOA2pCADcBACACQZYDakIANwEAIAJBngNqQgA3AQAgAkGmA2pCADcBACACQa4DakIANwEAIAJBtgNqQQA2AQAgAkG6A2pBADsBACACQQA7AfQCIAJCADcB9gIgAkHIADYC8AIgAkGIBGogAkHwAmpBzAAQiwEaIAJBCGogAkGIBGpBBHJByAAQiwEaQZgCQQgQoQEiA0UNHiADIAJBmAFqQcgBEIsBIgRBADYCyAEgBEHMAWogAkEIakHIABCLARpB/IXAACEEQQAMEQsgAEHYgcAARwRAIAAoAABB89CFiwNHDRALIAJBkgRqQgA3AQAgAkGaBGpBADsBACACQZwEakIANwIAIAJBpARqQgA3AgAgAkGsBGpCADcCACACQbQEakIANwIAIAJBvARqQgA3AgAgAkHEBGpBADoAACACQcUEakEANgAAIAJByQRqQQA7AAAgAkHLBGpBADoAACACQcAANgKIBCACQQA7AYwEIAJBADYBjgQgAkGYAWogAkGIBGpBxAAQiwEaIAJBqANqIgQgAkHUAWopAgA3AwAgAkGgA2oiBSACQcwBaikCADcDACACQZgDaiIJIAJBxAFqKQIANwMAIAJBkANqIgogAkG8AWopAgA3AwAgAkGIA2oiBiACQbQBaikCADcDACACQYADaiIHIAJBrAFqKQIANwMAIAJB+AJqIgggAkGkAWopAgA3AwAgAiACKQKcATcD8AJB4ABBCBChASIDRQ0XIANCADcDACADQQA2AhwgAyACKQPwAjcDICADQfiXwAApAwA3AwggA0EQakGAmMAAKQMANwMAIANBGGpBiJjAACgCADYCACADQShqIAgpAwA3AwAgA0EwaiAHKQMANwMAIANBOGogBikDADcDACADQUBrIAopAwA3AwAgA0HIAGogCSkDADcDACADQdAAaiAFKQMANwMAIANB2ABqIAQpAwA3AwBB3IHAACEEQQAMEAsgAEGAgsAARg0FIABBgILAAEEGEIMBRQ0FIABBrILAAEYNBiAAQayCwABBBhCDAUUNBiAAQdiCwABGDQcgAEHYgsAAQQYQgwFFDQcgAEGEg8AARwRAIABBhIPAAEEGEIMBDQ8LIAJBADYCiAQgAkGIBGpBBHIhBEEAIQMDQCADIARqQQA6AAAgAiACKAKIBEEBajYCiAQgA0EBaiIDQYABRw0ACyACQZgBaiACQYgEakGEARCLARogAkHwAmogAkGYAWpBBHJBgAEQiwEaQdgBQQgQoQEiA0UNGCADQgA3AwggA0IANwMAIANBADYCUCADQZCZwAApAwA3AxAgA0EYakGYmcAAKQMANwMAIANBIGpBoJnAACkDADcDACADQShqQaiZwAApAwA3AwAgA0EwakGwmcAAKQMANwMAIANBOGpBuJnAACkDADcDACADQUBrQcCZwAApAwA3AwAgA0HIAGpByJnAACkDADcDACADQdQAaiACQfACakGAARCLARpBjIPAACEEQQAMDwsgAEGwg8AARg0HIAApAABC89CFm9PFjJk0UQ0HIABB3IPAAEYNCCAAKQAAQvPQhZvTxcyaNlENCCAAQYiEwABGDQkgACkAAELz0IWb0+WMnDRRDQkgAEG0hMAARwRAIAApAABC89CFm9OlzZgyUg0OCyACQZgBakEAQcgBEJEBGiACQf4CakIANwEAIAJBhgNqQgA3AQAgAkGOA2pCADcBACACQZYDakIANwEAIAJBngNqQgA3AQAgAkGmA2pCADcBACACQa4DakIANwEAIAJBtgNqQQA2AQAgAkG6A2pBADsBACACQQA7AfQCIAJCADcB9gIgAkHIADYC8AIgAkGIBGogAkHwAmpBzAAQiwEaIAJBCGogAkGIBGpBBHJByAAQiwEaQZgCQQgQoQEiA0UNGyADIAJBmAFqQcgBEIsBIgRBADYCyAEgBEHMAWogAkEIakHIABCLARpBvITAACEEQQAMDgsgAkGSBGpCADcBACACQZoEakEAOwEAIAJBEDYCiAQgAkEAOwGMBCACQQA2AY4EIAJBqAFqIgMgAkGYBGoiBCgCADYCACACQaABaiIJIAJBkARqIgUpAwA3AwAgAkHoAmoiBiACQaQBaikCADcDACACIAIpA4gENwOYASACIAIpApwBNwPgAiACQcABaiIHQgA3AwAgAkG4AWoiCEIANwMAIAJBsAFqIg1CADcDACADQgA3AwAgCUIANwMAIAJCADcDmAEgAkH6AmpCADcBACACQYIDakEAOwEAIAJBEDYC8AIgAkEAOwH0AiACQQA2AfYCIAQgAkGAA2ooAgA2AgAgBSACQfgCaiIKKQMANwMAIAJBEGoiCyACQZQEaikCADcDACACIAIpA/ACNwOIBCACIAIpAowENwMIIAJB0AFqIgwgCykDADcDACACIAIpAwg3A8gBIAogBikDADcDACACIAIpA+ACNwPwAiACQcAEaiIGIAwpAwA3AwAgAkG4BGoiCyACKQPIATcDACACQbAEaiIMIAcpAwA3AwAgAkGoBGoiByAIKQMANwMAIAJBoARqIgggDSkDADcDACAEIAMpAwA3AwAgBSAJKQMANwMAIAIgAikDmAE3A4gEQdQAQQQQoQEiA0UNDiADQQA2AgAgAyACKQPwAjcCBCADIAIpA4gENwIUIANBDGogCikDADcCACADQRxqIAUpAwA3AgAgA0EkaiAEKQMANwIAIANBLGogCCkDADcCACADQTRqIAcpAwA3AgAgA0E8aiAMKQMANwIAIANBxABqIAspAwA3AgAgA0HMAGogBikDADcCAEGEgMAAIQRBAAwNCyACQZIEakIANwEAIAJBmgRqQQA7AQAgAkGcBGpCADcCACACQaQEakIANwIAIAJBrARqQgA3AgAgAkG0BGpCADcCACACQbwEakIANwIAIAJBxARqQQA6AAAgAkHFBGpBADYAACACQckEakEAOwAAIAJBywRqQQA6AAAgAkHAADYCiAQgAkEAOwGMBCACQQA2AY4EIAJBmAFqIAJBiARqQcQAEIsBGiACQagDaiIEIAJB1AFqKQIANwMAIAJBoANqIgUgAkHMAWopAgA3AwAgAkGYA2oiCSACQcQBaikCADcDACACQZADaiIKIAJBvAFqKQIANwMAIAJBiANqIgYgAkG0AWopAgA3AwAgAkGAA2oiByACQawBaikCADcDACACQfgCaiIIIAJBpAFqKQIANwMAIAIgAikCnAE3A/ACQeAAQQgQoQEiA0UNEyADQQA2AgggA0IANwMAIAMgAikD8AI3AgwgA0EUaiAIKQMANwIAIANBHGogBykDADcCACADQSRqIAYpAwA3AgAgA0EsaiAKKQMANwIAIANBNGogCSkDADcCACADQTxqIAUpAwA3AgAgA0HEAGogBCkDADcCACADQdQAakHIl8AAKQIANwIAIANBwJfAACkCADcCTEGsgMAAIQRBAAwMCyACQZIEakIANwEAIAJBmgRqQQA7AQAgAkGcBGpCADcCACACQaQEakIANwIAIAJBrARqQgA3AgAgAkG0BGpCADcCACACQbwEakIANwIAIAJBxARqQQA6AAAgAkHFBGpBADYAACACQckEakEAOwAAIAJBywRqQQA6AAAgAkHAADYCiAQgAkEAOwGMBCACQQA2AY4EIAJBmAFqIAJBiARqQcQAEIsBGiACQagDaiIEIAJB1AFqKQIANwMAIAJBoANqIgUgAkHMAWopAgA3AwAgAkGYA2oiCSACQcQBaikCADcDACACQZADaiIKIAJBvAFqKQIANwMAIAJBiANqIgYgAkG0AWopAgA3AwAgAkGAA2oiByACQawBaikCADcDACACQfgCaiIIIAJBpAFqKQIANwMAIAIgAikCnAE3A/ACQeAAQQgQoQEiA0UNEiADQgA3AwAgA0EANgIcIAMgAikD8AI3AyAgA0H4l8AAKQMANwMIIANBEGpBgJjAACkDADcDACADQRhqQYiYwAAoAgA2AgAgA0EoaiAIKQMANwMAIANBMGogBykDADcDACADQThqIAYpAwA3AwAgA0FAayAKKQMANwMAIANByABqIAkpAwA3AwAgA0HQAGogBSkDADcDACADQdgAaiAEKQMANwMAQYSBwAAhBEEADAsLIAJBkgRqQgA3AQAgAkGaBGpBADsBACACQZwEakIANwIAIAJBpARqQgA3AgAgAkGsBGpCADcCACACQbQEakIANwIAIAJBvARqQgA3AgAgAkHEBGpBADoAACACQcUEakEANgAAIAJByQRqQQA7AAAgAkHLBGpBADoAACACQcAANgKIBCACQQA7AYwEIAJBADYBjgQgAkGYAWogAkGIBGpBxAAQiwEaIAJBqANqIgQgAkHUAWopAgA3AwAgAkGgA2oiBSACQcwBaikCADcDACACQZgDaiIJIAJBxAFqKQIANwMAIAJBkANqIgogAkG8AWopAgA3AwAgAkGIA2oiBiACQbQBaikCADcDACACQYADaiIHIAJBrAFqKQIANwMAIAJB+AJqIgggAkGkAWopAgA3AwAgAiACKQKcATcD8AJB+ABBCBChASIDRQ0MIANCADcDACADQQA2AjAgAyACKQPwAjcCNCADQdCXwAApAwA3AwggA0EQakHYl8AAKQMANwMAIANBGGpB4JfAACkDADcDACADQSBqQeiXwAApAwA3AwAgA0EoakHwl8AAKQMANwMAIANBPGogCCkDADcCACADQcQAaiAHKQMANwIAIANBzABqIAYpAwA3AgAgA0HUAGogCikDADcCACADQdwAaiAJKQMANwIAIANB5ABqIAUpAwA3AgAgA0HsAGogBCkDADcCAEG0gcAAIQRBAAwKCyACQZIEakIANwEAIAJBmgRqQQA7AQAgAkGcBGpCADcCACACQaQEakIANwIAIAJBrARqQgA3AgAgAkG0BGpCADcCACACQbwEakIANwIAIAJBxARqQQA6AAAgAkHFBGpBADYAACACQckEakEAOwAAIAJBywRqQQA6AAAgAkHAADYCiAQgAkEAOwGMBCACQQA2AY4EIAJBmAFqIAJBiARqQcQAEIsBGiACQagDaiIEIAJB1AFqKQIANwMAIAJBoANqIgUgAkHMAWopAgA3AwAgAkGYA2oiCSACQcQBaikCADcDACACQZADaiIKIAJBvAFqKQIANwMAIAJBiANqIgYgAkG0AWopAgA3AwAgAkGAA2oiByACQawBaikCADcDACACQfgCaiIIIAJBpAFqKQIANwMAIAIgAikCnAE3A/ACQfAAQQgQoQEiA0UNESADQQA2AgggA0IANwMAIAMgAikD8AI3AgwgA0EUaiAIKQMANwIAIANBHGogBykDADcCACADQSRqIAYpAwA3AgAgA0EsaiAKKQMANwIAIANBNGogCSkDADcCACADQTxqIAUpAwA3AgAgA0HEAGogBCkDADcCACADQeQAakGkmMAAKQIANwIAIANB3ABqQZyYwAApAgA3AgAgA0HUAGpBlJjAACkCADcCACADQYyYwAApAgA3AkxBiILAACEEQQAMCQsgAkGSBGpCADcBACACQZoEakEAOwEAIAJBnARqQgA3AgAgAkGkBGpCADcCACACQawEakIANwIAIAJBtARqQgA3AgAgAkG8BGpCADcCACACQcQEakEAOgAAIAJBxQRqQQA2AAAgAkHJBGpBADsAACACQcsEakEAOgAAIAJBwAA2AogEIAJBADsBjAQgAkEANgGOBCACQZgBaiACQYgEakHEABCLARogAkGoA2oiBCACQdQBaikCADcDACACQaADaiIFIAJBzAFqKQIANwMAIAJBmANqIgkgAkHEAWopAgA3AwAgAkGQA2oiCiACQbwBaikCADcDACACQYgDaiIGIAJBtAFqKQIANwMAIAJBgANqIgcgAkGsAWopAgA3AwAgAkH4AmoiCCACQaQBaikCADcDACACIAIpApwBNwPwAkHwAEEIEKEBIgNFDRAgA0EANgIIIANCADcDACADIAIpA/ACNwIMIANBFGogCCkDADcCACADQRxqIAcpAwA3AgAgA0EkaiAGKQMANwIAIANBLGogCikDADcCACADQTRqIAkpAwA3AgAgA0E8aiAFKQMANwIAIANBxABqIAQpAwA3AgAgA0HkAGpBxJjAACkCADcCACADQdwAakG8mMAAKQIANwIAIANB1ABqQbSYwAApAgA3AgAgA0GsmMAAKQIANwJMQbSCwAAhBEEADAgLIAJBADYCiAQgAkGIBGpBBHIhBEEAIQMDQCADIARqQQA6AAAgAiACKAKIBEEBajYCiAQgA0EBaiIDQYABRw0ACyACQZgBaiACQYgEakGEARCLARogAkHwAmogAkGYAWpBBHJBgAEQiwEaQdgBQQgQoQEiA0UNECADQgA3AwggA0IANwMAIANBADYCUCADQdCYwAApAwA3AxAgA0EYakHYmMAAKQMANwMAIANBIGpB4JjAACkDADcDACADQShqQeiYwAApAwA3AwAgA0EwakHwmMAAKQMANwMAIANBOGpB+JjAACkDADcDACADQUBrQYCZwAApAwA3AwAgA0HIAGpBiJnAACkDADcDACADQdQAaiACQfACakGAARCLARpB4ILAACEEQQAMBwsgAkGYAWpBAEHIARCRARogAkEANgLwAkEEIQMDQCACQfACaiADakEAOgAAIAIgAigC8AJBAWo2AvACIANBAWoiA0GUAUcNAAsgAkGIBGogAkHwAmpBlAEQiwEaIAJBCGogAkGIBGpBBHJBkAEQiwEaQeACQQgQoQEiA0UNECADIAJBmAFqQcgBEIsBIgRBADYCyAEgBEHMAWogAkEIakGQARCLARpBuIPAACEEQQAMBgsgAkGYAWpBAEHIARCRARogAkEANgLwAkEEIQMDQCACQfACaiADakEAOgAAIAIgAigC8AJBAWo2AvACIANBAWoiA0GMAUcNAAsgAkGIBGogAkHwAmpBjAEQiwEaIAJBCGogAkGIBGpBBHJBiAEQiwEaQdgCQQgQoQEiA0UNECADIAJBmAFqQcgBEIsBIgRBADYCyAEgBEHMAWogAkEIakGIARCLARpB5IPAACEEQQAMBQsgAkGYAWpBAEHIARCRARogAkEANgLwAkEEIQMDQCACQfACa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AJCIPNgIkIAogASgAKCIKNgIAIAIgASgALCIQNgIsIAkgASgAMCIJNgIAIAIgASgANCIRNgI0IAggASgAOCIINgIAIAIgASgAPCISNgI8IAAgDSgCACINIAcgCSACKAIAIhMgDyARIAIoAgQiFCACKAIUIhUgESAPIBUgFCAJIAcgDSADIBMgCyAEIANBf3NxIAMgBXFyampB+Miqu31qQQd3aiIBaiAEIBRqIAUgAUF/c3EgASADcXJqQdbunsZ+akEMdyABaiIEIAMgAigCDCILaiABIAQgBSAMKAIAIgxqIAMgBEF/c3EgASAEcXJqQdvhgaECakERd2oiAkF/c3EgAiAEcXJqQe6d9418akEWdyACaiIBQX9zcSABIAJxcmpBr5/wq39qQQd3IAFqIgNqIAQgFWogAiADQX9zcSABIANxcmpBqoyfvARqQQx3IANqIgQgASAOaiADIAQgAiAGaiABIARBf3NxIAMgBHFyakGTjMHBempBEXdqIgFBf3NxIAEgBHFyakGBqppqakEWdyABaiICQX9zcSABIAJxcmpB2LGCzAZqQQd3IAJqIgNqIAQgD2ogASADQX9zcSACIANxcmpBr++T2nhqQQx3IANqIgQgAiAQaiADIAQgASAKaiACIARBf3NxIAMgBHFyakGxt31qQRF3aiIBQX9zcSABIARxcmpBvq/zynhqQRZ3IAFqIgJBf3NxIAEgAnFyakGiosDcBmpBB3cgAmoiA2ogAiASaiADIAEgCGogAiADIAQgEWogASADQX9zcSACIANxcmpBk+PhbGpBDHdqIgFBf3MiBHEgASADcXJqQY6H5bN6akERdyABaiICQX9zIgVxIAEgAnFyakGhkNDNBGpBFncgAmoiAyABcSACIARxcmpB4sr4sH9qQQV3IANqIgRqIAMgE2ogAiAQaiABIAZqIAIgBHEgAyAFcXJqQcDmgoJ8akEJdyAEaiIBIANxIAQgA0F/c3FyakHRtPmyAmpBDncgAWoiAiAEcSABIARBf3NxcmpBqo/bzX5qQRR3IAJqIgMgAXEgAiABQX9zcXJqQd2gvLF9akEFdyADaiIEaiADIA1qIAIgEmogASAKaiACIARxIAMgAkF/c3FyakHTqJASakEJdyAEaiIBIANxIAQgA0F/c3FyakGBzYfFfWpBDncgAWoiAiAEcSABIARBf3NxcmpByPfPvn5qQRR3IAJqIgMgAXEgAiABQX9zcXJqQeabh48CakEFdyADaiIEaiADIAdqIAIgC2ogASAIaiACIARxIAMgAkF/c3FyakHWj9yZfGpBCXcgBGoiASADcSAEIANBf3NxcmpBh5vUpn9qQQ53IAFqIgIgBHEgASAEQX9zcXJqQe2p6KoEakEUdyACaiIDIAFxIAIgAUF/c3FyakGF0o/PempBBXcgA2oiBGogAyAJaiACIA5qIAEgDGogAiAEcSADIAJBf3NxcmpB+Me+Z2pBCXcgBGoiASADcSAEIANBf3NxcmpB2YW8uwZqQQ53IAFqIgMgBHEgASAEQX9zcXJqQYqZqel4akEUdyADaiIEIANzIgUgAXNqQcLyaGpBBHcgBGoiAmogAyAQaiABIAdqIAIgBXNqQYHtx7t4akELdyACaiIBIAIgBHNzakGiwvXsBmpBEHcgAWoiAyABcyAEIAhqIAEgAnMgA3NqQYzwlG9qQRd3IANqIgJzakHE1PulempBBHcgAmoiBGogAyAOaiABIA1qIAIgA3MgBHNqQamf+94EakELdyAEaiIBIAIgBHNzakHglu21f2pBEHcgAWoiAyABcyACIApqIAEgBHMgA3NqQfD4/vV7akEXdyADaiICc2pBxv3txAJqQQR3IAJqIgRqIAMgC2ogASATaiACIANzIARzakH6z4TVfmpBC3cgBGoiASACIARzc2pBheG8p31qQRB3IAFqIgMgAXMgAiAGaiABIARzIANzakGFuqAkakEXdyADaiICc2pBuaDTzn1qQQR3IAJqIgRqIAIgDGogASAJaiACIANzIARzakHls+62fmpBC3cgBGoiASAEcyADIBJqIAIgBHMgAXNqQfj5if0BakEQdyABaiICc2pB5ayxpXxqQRd3IAJqIgMgAUF/c3IgAnNqQcTEpKF/akEGdyADaiIEaiADIBVqIAIgCGogASAOaiAEIAJBf3NyIANzakGX/6uZBGpBCncgBGoiASADQX9zciAEc2pBp8fQ3HpqQQ93IAFqIgIgBEF/c3IgAX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qLQAAcyIDOgAAIAJBAWoiAkEwRw0ACyADQQ5qIQNBACECA0AgACACaiIEIAQtAAAgA0H/AXFByJTAAGotAABzIgM6AAAgAkEBaiICQTBHDQALIANBD2ohA0EAIQIDQCAAIAJqIgQgBC0AACADQf8BcUHIlMAAai0AAHMiAzoAACACQQFqIgJBMEcNAAsgA0EQaiEDQQAhAgNAIAAgAmoiBCAELQAAIANB/wFxQciUwABqLQAAcyIDOgAAIAJBAWoiAkEwRw0ACyAAIAAtADAgAS0AACAAQT9qIgMtAABzQciUwABqLQAAcyICOgAwIABBMWoiBCAELQAAIAIgAS0AAXNByJTAAGotAABzIgI6AAAgAEEyaiIEIAQtAAAgAiABLQACc0HIlMAAai0AAHMiAjoAACAAQTNqIgQgBC0AACACIAEtAANzQciUwABqLQAAcyICOgAAIABBNGoiBCAELQAAIAIgAS0ABHNByJTAAGotAABzIgI6AAAgAEE1aiIEIAQtAAAgAiABLQAFc0HIlMAAai0AAHMiAjoAACAAQTZqIgQgBC0AACACIAEtAAZzQciUwABqLQAAcyICOgAAIABBN2oiBCAELQAAIAIgAS0AB3NByJTAAGotAABzIgI6AAAgAEE4aiIEIAQtAAAgAiABLQAIc0HIlMAAai0AAHMiAjoAACAAQTlqIgQgBC0AACACIAEtAAlzQciUwABqLQAAcyICOgAAIABBOmoiBCAELQAAIAIgAS0ACnNByJTAAGotAABzIgI6AAAgAEE7aiIEIAQtAAAgAiABLQALc0HIlMAAai0AAHMiAjoAACAAQTxqIgQgBC0AACACIAEtAAxzQciUwABqLQAAcyICOgAAIABBPWoiBCAELQAAIAIgAS0ADXNByJTAAGotAABzIgI6AAAgAEE+aiIAIAAtAAAgAiABLQAOc0HIlMAAai0AAHMiADoAACADIAMtAAAgACABLQAPc0HIlMAAai0AAHM6AAAL3g8CD38BfiMAQcABayIDJAAgA0EAQYABEJEBIgNBuAFqIgQgAEE4aiIFKQMANwMAIANBsAFqIgYgAEEwaiIHKQMANwMAIANBqAFqIgggAEEoaiIJKQMANw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X9zcSABIAJxcmpqQRN3IgRBf3NxIAEgBHFyIANqakEDdyIDIAggBCARIAEgA0F/c3EgAyAEcXIgAmpqQQd3IgVBf3NxIAMgBXFyIAFqakELdyIBIAVyIBIgBCABIAVxIgQgAyABQX9zcXJqakETdyICcSAEcmogFGpBmfOJ1AVqQQN3IgMgByABIAUgAyABIAJycSABIAJxcmogDWpBmfOJ1AVqQQV3IgQgAiADcnEgAiADcXJqakGZ84nUBWpBCXciASAEciAJIAIgASADIARycSADIARxcmpqQZnzidQFakENdyICcSABIARxcmogDGpBmfOJ1AVqQQN3IgMgDyABIAQgAyABIAJycSABIAJxcmogFWpBmfOJ1AVqQQV3IgQgAiADcnEgAiADcXJqakGZ84nUBWpBCXciASAEciARIAIgASADIARycSADIARxcmpqQZnzidQFakENdyICcSABIARxcmogC2pBmfOJ1AVqQQN3IgMgCiABIAYgBCADIAEgAnJxIAEgAnFyampBmfOJ1AVqQQV3IgQgAiADcnEgAiADcXJqakGZ84nUBWpBCXciASAEciAIIAIgASADIARycSADIARxcmpqQZnzidQFakENdyICcSABIARxcmogE2pBmfOJ1AVqQQN3IgMgEiACIBAgASAOIAQgAyABIAJycSABIAJxcmpqQZnzidQFakEFdyIEIAIgA3JxIAIgA3FyampBmfOJ1AVqQQl3IgUgAyAEcnEgAyAEcXJqakGZ84nUBWpBDXciAyAFcyICIARzaiAUakGh1+f2BmpBA3ciASAJIAMgASAHIAQgASACc2pqQaHX5/YGakEJdyICcyAFIA1qIAEgA3MgAnNqQaHX5/YGakELdyIEc2pqQaHX5/YGakEPdyIDIARzIgUgAnNqIAtqQaHX5/YGakEDdyIBIAggAyABIAogAiABIAVzampBodfn9gZqQQl3IgJzIAQgBmogASADcyACc2pBodfn9gZqQQt3IgRzampBodfn9gZqQQ93IgMgBHMiBSACc2ogDGpBodfn9gZqQQN3IgEgESADIAEgDyACIAEgBXNqakGh1+f2BmpBCXciAnMgBCAVaiABIANzIAJzakGh1+f2BmpBC3ciBHNqakGh1+f2Bm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A3AwAgAiACKQNQNwNAIAkgBykDADcAACAKIAIpA0A3AAAgAUE8aiALKQMANwAAIAFBNGogDCkDADcAACABQSxqIA0pAwA3AAAgAUEkaiAFKQMANwAAIAggBCkDADcAACABIAIpAxA3ABQgAUEANgIAQRBBARChASIERQ0BIAJCEDcCFCACIAQ2AhAgAkEQaiACQRAQXgJAIAIoAhQiBSACKAIYIgRGBEAgBSEEDAELIAUgBEkNAyAFRQ0AIAIoAhAhBgJAIARFBEAgBhAQQQEhBQwBCyAGIAVBASAEEJoBIgVFDQULIAIgBDYCFCACIAU2AhALIAIoAhAhBSACQThqIgZCADcDACACQTBqIgdCADcDACACQShqIghCADcDACACQSBqIglCADcDACACQRhqIgpCADcDACACQgA3AxAgAkHqAGpCADcBACACQfIAakEAOwEAIAJBEDYCYCACQQA7AWQgAkEANgFmIAJBiAFqIAJB8ABqKAIANgIAIAJBgAFqIAJB6ABqKQMANwMAIAJB2ABqIgsgAkGEAWopAgA3AwAgAiACKQNgNwN4IAIgAikCfDcDUCACQcgAaiIMIAspAwA3AwAgAiACKQNQNwNAIANBOGogDCkDADcAACADQTBqIAIpA0A3AAAgA0EoaiAGKQMANwAAIANBIGogBykDADcAACADQRhqIAgpAwA3AAAgA0EQaiAJKQMANwAAIANBCGogCikDADcAACADIAIpAxA3AAAgAUEANgIAIAAgBDYCBCAAIAU2AgAgAkGQAWokAA8LQbCawABBFyACQRBqQaCXwABBsJfAABB5AAtBEEEBQbSlwAAoAgAiAEECIAAbEQAAAAtBh4zAAEEkQayMwAAQiAEACyAEQQFBtKXAACgCACIAQQIgABsRAAAAC9gIAQV/IABBeGoiASAAQXxqKAIAIgNBeHEiAGohAgJAAkACQAJAIANBAXENACADQQNxRQ0BIAEoAgAiAyAAaiEAIAEgA2siAUH8pMAAKAIARgRAIAIoAgRBA3FBA0cNAUH0pMAAIAA2AgAgAiACKAIEQX5xNgIEIAEgAEEBcjYCBCAAIAFqIAA2AgAPCyABIAMQTAsCQCACQQRqIgQoAg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gASEDA0AgBSADLQAAQcABcUGAAUZqIQUgA0EBaiEDIARBf2oiBA0ACwsgBSACayAHaiIDIQQCQAJAAkBBACAALQAgIgUgBUEDRhtBAWsOAwEAAQILIANBAXYhBiADQQFqQQF2IQQMAQtBACEEIAMhBgsgBkEBaiEDAkADQCADQX9qIgNFDQEgACgCGCAAKAIEIAAoAhwoAhARAQBFDQALQQEPCyAAKAIEIQVBASEDIAAoAhggASACIAAoAhwoAgwRAwANACAEQQFqIQMgACgCHCEBIAAoAhghAANAIANBf2oiA0UEQEEADwsgACAFIAEoAhARAQBFDQALQQEPCyADDwsgACgCGCABIAIgAEEcaigCACgCDBEDAAvOBgEEfyMAQaABayICJAAgAkE6akIANwEAIAJBwgBqQQA7AQAgAkHEAGpCADcCACACQcwAakIANwIAIAJB1ABqQgA3AgAgAkHcAGpCADcCACACQQA7ATQgAkEANgE2IAJBMDYCMCACQZABaiACQdgAaikDADcDACACQYgBaiACQdAAaikDADcDACACQYABaiACQcgAaikDADcDACACQfgAaiACQUBrKQMANwMAIAJB8ABqIAJBOGopAwA3AwAgAkGYAWogAkHgAGooAgA2AgAgAiACKQMwNwNoIAJBIGogAkGMAWopAgA3AwAgAkEYaiACQYQBaikCADcDACACQRBqIAJB/ABqKQIANwMAIAJBCGogAkH0AGopAgA3AwAgAkEoaiACQZQBaikCADcDACACIAIpAmw3AwAgASACEB8gAUIANwMIIAFCADcDACABQQA2AlAgAUHQmMAAKQMANwMQIAFBGGpB2JjAACkDADcDACABQSBqQeCYwAApAwA3AwAgAUEoakHomMAAKQMANwMAIAFBMGpB8JjAACkDADcDACABQThqQfiYwAApAwA3AwAgAUFAa0GAmcAAKQMANwMAIAFByABqQYiZwAApAwA3AwACQAJAQTBBARChASIDBEAgAkIwNwJsIAIgAzYCaCACQegAaiACQTAQXgJAIAIoAmwiBCACKAJwIgNGBEAgBCEDDAELIAQgA0kNAiAERQ0AIAIoAmghBQJAIANFBEAgBRAQQQEhBAwBCyAFIARBASADEJoBIgRFDQQLIAIgAzYCbCACIAQ2AmgLIAIoAmghBCABQgA3AwggAUIANwMAIAFBADYCUCABQRBqIgFB0JjAACkDADcDACABQQhqQdiYwAApAwA3AwAgAUEQakHgmMAAKQMANwMAIAFBGGpB6JjAACkDADcDACABQSBqQfCYwAApAwA3AwAgAUEoakH4mMAAKQMANwMAIAFBMGpBgJnAACkDADcDACABQThqQYiZwAApAwA3AwAgACADNgIEIAAgBDYCACACQaABaiQADwtBMEEBQbSlwAAoAgAiAEECIAAbEQAAAAtBh4zAAEEkQayMwAAQiAEACyADQQFBtKXAACgCACIAQQIgABsRAAAAC78GAQR/IAAgAWohAgJAAkACQAJAAkAgAEEEaigCACIDQQFxDQAgA0EDcUUNASAAKAIAIgMgAWohASAAIANrIgBB/KTAACgCAEYEQCACKAIEQQNxQQNHDQFB9KTAACABNgIAIAIgAigCBEF+cTYCBCAAIAFBAXI2AgQgAiABNgIADwsgACADEEwLAkAgAkEEaigCACIDQQJxBEAgAkEEaiADQX5xNgIAIAAgAUEBcjYCBCAAIAFqIAE2AgAMAQsCQCACQYClwAAoAgBHBEBB/KTAACgCACACRg0BIAIgA0F4cSICEEwgACABIAJqIgFBAXI2AgQgACABaiABNgIAIABB/KTAACgCAEcNAkH0pMAAIAE2AgAPC0GApcAAIAA2AgBB+KTAAEH4pMAAKAIAIAFqIgE2AgAgACABQQFyNgIEIABB/KTAACgCAEcNAkH0pMAAQQA2AgBB/KTAAEEANgIADwtB/KTAACAANgIAQfSkwABB9KTAACgCACABaiIBNgIAIAAgAUEBcjYCBCAAIAFqIAE2AgAPCyABQYACSQ0DIABCADcCECAAQRxqAn9BACABQQh2IgNFDQAaQR8gAUH///8HSw0AGiABQQYgA2ciAmtBH3F2QQFxIAJBAXRrQT5qCyICNgIAIAJBAnRB9KPAAGohAwJAAkBB6KHAACgCACIEQQEgAkEfcXQiBXEEQCADKAIAIgNBBGooAgBBeHEgAUcNASADIQIMAgtB6KHAACAEIAVyNgIAIAMgADYCAAwECyABQQBBGSACQQF2a0EfcSACQR9GG3QhBANAIAMgBEEddkEEcWpBEGoiBSgCACICRQ0DIARBAXQhBCACIQMgAkEEaigCAEF4cSABRw0ACwsgAigCCCIBIAA2AgwgAiAANgIIIABBGGpBADYCACAAIAI2AgwgACABNgIICw8LIAUgADYCAAsgAEEYaiADNgIAIAAgADYCDCAAIAA2AggPCyABQQN2IgJBA3RB7KHAAGohAQJ/QeShwAAoAgAiA0EBIAJ0IgJxBEAgASgCCAwBC0HkocAAIAIgA3I2AgAgAQshAiABIAA2AgggAiAANgIMIAAgATYCDCAAIAI2AggL1AYBBH8jAEHQAWsiAiQAIAJBygBqQgA3AQAgAkHSAGpBADsBACACQdQAakIANwIAIAJB3ABqQgA3AgAgAkHkAGpCADcCACACQewAakIANwIAIAJB9ABqQgA3AgAgAkH8AGpBADoAACACQf0AakEANgAAIAJBgQFqQQA7AAAgAkGDAWpBADoAACACQQA7AUQgAkEANgFGIAJBwAA2AkAgAkGIAWogAkFAa0HEABCLARogAkE4aiACQcQBaikCADcDACACQTBqIAJBvAFqKQIANwMAIAJBKGogAkG0AWopAgA3AwAgAkEgaiACQawBaikCADcDACACQRhqIAJBpAFqKQIANwMAIAJBEGogAkGcAWopAgA3AwAgAkEIaiACQZQBaikCADcDACACIAIpAowBNwMAIAEgAhARIAFCADcDCCABQgA3AwAgAUEANgJQIAFBkJnAACkDADcDECABQRhqQZiZwAApAwA3AwAgAUEgakGgmcAAKQMANwMAIAFBKGpBqJnAACkDADcDACABQTBqQbCZwAApAwA3AwAgAUE4akG4mcAAKQMANwMAIAFBQGtBwJnAACkDADcDACABQcgAakHImcAAKQMANwMAAkACQEHAAEEBEKEBIgMEQCACQsAANwKMASACIAM2AogBIAJBiAFqIAJBwAAQXgJAIAIoAowBIgQgAigCkAEiA0YEQCAEIQMMAQsgBCADSQ0CIARFDQAgAigCiAEhBQJAIANFBEAgBRAQQQEhBAwBCyAFIARBASADEJoBIgRFDQQLIAIgAzYCjAEgAiAENgKIAQsgAigCiAEhBCABQgA3AwggAUIANwMAIAFBADYCUCABQRBqIgFBkJnAACkDADcDACABQQhqQZiZwAApAwA3AwAgAUEQakGgmcAAKQMANwMAIAFBGGpBqJnAACkDADcDACABQSBqQbCZwAApAwA3AwAgAUEoakG4mcAAKQMANwMAIAFBMGpBwJnAACkDADcDACABQThqQciZwAApAwA3AwAgACADNgIEIAAgBDYCACACQdABaiQADwtBwABBAUG0pcAAKAIAIgBBAiAAGxEAAAALQYeMwABBJEGsjMAAEIgBAAsgA0EBQbSlwAAoAgAiAEECIAAbEQAAAAuOBgEKfyMAQTBrIgIkACACQSRqQYCHwAA2AgAgAkEDOgAoIAJCgICAgIAENwMIIAIgADYCICACQQA2AhggAkEANgIQAn8CQAJAAkAgASgCCCIDBEAgASgCACEFIAEoAgQiCCABQQxqKAIAIgYgBiAISxsiBkUNASABQRRqKAIAIQcgASgCECEJIAAgBSgCACAFKAIEQYyHwAAoAgARAwANAyAFQQhqIQECQAJAA0AgAiADQQRqKAIANgIMIAIgA0Ecai0AADoAKCACIANBCGooAgA2AgggA0EYaigCACEAQQAhBAJAAkACQCADQRRqKAIAQQFrDgIAAgELIAAgB08NAyAAQQN0IAlqIgooAgRBA0cNASAKKAIAKAIAIQALQQEhBAsgAiAANgIUIAIgBDYCECADQRBqKAIAIQBBACEEAkACQAJAIANBDGooAgBBAWsOAgACAQsgACAHTw0EIABBA3QgCWoiCigCBEEDRw0BIAooAgAoAgAhAAtBASEECyACIAA2AhwgAiAENgIYIAMoAgAiACAHSQRAIAkgAEEDdGoiACgCACACQQhqIAAoAgQRAQANByALQQFqIgsgBk8NBiADQSBqIQMgAUEEaiEAIAEoAgAhBCABQQhqIQEgAigCICAEIAAoAgAgAigCJCgCDBEDAEUNAQwHCwsgACAHQaCLwAAQfAALIAAgB0GQi8AAEHwACyAAIAdBkIvAABB8AAsgASgCACEFIAEoAgQiCCABQRRqKAIAIgMgAyAISxsiBkUNACABKAIQIQMgACAFKAIAIAUoAgRBjIfAACg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MAGpCADcCACACQdQAakIANwIAIAJBADsBNCACQQA2ATYgAkEoNgIwIAJBgAFqIAJB0ABqKQMANwMAIAJB+ABqIAJByABqKQMANwMAIAJB8ABqIAJBQGspAwA3AwAgAkHoAGogAkE4aikDADcDACACQYgBaiACQdgAaigCADYCACACIAIpAzA3A2AgAkEgaiACQfwAaikCADcDACACQRhqIAJB9ABqKQIANwMAIAJBEGogAkHsAGopAgA3AwAgAkEoaiACQYQBaikCADcDACACIAIpAmQ3AwggASACQQhqEE0gAUIANwMAIAFBADYCMCABQdCXwAApAwA3AwggAUEQakHYl8AAKQMANwMAIAFBGGpB4JfAACkDADcDACABQSBqQeiXwAApAwA3AwAgAUEoakHwl8AAKQMANwMAAkACQEEoQQEQoQEiAwRAIAJCKDcCZCACIAM2AmAgAkHgAGogAkEIakEoEF4CQCACKAJkIgQgAigCaCIDRgRAIAQhAwwBCyAEIANJDQIgBEUNACACKAJgIQUCQCADRQRAIAUQEEEBIQQMAQsgBSAEQQEgAxCaASIERQ0ECyACIAM2AmQgAiAENgJgCyACKAJgIQQgAUIANwMAIAFBADYCMCABQQhqIgFB0JfAACkDADcDACABQQhqQdiXwAApAwA3AwAgAUEQakHgl8AAKQMANwMAIAFBGGpB6JfAACkDADcDACABQSBqQfCXwAApAwA3AwAgACADNgIEIAAgBDYCACACQZABaiQADwtBKEEBQbSlwAAoAgAiAEECIAAbEQAAAAtBh4zAAEEkQayMwAAQiAEACyADQQFBtKXAACgCACIAQQIgABsRAAAAC8YEAQR/IwBBoAFrIgIkACACQTpqQgA3AQAgAkHCAGpBADsBACACQcQAakIANwIAIAJBzABqQgA3AgAgAkHUAGpCADcCACACQdwAakIANwIAIAJBADsBNCACQQA2ATYgAkEwNgIwIAJBkAFqIAJB2ABqKQMANwMAIAJBiAFqIAJB0ABqKQMANwMAIAJBgAFqIAJByABqKQMANwMAIAJB+ABqIAJBQGspAwA3AwAgAkHwAGogAkE4aikDADcDACACQZgBaiACQeAAaigCADYCACACIAIpAzA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MAIAJBQGsgAkH4AmopAwA3AwAgAkE4aiACQfACaikDADcDACACQeAAaiACQZgDaigCADYCACACIAIpA+gCNwMwIAJBIGogAkHUAGopAgA3AwAgAkEYaiACQcwAaikCADcDACACQRBqIAJBxABqKQIANwMAIAJBCGogAkE8aikCADcDACACQShqIAJB3ABqKQIANwMAIAIgAikCNDcDACACQTBqIAFBuAIQiwEaIAJBMGogAhBkAkACQEEwQQEQoQEiAwRAIAJCMDcCNCACIAM2AjAgAkEwaiACQTAQXgJAIAIoAjQiBCACKAI4IgNGBEAgBCEDDAELIAQgA0kNAiAERQ0AIAIoAjAhBQJAIANFBEAgBRAQQQEhBAwBCyAFIARBASADEJoBIgRFDQQLIAIgAzYCNCACIAQ2AjALIAIoAjAhBCABEBAgACADNgIEIAAgBDYCACACQaADaiQADwtBMEEBQbSlwAAoAgAiAEECIAAbEQAAAAtBh4zAAEEkQayMwAAQiAEACyADQQFBtKXAACgCACIAQQIgABsRAAAAC7wEAQR/IwBBwAJrIgIkACACQZICakIANwEAIAJBmgJqQQA7AQAgAkGcAmpCADcCACACQaQCakIANwIAIAJBrAJqQgA3AgAgAkG0AmpCADcCACACQQA7AYwCIAJBADYBjgIgAkEwNgKIAiACQdgAaiACQbACaikDADcDACACQdAAaiACQagCaikDADcDACACQcgAaiACQaACaikDADcDACACQUBrIAJBmAJqKQMANwMAIAJBOGogAkGQAmopAwA3AwAgAkHgAGogAkG4AmooAgA2AgAgAiACKQOIAjcDMCACQSBqIAJB1ABqKQIANwMAIAJBGGogAkHMAGopAgA3AwAgAkEQaiACQcQAaikCADcDACACQQhqIAJBPGopAgA3AwAgAkEoaiACQdwAaikCADcDACACIAIpAjQ3AwAgAkEwaiABQdgBEIsBGiACQTBqIAIQHwJAAkBBMEEBEKEBIgMEQCACQjA3AjQgAiADNgIwIAJBMGogAkEwEF4CQCACKAI0IgQgAigCOCIDRgRAIAQhAwwBCyAEIANJDQIgBEUNACACKAIwIQUCQCADRQRAIAUQEEEBIQQMAQ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bSlwAAoAgAiAEECIAAbEQAAAAtBh4zAAEEkQayMwAAQiAEACyABQQFBtKXAACgCACIAQQIgABsRAAAAC8wEAQR/IwBB0AFrIgIkACACQcoAakIANwEAIAJB0gBqQQA7AQAgAkHUAGpCADcCACACQdwAakIANwIAIAJB5ABqQgA3AgAgAkHsAGpCADcCACACQfQAakIANwIAIAJB/ABqQQA6AAAgAkH9AGpBADYAACACQYEBakEAOwAAIAJBgwFqQQA6AAAgAkEAOwFEIAJBADYBRiACQcAANgJAIAJBiAFqIAJBQGtBxAAQiwEaIAJBOGogAkHEAWopAgA3AwAgAkEwaiACQbwBaikCADcDACACQShqIAJBtAFqKQIANwMAIAJBIGogAkGsAWopAgA3AwAgAkEYaiACQaQBaikCADcDACACQRBqIAJBnAFqKQIANwMAIAJBCGogAkGUAWopAgA3AwAgAiACKQKMATcDACABIAIQXCABQQBByAEQkQEiBUEANgLIAQJAAkBBwABBARChASIBBEAgAkLAADcCjAEgAiABNgKIASACQYgBaiACQcAAEF4CQCACKAKMASIDIAIoApABIgFGBEAgAyEBDAELIAMgAUkNAiADRQ0AIAIoAogBIQQCQCABRQRAIAQQEEEBIQMMAQsgBCADQQEgARCaASIDRQ0ECyACIAE2AowBIAIgAzYCiAELIAIoAogBIQMgBUEAQcgBEJEBQQA2AsgBIAAgATYCBCAAIAM2AgAgAkHQAWokAA8LQcAAQQFBtKXAACgCACIAQQIgABsRAAAAC0GHjMAAQSRBrIzAABCIAQALIAFBAUG0pcAAKAIAIgBBAiAAGxEAAAALuAQBBH8jAEGgA2siAiQAIAJB4gJqQgA3AQAgAkHqAmpBADsBACACQewCakIANwIAIAJB9AJqQgA3AgAgAkH8AmpCADcCACACQYQDakIANwIAIAJBjANqQgA3AgAgAkGUA2pBADoAACACQZUDakEANgAAIAJBmQNqQQA7AAAgAkGbA2pBADoAACACQQA7AdwCIAJBADYB3gIgAkHAADYC2AIgAkFAayACQdgCakHEABCLARogAkE4aiACQfwAaikCADcDACACQTBqIAJB9ABqKQIANwMAIAJBKGogAkHsAGopAgA3AwAgAkEgaiACQeQAaikCADcDACACQRhqIAJB3ABqKQIANwMAIAJBEGogAkHUAGopAgA3AwAgAkEIaiACQcwAaikCADcDACACIAIpAkQ3AwAgAkFAayABQZgCEIsBGiACQUBrIAIQWwJAAkBBwABBARChASIDBEAgAkLAADcCRCACIAM2AkAgAkFAayACQcAAEF4CQCACKAJEIgQgAigCSCIDRgRAIAQhAwwBCyAEIANJDQIgBEUNACACKAJAIQUCQCADRQRAIAUQEEEBIQQMAQsgBSAEQQEgAxCaASIERQ0ECyACIAM2AkQgAiAENgJACyACKAJAIQQgARAQIAAgAzYCBCAAIAQ2AgAgAkGgA2okAA8LQcAAQQFBtKXAACgCACIAQQIgABsRAAAAC0GHjMAAQSRBrIzAABCIAQALIANBAUG0pcAAKAIAIgBBAiAAGxEAAAALuAQBBH8jAEGgA2siAiQAIAJB4gJqQgA3AQAgAkHqAmpBADsBACACQewCakIANwIAIAJB9AJqQgA3AgAgAkH8AmpCADcCACACQYQDakIANwIAIAJBjANqQgA3AgAgAkGUA2pBADoAACACQZUDakEANgAAIAJBmQNqQQA7AAAgAkGbA2pBADoAACACQQA7AdwCIAJBADYB3gIgAkHAADYC2AIgAkFAayACQdgCakHEABCLARogAkE4aiACQfwAaikCADcDACACQTBqIAJB9ABqKQIANwMAIAJBKGogAkHsAGopAgA3AwAgAkEgaiACQeQAaikCADcDACACQRhqIAJB3ABqKQIANwMAIAJBEGogAkHUAGopAgA3AwAgAkEIaiACQcwAaikCADcDACACIAIpAkQ3AwAgAkFAayABQZgCEIsBGiACQUBrIAIQXAJAAkBBwABBARChASIDBEAgAkLAADcCRCACIAM2AkAgAkFAayACQcAAEF4CQCACKAJEIgQgAigCSCIDRgRAIAQhAwwBCyAEIANJDQIgBEUNACACKAJAIQUCQCADRQRAIAUQEEEBIQQMAQsgBSAEQQEgAxCaASIERQ0ECyACIAM2AkQgAiAENgJACyACKAJAIQQgARAQIAAgAzYCBCAAIAQ2AgAgAkGgA2okAA8LQcAAQQFBtKXAACgCACIAQQIgABsRAAAAC0GHjMAAQSRBrIzAABCIAQALIANBAUG0pcAAKAIAIgBBAiAAGxEAAAALuAQBBH8jAEHgAmsiAiQAIAJBogJqQgA3AQAgAkGqAmpBADsBACACQawCakIANwIAIAJBtAJqQgA3AgAgAkG8AmpCADcCACACQcQCakIANwIAIAJBzAJqQgA3AgAgAkHUAmpBADoAACACQdUCakEANgAAIAJB2QJqQQA7AAAgAkHbAmpBADoAACACQQA7AZwCIAJBADYBngIgAkHAADYCmAIgAkFAayACQZgCakHEABCLARogAkE4aiACQfwAaikCADcDACACQTBqIAJB9ABqKQIANwMAIAJBKGogAkHsAGopAgA3AwAgAkEgaiACQeQAaikCADcDACACQRhqIAJB3ABqKQIANwMAIAJBEGogAkHUAGopAgA3AwAgAkEIaiACQcwAaikCADcDACACIAIpAkQ3AwAgAkFAayABQdgBEIsBGiACQUBrIAIQEQJAAkBBwABBARChASIDBEAgAkLAADcCRCACIAM2AkAgAkFAayACQcAAEF4CQCACKAJEIgQgAigCSCIDRgRAIAQhAwwBCyAEIANJDQIgBEUNACACKAJAIQUCQCADRQRAIAUQEEEBIQQMAQsgBSAEQQEgAxCaASIERQ0ECyACIAM2AkQgAiAENgJACyACKAJAIQQgARAQIAAgAzYCBCAAIAQ2AgAgAkHgAmokAA8LQcAAQQFBtKXAACgCACIAQQIgABsRAAAAC0GHjMAAQSRBrIzAABCIAQALIANBAUG0pcAAKAIAIgBBAiAAGxEAAAAL0AQBBH8jAEHgAGsiAiQAIAJBKmpCADcBACACQTJqQQA7AQAgAkE0akIANwIAIAJBHDYCICACQTxqQQA2AgAgAkEAOwEkIAJBADYBJiACQdgAaiACQThqKQMANwMAIAJB0ABqIAJBMGopAwA3AwAgAkHIAGogAkEoaikDADcDACACIAIpAyA3A0AgAkEYaiACQdwAaigCADYCACACQRBqIAJB1ABqKQIANwMAIAJBCGogAkHMAGopAgA3AwAgAiACKQJENwMAIAEgAhBPIAFBADYCCCABQgA3AwAgAUGMmMAAKQIANwJMIAFB1ABqQZSYwAApAgA3AgAgAUHcAGpBnJjAACkCADcCACABQeQAakGkmMAAKQIANwIAAkACQEEcQQEQoQEiAwRAIAJCHDcCRCACIAM2AkAgAkFAayACQRwQXgJAIAIoAkQiBCACKAJIIgNGBEAgBCEDDAELIAQgA0kNAiAERQ0AIAIoAkAhBQJAIANFBEAgBRAQQQEhBAwBCyAFIARBASADEJoBIgRFDQQLIAIgAzYCRCACIAQ2AkALIAIoAkAhBCABQQA2AgggAUIANwMAIAFBzABqIgFBjJjAACkCADcCACABQQhqQZSYwAApAgA3AgAgAUEQakGcmMAAKQIANwIAIAFBGGpBpJjAACkCADcCACAAIAM2AgQgACAENgIAIAJB4ABqJAAPC0EcQQFBtKXAACgCACIAQQIgABsRAAAAC0GHjMAAQSRBrIzAABCIAQALIANBAUG0pcAAKAIAIgBBAiAAGxEAAAALjAQBBH8jAEHQAWsiAiQAIAJBqgFqQgA3AQAgAkGyAWpBADsBACACQbQBakIANwIAIAJBvAFqQgA3AgAgAkHEAWpCADcCACACQQA7AaQBIAJBADYBpgEgAkEoNgKgASACQcgAaiACQcABaikDADcDACACQUBrIAJBuAFqKQMANwMAIAJBOGogAkGwAWopAwA3AwAgAkEwaiACQagBaikDADcDACACQdAAaiACQcgBaigCADYCACACIAIpA6ABNwMoIAJBGGogAkHEAGopAgA3AwAgAkEQaiACQTxqKQIANwMAIAJBCGogAkE0aikCADcDACACQSBqIAJBzABqKQIANwMAIAIgAikCLDcDACACQShqIAFB+AAQiwEaIAJBKGogAhBNAkACQEEoQQEQoQEiAwRAIAJCKDcCLCACIAM2AiggAkEoaiACQSgQXgJAIAIoAiwiBCACKAIwIgNGBEAgBCEDDAELIAQgA0kNAiAERQ0AIAIoAighBQJAIANFBEAgBRAQQQEhBAwBCyAFIARBASADEJoBIgRFDQQLIAIgAzYCLCACIAQ2AigLIAIoAighBCABEBAgACADNgIEIAAgBDYCACACQdABaiQADwtBKE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AktAAAgAiAFai0AAHM6AAAgBUEBaiIFQZABRw0ACyAAEA4gBkGQAUkNAkGQASEFIAJBkAFqIQIgCEGQAWohCAwACwALIAIgBGoiBiAESQ0CIAZBkAFLDQMgACAEakHMAWogASACEIsBGiAAKALIASACaiEHDAELIABBzAFqIAEgBGogBxCLARoLIAAgBzYCyAEgA0FAayQADwsgBCAGQcCbwAAQfgALIAZBkAFBwJvAABB9AAsgBEGQAUHQm8AAEH4ACyAEIAJB4JvAABB9AAsgA0E0akEGNgIAIANBJGpBAjYCACADQgM3AhQgA0G4nsAANgIQIANBBjYCLCADIANBDGo2AjggA0G0nsAANgI8IAMgA0EoajYCICADIANBPGo2AjAgAyADQThqNgIoIANBEGpB4J7AABCQAQALmwQBB38jAEFAaiIDJAACQAJAAkACQAJAAkACQEHIACAAKALIASIEayIGIAJNBEAgBARAIARByQBPDQYgACAEakHMAWogASAGEIsBGiACIAZrIQIgASAGaiEBA0AgACAFaiIEIAQtAAAgBEHMAWotAABzOgAAIAVBAWoiBUHIAEcNAAsgABAOCyACIAJByABwIgdrIQQgAiAHSQ0GIARByABJDQEgAUHIAGohCCABIQIgBCEGQcgAIQUDQCADIAU2AgwgBUHIAEcNCCAGQbh/aiEGQQAhBQNAIAAgBWoiCSAJLQAAIAIgBWotAABzOgAAIAVBAWoiBUHIAEcNAAsgABAOIAZByABJDQJByAAhBSACQcgAaiECIAhByABqIQgMAAsACyACIARqIgYgBEkNAiAGQcgASw0DIAAgBGpBzAFqIAEgAhCLARogACgCyAEgAmohBwwBCyAAQcwBaiABIARqIAcQiwEaCyAAIAc2AsgBIANBQGskAA8LIAQgBkHAm8AAEH4ACyAGQcgAQcCbwAAQfQALIARByABB0JvAABB+AAsgBCACQeCbwAAQfQALIANBNGpBBjYCACADQSRqQQI2AgAgA0IDNwIUIANBuJ7AADYCECADQQY2AiwgAyADQQxqNgI4IANB3J7AADYCPCADIANBKGo2AiAgAyADQTxqNgIwIAMgA0E4ajYCKCADQRBqQeCewAAQkAEAC5sEAQd/IwBBQGoiAyQAAkACQAJAAkACQAJAAkBB6AAgACgCyAEiBGsiBiACTQRAIAQEQCAEQekATw0GIAAgBGpBzAFqIAEgBhCLARogAiAGayECIAEgBmohAQNAIAAgBWoiBCAELQAAIARBzAFqLQAAczoAACAFQQFqIgVB6ABHDQALIAAQDgsgAiACQegAcCIHayEEIAIgB0kNBiAEQegASQ0BIAFB6ABqIQggASECIAQhBkHoACEFA0AgAyAFNgIMIAVB6ABHDQggBkGYf2ohBkEAIQUDQCAAIAVqIgkgCS0AACACIAVqLQAAczoAACAFQQFqIgVB6ABHDQALIAAQDiAGQegASQ0CQegAIQUgAkHoAGohAiAIQegAaiEIDAALAAsgAiAEaiIGIARJDQIgBkHoAEsNAyAAIARqQcwBaiABIAIQiwEaIAAoAsgBIAJqIQcMAQsgAEHMAWogASAEaiAHEIsBGgsgACAHNgLIASADQUBrJAAPCyAEIAZBwJvAABB+AAsgBkHoAEHAm8AAEH0ACyAEQegAQdCbwAAQfgALIAQgAkHgm8AAEH0ACyADQTRqQQY2AgAgA0EkakECNgIAIANCAzcCFCADQbiewAA2AhAgA0EGNgIsIAMgA0EMajYCOCADQdiewAA2AjwgAyADQShqNgIgIAMgA0E8ajYCMCADIANBOGo2AiggA0EQakHgnsAAEJABAAvkAwEEfyMAQcABayICJAAgAkGiAWpCADcBACACQaoBakEAOwEAIAJBrAFqQgA3AgAgAkG0AWpCADcCACACQQA7AZwBIAJBADYBngEgAkEgNgKYASACQUBrIAJBsAFqKQMANwMAIAJBOGogAkGoAWopAwA3AwAgAkEwaiACQaABaikDADcDACACQcgAaiACQbgBaigCADYCACACIAIpA5gBNwMoIAJBGGogAkE8aikCADcDACACQRBqIAJBNGopAgA3AwAgAkEgaiACQcQAaikCADcDACACIAIpAiw3AwggAkEoaiABQfAAEIsBGiACQShqIAJBCGoQOwJAAkBBIEEBEKEBIgMEQCACQiA3AiwgAiADNgIoIAJBKGogAkEIakEgEF4CQCACKAIsIgQgAigCMCI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UG0pcAAKAIAIgBBAiAAGxEAAAALQYeMwABBJEGsjMAAEIgBAAsgA0EBQbSlwAAoAgAiAEECIAAbEQAAAAvlAwEEfyMAQfAAayICJAAgAkEqakIANwEAIAJBMmpBADsBACACQTRqQgA3AgAgAkE8akIANwIAIAJBADsBJCACQQA2ASYgAkEgNgIgIAJB4ABqIAJBOGopAwA3AwAgAkHYAGogAkEwaikDADcDACACQdAAaiACQShqKQMANwMAIAJB6ABqIAJBQGsoAgA2AgAgAiACKQMgNwNIIAJBEGogAkHcAGopAgA3AwAgAkEIaiACQdQAaikCADcDACACQRhqIAJB5ABqKQIANwMAIAIgAikCTDcDACABIAIQZiABQQBByAEQkQEiBUEANgLIAQJAAkBBIEEBEKEBIgEEQCACQiA3AkwgAiABNgJIIAJByABqIAJBIBBeAkAgAigCTCIDIAIoAlAiAUYEQCADIQEMAQsgAyABSQ0CIANFDQAgAigCSCEEAkAgAUUEQCAEEBBBASEDDAELIAQgA0EBIAEQmgEiA0UNBAsgAiABNgJMIAIgAzYCSAsgAigCSCEDIAVBAEHIARCRAUEANgLIASAAIAE2AgQgACADNgIAIAJB8ABqJAAPC0EgQQFBtKXAACgCACIAQQIgABsRAAAAC0GHjMAAQSRBrIzAABCIAQALIAFBAUG0pcAAKAIAIgBBAiAAGxEAAAAL5QMBBH8jAEHwAGsiAiQAIAJBKmpCADcBACACQTJqQQA7AQAgAkE0akIANwIAIAJBPGpCADcCACACQQA7ASQgAkEANgEmIAJBIDYCICACQeAAaiACQThqKQMANwMAIAJB2ABqIAJBMGopAwA3AwAgAkHQAGogAkEoaikDADcDACACQegAaiACQUBrKAIANgIAIAIgAikDIDcDSCACQRBqIAJB3ABqKQIANwMAIAJBCGogAkHUAGopAgA3AwAgAkEYaiACQeQAaikCADcDACACIAIpAkw3AwAgASACEGcgAUEAQcgBEJEBIgVBADYCyAECQAJAQSBBARChASIBBEAgAkIgNwJMIAIgATYCSCACQcgAaiACQSAQXgJAIAIoAkwiAyACKAJQIgFGBEAgAyEBDAELIAMgAUkNAiADRQ0AIAIoAkghBAJAIAFFBEAgBBAQQQEhAwwBCyAEIANBASABEJoBIgNFDQQLIAIgATYCTCACIAM2AkgLIAIoAkghAyAFQQBByAEQkQFBADYCyAEgACABNgIEIAAgAzYCACACQfAAaiQADwtBIEEBQbSlwAAoAgAiAEECIAAbEQAAAAtBh4zAAEEkQayMwAAQiAEACyABQQFBtKXAACgCACIAQQIgABsRAAAAC9wDAQR/IwBBoANrIgIkACACQYIDakIANwEAIAJBigNqQQA7AQAgAkGMA2pCADcCACACQZQDakIANwIAIAJBADsB/AIgAkEANgH+AiACQSA2AvgCIAJBOGogAkGQA2opAwA3AwAgAkEwaiACQYgDaikDADcDACACQShqIAJBgANqKQMANwMAIAJBQGsgAkGYA2ooAgA2AgAgAiACKQP4AjcDICACQRBqIAJBNGopAgA3AwAgAkEIaiACQSxqKQIANwMAIAJBGGogAkE8aikCADcDACACIAIpAiQ3AwAgAkEgaiABQdgCEIsBGiACQSBqIAIQZgJAAkBBIEEBEKEBIgMEQCACQiA3AiQgAiADNgIgIAJBIGogAkEgEF4CQCACKAIkIgQgAigCKCIDRgRAIAQhAwwBCyAEIANJDQIgBEUNACACKAIgIQUCQCADRQRAIAUQEEEBIQQMAQsgBSAEQQEgAxCaASIERQ0ECyACIAM2AiQgAiAENgIgCyACKAIgIQQgARAQIAAgAzYCBCAAIAQ2AgAgAkGgA2okAA8LQSBBAUG0pcAAKAIAIgBBAiAAGxEAAAALQYeMwABBJEGsjMAAEIgBAAsgA0EBQbSlwAAoAgAiAEECIAAbEQAAAAvcAwEEfyMAQaADayICJAAgAkGCA2pCADcBACACQYoDakEAOwEAIAJBjANqQgA3AgAgAkGUA2pCADcCACACQQA7AfwCIAJBADYB/gIgAkEgNgL4AiACQThqIAJBkANqKQMANwMAIAJBMGogAkGIA2opAwA3AwAgAkEoaiACQYADaikDADcDACACQUBrIAJBmANqKAIANgIAIAIgAikD+AI3AyAgAkEQaiACQTRqKQIANwMAI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gAkHYAGogAkE4aikDADcDACACQdAAaiACQTBqKQMANwMAIAJByABqIAJBKGopAwA3AwAgAiACKQMgNwNAIAJBGGogAkHcAGooAgA2AgAgAkEQaiACQdQAaikCADcDACACQQhqIAJBzABqKQIANwMAIAIgAikCRDcDACABIAIQaSABQQBByAEQkQEiBUEANgLIAQJAAkBBHEEBEKEBIgEEQCACQhw3AkQgAiABNgJAIAJBQGsgAkEcEF4CQCACKAJEIgMgAigCSCIBRgRAIAMhAQwBCyADIAFJDQIgA0UNACACKAJAIQQCQCABRQRAIAQQEEEBIQMMAQsgBCADQQEgARCaASIDRQ0ECyACIAE2AkQgAiADNgJACyACKAJAIQMgBUEAQcgBEJEBQQA2AsgBIAAgATYCBCAAIAM2AgAgAkHgAGokAA8LQRxBAUG0pcAAKAIAIgBBAiAAGxEAAAALQYeMwABBJEGsjMAAEIgBAAsgAUEBQbSlwAAoAgAiAEECIAAbEQAAAAvkAwIJfwF+IwBBoAFrIgIkACACQUBrIAFBBGoQciABKAIAIQggAkH4AGoiAyABQTxqKQAANwMAIAJB8ABqIgQgAUE0aikAADcDACACQegAaiIFIAFBLGopAAA3AwAgAkHgAGoiBiABQSRqKQAANwMAIAJB2ABqIgcgAUEcaikAADcDACACIAEpABQ3A1AgAkGQAWogAUHEAGoQciACQQhqIgkgBykDADcDACACQRBqIgcgBikDADcDACACQRhqIgYgBSkDADcDACACQSBqIgUgBCkDADcDACACQShqIgQgAykDADcDACACQTBqIgMgAikDkAEiCzcDACACQThqIgogAkGYAWopAwA3AwAgAiALNwOAASACIAIpA1A3AwBB1ABBBBChASIBRQRAQdQAQQRBtKXAACgCACIAQQIgABsRAAAACyABIAg2AgAgASACKQNANwIEIAEgAikDADcCFCABQQxqIAJByABqKQMANwIAIAFBHGogCSkDADcCACABQSRqIAcpAwA3AgAgAUEsaiAGKQMANwIAIAFBNGogBSkDADcCACABQTxqIAQpAwA3AgAgAUHEAGogAykDADcCACABQcwAaiAKKQMANwIAIABB9I/AADYCBCAAIAE2AgAgAkGgAWokAAvLAwEEfyMAQaADayICJAAgAkGKA2pCADcBACACQZIDakEAOwEAIAJBlANqQgA3AgAgAkEcNgKAAyACQZwDakEANgIAIAJBADsBhAMgAkEANgGGAyACQThqIAJBmANqKQMANwMAIAJBMGogAkGQA2opAwA3AwAgAkEoaiACQYgDaikDADcDACACIAIpA4ADNwMgIAJBGGogAkE8aigCADYCACACQRBqIAJBNGopAgA3AwAgAkEIaiACQSxqKQIANwMAIAIgAikCJDcDACACQSBqIAFB4AIQiwEaIAJBIGogAhBpAkACQEEcQQEQoQEiAwRAIAJCHDcCJCACIAM2AiAgAkEgaiACQRwQXgJAIAIoAiQiBCACKAIoIgNGBEAgBCEDDAELIAQgA0kNAiAERQ0AIAIoAiAhBQJAIANFBEAgBRAQQQEhBAwBCyAFIARBASADEJoBIgRFDQQLIAIgAzYCJCACIAQ2AiALIAIoAiAhBCABEBAgACADNgIEIAAgBDYCACACQaADaiQADwtBHEEBQbSlwAAoAgAiAEECIAAbEQAAAAtBh4zAAEEkQayMwAAQiAEACyADQQFBtKXAACgCACIAQQIgABsRAAAAC8sDAQR/IwBBoANrIgIkACACQYoDakIANwEAIAJBkgNqQQA7AQAgAkGUA2pCADcCACACQRw2AoADIAJBnANqQQA2AgAgAkEAOwGEAyACQQA2AYYDIAJBOGogAkGYA2opAwA3AwAgAkEwaiACQZADaikDADcDACACQShqIAJBiANqKQMANwMAIAIgAikDgAM3AyAgAkEYaiACQTxqKAIANgIAIAJBEGogAkE0aikCADcDACACQQhqIAJBLGopAgA3AwAgAiACKQIkNwMAIAJBIGogAUHgAhCLARogAkEgaiACEGgCQAJAQRxBARChASIDBEAgAkIcNwIkIAIgAzYCICACQSBqIAJBHBBeAkAgAigCJCIEIAIoAigiA0YEQCAEIQMMAQsgBCADSQ0CIARFDQAgAigCICEFAkAgA0UEQCAFEBBBASEEDAELIAUgBEEBIAMQmgEiBEUNBAsgAiADNgIkIAIgBDYCIAsgAigCICEEIAEQECAAIAM2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iAEECIAAbEQAAAAsgASAINwMAIAEgAikDSDcDCCABIAc2AjAgASACKQMINwI0IAFBEGogAykDADcDACABQRhqIAQpAwA3AwAgAUEgaiAFKQMANwMAIAFBKGogBikDADcDACABQTxqIAJBEGopAwA3AgAgAUHEAGogAkEYaikDADcCACABQcwAaiACQSBqKQMANwIAIAFB1ABqIAJBKGopAwA3AgAgAUHcAGogAkEwaikDADcCACABQeQAaiACQThqKQMANwIAIAFB7ABqIAJBQGspAwA3AgAgAEHgjMAANgIEIAAgATYCACACQfAAaiQAC4YDAQR/IwBBkAFrIgIkACACQYIBakIANwEAIAJBigFqQQA7AQAgAkEAOwF8IAJBADYBfiACQRA2AnggAkEgaiACQYABaikDADcDACACQShqIAJBiAFqKAIANgIAIAJBEGogAkEkaikCADcDACACIAIpA3g3AxggAiACKQIcNwMIIAJBGGogAUHgABCLARogAkEYaiACQQhqEF0CQAJAQRBBARChASIDBEAgAkIQNwIcIAIgAzYCGCACQRhqIAJBCGpBEBBeAkAgAigCHCIEIAIoAiAiA0YEQCAEIQMMAQsgBCADSQ0CIARFDQAgAigCGCEFAkAgA0UEQCAFEBBBASEEDAELIAUgBEEBIAMQmgEiBEUNBAsgAiADNgIcIAIgBDYCGAsgAigCGCEEIAEQECAAIAM2AgQgACAENgIAIAJBkAFqJAAPC0EQQQFBtKXAACgCACIAQQIgABsRAAAAC0GHjMAAQSRBrIzAABCIAQALIANBAUG0pcAAKAIAIgBBAiAAGxEAAAALhgMBBH8jAEGQAWsiAiQAIAJBggFqQgA3AQAgAkGKAWpBADsBACACQQA7AXwgAkEANgF+IAJBEDYCeCACQSBqIAJBgAFqKQMANwMAIAJBKGogAkGIAWooAgA2AgAgAkEQaiACQSRqKQIANwMAIAIgAikDeDcDGCACIAIpAhw3AwggAkEYaiABQeAAEIsBGiACQRhqIAJBCGoQTgJAAkBBEEEBEKEBIgMEQCACQhA3AhwgAiADNgIYIAJBGGogAkEIakEQEF4CQCACKAIcIgQgAigCICIDRgRAIAQh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QRBqIgQgAUHcAGopAgA3AwAgAkEYaiIFIAFB5ABqKQIANwMAIAIgASkCTDcDACABKAIIIQZB8ABBCBChASIBRQRAQfAAQQhBtKXAACgCACIAQQIgABsRAAAACyABIAY2AgggASAHNwMAIAEgAikDIDcCDCABQRRqIAJBKGopAwA3AgAgAUEcaiACQTBqKQMANwIAIAFBJGogAkE4aikDADcCACABQSxqIAJBQGspAwA3AgAgAUE0aiACQcgAaikDADcCACABQTxqIAJB0ABqKQMANwIAIAFBxABqIAJB2ABqKQMANwIAIAFB5ABqIAUpAwA3AgAgAUHcAGogBCkDADcCACABQdQAaiADKQMANwIAIAEgAikDADcCTCAAQeCQwAA2AgQgACABNgIAIAJB4ABqJAAL7AICBX8BfiMAQeAAayICJAAgASkDACEHIAJBIGogAUEMahBlIAJBCGoiAyABQdQAaikCADcDACACQRBqIgQgAUHcAGopAgA3AwAgAkEYaiIFIAFB5ABqKQIANwMAIAIgASkCTDcDACABKAIIIQZB8ABBCBChASIBRQRAQfAAQQhBtKXAACgCACIAQQIgABsRAAAACyABIAY2AgggASAHNwMAIAEgAikDIDcCDCABQRRqIAJBKGopAwA3AgAgAUEcaiACQTBqKQMANwIAIAFBJGogAkE4aikDADcCACABQSxqIAJBQGspAwA3AgAgAUE0aiACQcgAaikDADcCACABQTxqIAJB0ABqKQMANwIAIAFBxABqIAJB2ABqKQMANwIAIAFB5ABqIAUpAwA3AgAgAUHcAGogBCkDADcCACABQdQAaiADKQMANwIAIAEgAikDADcCTCAAQYSRwAA2AgQgACABNgIAIAJB4ABqJAALyAICBH8BfiMAQeAAayICJAAgAkHQAGoiAyABQRBqKQMANwMAIAJB2ABqIgQgAUEYaigCADYCACACIAEpAwg3A0ggASkDACEGIAJBCGogAUEgahBlIAEoAhwhBUHgAEEIEKEBIgFFBEBB4ABBCEG0pcAAKAIAIgBBAiAAGxEAAAALIAEgBjcDACABIAIpA0g3AwggASAFNgIcIAEgAikDCDcDICABQRBqIAMpAwA3AwAgAUEYaiAE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BrIgQkAEEnIQICQCAAQpDOAFQEQCAAIQcMAQsDQCAEQQlqIAJqIgNBfGogACAAQpDOAIAiB0LwsX9+fKciBUH//wNxQeQAbiIGQQF0QdqIwABqLwAAOwAAIANBfmogBkGcf2wgBWpB//8DcUEBdEHaiMAAai8AADsAACACQXxqIQIgAEL/wdcvViAHIQANAAsLIAenIgNB4wBKBEAgAkF+aiICIARBCWpqIAenIgVB//8DcUHkAG4iA0Gcf2wgBWpB//8DcUEBdEHaiMAAai8AADsAAAsCQCADQQpOBEAgAkF+aiICIARBCWpqIANBAXRB2ojAAGovAAA7AAAMAQsgAkF/aiICIARBCWpqIANBMGo6AAALIAFByKDAAEEAIARBCWogAmpBJyACaxAYIARBMGokAAu/AgEDfyMAQRBrIgIkAAJAIAAoAgAiAAJ/AkAgAUGAAU8EQCACQQA2AgwgAUGAEEkNASABQYCABEkEQCACIAFBP3FBgAFyOgAOIAIgAUEMdkHgAXI6AAwgAiABQQZ2QT9xQYABcjoADUEDDAMLIAIgAUE/cUGAAXI6AA8gAiABQRJ2QfABcjoADCACIAFBBnZBP3FBgAFyOgAOIAIgAUEMdkE/cUGAAXI6AA1BBAwCCyAAKAIIIgMgAEEEaigCAEYEfyAAQQEQaiAAKAIIBSADCyAAKAIAaiABOgAAIAAgACgCCEEBajYCCAwCCyACIAFBP3FBgAFyOgANIAIgAUEGdkHAAXI6AAxBAgsiARBqIABBCGoiAygCACIEIAAoAgBqIAJBDGogARCLARogAyABIARqNgIACyACQRBqJABBAAvLAgEIfyMAQYABayIBQShqIgJCADcDACABQSBqIgNCADcDACABQRhqIgRCADcDACABQRBqIgVCADcDACABQQhqIgZCADcDACABQgA3AwAgAUHaAGpCADcBACABQeIAakEAOwEAIAFBEDYCUCABQQA7AVQgAUEANgFWIAFB+ABqIAFB4ABqKAIANgIAIAFB8ABqIAFB2ABqKQMANwMAIAFByABqIgcgAUH0AGopAgA3AwAgASABKQNQNwNoIAEgASkCbDcDQCABQThqIgggBykDADcDACABIAEpA0A3AzAgAEHMAGogCCkDADcAACAAQcQAaiABKQMwNwAAIABBPGogAikDADcAACAAQTRqIAMpAwA3AAAgAEEsaiAEKQMANwAAIABBJGogBSkDADcAACAAQRxqIAYpAwA3AAAgACABKQMANwAUIABBADYCAAuxAgEDfyMAQYABayIEJAAgACgCACEAAkACQAJ/AkAgASgCACIDQRBxRQRAIAAoAgAhAiADQSBxDQEgAq0gARBVDAILIAAoAgAhAkEAIQADQCAAIARqQf8AaiACQQ9xIgNBMHIgA0HXAGogA0EKSRs6AAAgAEF/aiEAIAJBBHYiAg0ACyAAQYABaiICQYEBTw0CIAFB2IvAAEECIAAgBGpBgAFqQQAgAGsQGAwBC0EAIQADQCAAIARqQf8AaiACQQ9xIgNBMHIgA0E3aiADQQpJGzoAACAAQX9qIQAgAkEEdiICDQALIABBgAFqIgJBgQFPDQIgAUHYi8AAQQIgACAEakGAAWpBACAAaxAYCyAEQYABaiQADwsgAkGAAUHIi8AAEH4ACyACQYABQciLwAAQfgALrAICA38CfiAAIAApAwAiBiACrUIDhnwiBzcDACAAQQhqIgMgAykDACAHIAZUrXw3AwACQAJAQYABIAAoAlAiA2siBCACTQRAIABBEGoiBSADBEAgA0GBAU8NAiADIABB1ABqIgNqIAEgBBCLARogAEEANgJQIAUgA0EBEAwgAiAEayECIAEgBGohAQsgASACQQd2EAwgAkH/AHEiA0GBAU8NAiAAQdQAaiABIAJBgH9xaiADEIsBGiAAIAM2AlAPCwJAIAIgA2oiBCADTwRAIARBgAFLDQEgACADakHUAGogASACEIsBGiAAIAAoAlAgAmo2AlAPCyADIARB0JnAABB+AAsgBEGAAUHQmcAAEH0ACyADQYABQeCZwAAQfgALIANBgAFB8JnAABB9AAu8AgIFfwF+IABBIGohAyAAQQhqIQQgACkDACEHAkACQCAAKAIcIgJBwABGBEAgBCADEAdBACECIABBADYCHAwBCyACQT9LDQELIABBHGoiBSACakEEakGAAToAACAAIAAoAhwiBkEBaiICNgIcAkAgAkHBAEkEQCACIAVqQQRqQQBBPyAGaxCRARpBwAAgACgCHGtBB00EQCAEIAMQByAAKAIcIgJBwQBPDQIgAEEgakEAIAIQkQEaCyAAQdgAaiAHQgOGNwIAIAQgAxAHIABBADYCHCABIAAoAgg2AAAgASAAQQxqKAIANgAEIAEgAEEQaigCADYACCABIABBFGooAgA2AAwgASAAQRhqKAIANgAQDwsgAkHAAEGAmsAAEH4ACyACQcAAQZCawAAQfQALIAJBwABBoJrAABB8AAu1AgEDfyMAQRBrIgQkACAAKALIASICQccATQRAIAAgAmpBzAFqQQY6AAAgAkEBaiIDQcgARwRAIAAgA2pBzAFqQQBBxwAgAmsQkQEaC0EAIQIgAEEANgLIASAAQZMCaiIDIAMtAABBgAFyOgAAA0AgACACaiIDIAMtAAAgA0HMAWotAABzOgAAIAJBAWoiAkHIAEcNAAsgABAOIAEgACkAADcAACABQThqIABBOGopAAA3AAAgAUEwaiAAQTBqKQAANwAAIAFBKGogAEEoaikAADcAACABQSBqIABBIGopAAA3AAAgAUEYaiAAQRhqKQAANwAAIAFBEGogAEEQaikAADcAACABQQhqIABBCGopAAA3AAAgBEEQaiQADwtBsJrAAEEXIARBCGpByJrAAEGknsAAEHkAC7UCAQN/IwBBEGsiBCQAIAAoAsgBIgJBxwBNBEAgACACakHMAWpBAToAACACQQFqIgNByABHBEAgACADakHMAWpBAEHHACACaxCRARoLQQAhAiAAQQA2AsgBIABBkwJqIgMgAy0AAEGAAXI6AAADQCAAIAJqIgMgAy0AACADQcwBai0AAHM6AAAgAkEBaiICQcgARw0ACyAAEA4gASAAKQAANwAAIAFBOGogAEE4aikAADcAACABQTBqIABBMGopAAA3AAAgAUEoaiAAQShqKQAANwAAIAFBIGogAEEgaikAADcAACABQRhqIABBGGopAAA3AAAgAUEQaiAAQRBqKQAANwAAIAFBCGogAEEIaikAADcAACAEQRBqJAAPC0GwmsAAQRcgBEEIakHImsAAQeSdwAAQeQALswICBX8BfiAAQQxqIQMgAEHMAGohBCAAKQMAIQcCQAJAIAAoAggiAkH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JBCGoiAyABQdQAaikCADcDACACIAEpAkw3AwAgASgCCCEEQeAAQQgQoQEiAUUEQEHgAEEIQbSlwAAoAgAiAEECIAAbEQAAAAsgASAENgIIIAEgBTcDACABIAIpAxA3AgwgAUEUaiACQRhqKQMANwIAIAFBHGogAkEgaikDADcCACABQSRqIAJBKGopAwA3AgAgAUEsaiACQTBqKQMANwIAIAFBNGogAkE4aikDADcCACABQTxqIAJBQGspAwA3AgAgAUHEAGogAkHIAGopAwA3AgAgAUHUAGogAykDADcCACABIAIpAwA3AkwgAEG8jMAANgIEIAAgATYCACACQdAAaiQAC4gCAQN/IAAgACkDACACrXw3AwACQAJAQcAAIAAoAhwiA2siBCACTQRAIABBCGoiBSADBEAgA0HBAE8NAiADIABBIGoiA2ogASAEEIsBGiAAQQA2AhwgBSADQQEQCCACIARrIQIgASAEaiEBCyABIAJBBnYQCCACQT9xIgNBwQBPDQIgAEEgaiABIAJBQHFqIAMQiwEaIAAgAzYCHA8LAkAgAiADaiIEIANPBEAgBEHAAEsNASAAIANqQSBqIAEgAhCLARogACAAKAIcIAJqNgIcDwsgAyAEQdCZwAAQfgALIARBwABB0JnAABB9AAsgA0HAAEHgmcAAEH4ACyADQcAAQfCZwAAQfQALqAICA38BfiMAQdAAayICJAAgASkDACEFIAJBEGogAUEMahBlIAJBCGoiAyABQdQAaikCADcDACACIAEpAkw3AwAgASgCCCEEQeAAQQgQoQEiAUUEQEHgAEEIQbSlwAAoAgAiAEECIAAbEQAAAAsgASAENgIIIAEgBTcDACABIAIpAxA3AgwgAUEUaiACQRhqKQMANwIAIAFBHGogAkEgaikDADcCACABQSRqIAJBKGopAwA3AgAgAUEsaiACQTBqKQMANwIAIAFBNGogAkE4aikDADcCACABQTxqIAJBQGspAwA3AgAgAUHEAGogAkHIAGopAwA3AgAgAUHUAGogAykDADcCACABIAIpAwA3AkwgAEGokcAANgIEIAAgATYCACACQdAAaiQAC5UCAQN/IwBBEGsiBCQAIAAoAsgBIgJB5wBNBEAgACACakHMAWpBBjoAACACQQFqIgNB6ABHBEAgACADakHMAWpBAEHnACACaxCRARoLQQAhAiAAQQA2AsgBIABBswJqIgMgAy0AAEGAAXI6AAADQCAAIAJqIgMgAy0AACADQcwBai0AAHM6AAAgAkEBaiICQegARw0ACyAAEA4gASAAKQAANwAAIAFBKGogAEEoaikAADcAACABQSBqIABBIGopAAA3AAAgAUEYaiAAQRhqKQAANwAAIAFBEGogAEEQaikAADcAACABQQhqIABBCGopAAA3AAAgBEEQaiQADwtBsJrAAEEXIARBCGpByJrAAEGUnsAAEHkAC5UCAQN/IwBBEGsiBCQAIAAoAsgBIgJB5wBNBEAgACACakHMAWpBAToAACACQQFqIgNB6ABHBEAgACADakHMAWpBAEHnACACaxCRARoLQQAhAiAAQQA2AsgBIABBswJqIgMgAy0AAEGAAXI6AAADQCAAIAJqIgMgAy0AACADQcwBai0AAHM6AAAgAkEBaiICQegARw0ACyAAEA4gASAAKQAANwAAIAFBKGogAEEoaikAADcAACABQSBqIABBIGopAAA3AAAgAUEYaiAAQRhqKQAANwAAIAFBEGogAEEQaikAADcAACABQQhqIABBCGopAAA3AAAgBEEQaiQADwtBsJrAAEEXIARBCGpByJrAAEHUncAAEHkAC/MBAQR/IwBBkAFrIgIkACACQQA2AgAgAkEEciEFA0AgAyAFaiABIANqLQAAOgAAIAIgAigCAEEBaiIENgIAIANBAWoiA0HAAEcNAAsgBEE/TQRAIARBwAAQfwALIAJByABqIAJBxAAQiwEaIABBOGogAkGEAWopAgA3AAAgAEEwaiACQfwAaikCADcAACAAQShqIAJB9ABqKQIANwAAIABBIGogAkHsAGopAgA3AAAgAEEYaiACQeQAaikCADcAACAAQRBqIAJB3ABqKQIANwAAIABBCGogAkHUAGopAgA3AAAgACACKQJMNwAAIAJBkAFqJAAL9QEBA38jAEEQayIEJAAgACgCyAEiAkGHAU0EQCAAIAJqQcwBakEBOgAAIAJBAWoiA0GIAUcEQCAAIANqQcwBakEAQYcBIAJrEJEBGgtBACECIABBADYCyAEgAEHTAmoiAyADLQAAQYABcjoAAANAIAAgAmoiAyADLQAAIANBzAFqLQAAczoAACACQQFqIgJBiAFHDQALIAAQDiABIAApAAA3AAAgAUEYaiAAQRhqKQAANwAAIAFBEGogAEEQaikAADcAACABQQhqIABBCGopAAA3AAAgBEEQaiQADwtBsJrAAEEXIARBCGpByJrAAEHEncAAEHkAC/UBAQN/IwBBEGsiBCQAIAAoAsgBIgJBhwFNBEAgACACakHMAWpBBjoAACACQQFqIgNBiAFHBEAgACADakHMAWpBAEGHASACaxCRARoLQQAhAiAAQQA2AsgBIABB0wJqIgMgAy0AAEGAAXI6AAADQCAAIAJqIgMgAy0AACADQcwBai0AAHM6AAAgAkEBaiICQYgBRw0ACyAAEA4gASAAKQAANwAAIAFBGGogAEEYaikAADcAACABQRBqIABBEGopAAA3AAAgAUEIaiAAQQhqKQAANwAAIARBEGokAA8LQbCawABBFyAEQQhqQciawABBhJ7AABB5AAv1AQEDfyMAQRBrIgQkACAAKALIASICQY8BTQRAIAAgAmpBzAFqQQE6AAAgAkEBaiIDQZABRwRAIAAgA2pBzAFqQQBBjwEgAmsQkQEaC0EAIQIgAEEANgLIASAAQdsCaiIDIAMtAABBgAFyOgAAA0AgACACaiIDIAMtAAAgA0HMAWotAABzOgAAIAJBAWoiAkGQAUcNAAsgABAOIAEgACkAADcAACABQRhqIABBGGooAAA2AAAgAUEQaiAAQRBqKQAANwAAIAFBCGogAEEIaikAADcAACAEQRBqJAAPC0GwmsAAQRcgBEEIakHImsAAQdiawAAQeQAL9QEBA38jAEEQayIEJAAgACgCyAEiAkGPAU0EQCAAIAJqQcwBakEGOgAAIAJBAWoiA0GQAUcEQCAAIANqQcwBakEAQY8BIAJrEJEBGgtBACECIABBADYCyAEgAEHbAmoiAyADLQAAQYABcjoAAANAIAAgAmoiAyADLQAAIANBzAFqLQAAczoAACACQQFqIgJBkAFHDQALIAAQDiABIAApAAA3AAAgAUEYaiAAQRhqKAAANgAAIAFBEGogAEEQaikAADcAACABQQh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ECfyMAQdACayICJAAgAkGIAWogAUHIARCLARogAiABQcwBahBuIAEoAsgBIQNB2AJBCBChASIBRQRAQdgCQQhBtKXAACgCACIAQQIgABsRAAAACyABIAJBiAFqQcgBEIsBIgEgAzYCyAEgAUHMAWogAkGIARCLARogAEHAjsAANgIEIAAgATYCACACQdACaiQAC5MBAQJ/IwBBsAJrIgIkACACQegAaiABQcgBEIsBGiACIAFBzAFqEG0gASgCyAEhA0G4AkEIEKEBIgFFBEBBuAJBCEG0pcAAKAIAIgBBAiAAGxEAAAALIAEgAkHoAGpByAEQiwEiASADNgLIASABQcwBaiACQegAEIsBGiAAQeSOwAA2AgQgACABNgIAIAJBsAJqJAALkwEBAn8jAEGQAmsiAiQAIAJByABqIAFByAEQiwEaIAIgAUHMAWoQayABKALIASEDQZgCQQgQoQEiAUUEQEGYAkEIQbSlwAAoAgAiAEECIAAbEQAAAAsgASACQcgAakHIARCLASIBIAM2AsgBIAFBzAFqIAJByAAQiwEaIABBiI/AADYCBCAAIAE2AgAgAkGQAmokAAuTAQECfyMAQdACayICJAAgAkGIAWogAUHIARCLARogAiABQcwBahBuIAEoAsgBIQNB2AJBCBChASIBRQRAQdgCQQhBtKXAACgCACIAQQIgABsRAAAACyABIAJBiAFqQcgBEIsBIgEgAzYCyAEgAUHMAWogAkGIARCLARogAEGsj8AANgIEIAAgATYCACACQdACaiQAC34BAX8jAEFAaiIFJAAgBSABNgIMIAUgADYCCCAFIAM2AhQgBSACNgIQIAVBLGpBAjYCACAFQTxqQQQ2AgAgBUICNwIcIAVB8IvAADYCGCAFQQE2AjQgBSAFQTBqNgIoIAUgBUEQajYCOCAFIAVBCGo2AjAgBUEYaiAEEJABAAuVAQAgAEIANwMIIABCADcDACAAQQA2AlAgAEGQmcAAKQMANwMQIABBGGpBmJnAACkDADcDACAAQSBqQaCZwAApAwA3AwAgAEEoakGomcAAKQMANwMAIABBMGpBsJnAACkDADcDACAAQThqQbiZwAApAwA3AwAgAEFAa0HAmcAAKQMANwMAIABByABqQciZwAApAwA3AwALlQEAIABCADcDCCAAQgA3AwAgAEEANgJQIABB0JjAACkDADcDECAAQRhqQdiYwAApAwA3AwAgAEEgakHgmMAAKQMANwMAIABBKGpB6JjAACkDADcDACAAQTBqQfCYwAApAwA3AwAgAEE4akH4mMAAKQMANwMAIABBQGtBgJnAACkDADcDACAAQcgAakGImcAAKQMANwMAC20BAX8jAEEwayIDJAAgAyABNgIEIAMgADYCACADQRxqQQI2AgAgA0EsakEFNgIAIANCAjcCDCADQYiIwAA2AgggA0EFNgIkIAMgA0EgajYCGCADIAM2AiggAyADQQRqNgIgIANBCGogAhCQAQALbQEBfyMAQTBrIgMkACADIAE2AgQgAyAANgIAIANBHGpBAjYCACADQSxqQQU2AgAgA0ICNwIMIANBpIrAADYCCCADQQU2AiQgAyADQSBqNgIYIAMgA0EEajYCKCADIAM2AiAgA0EIaiACEJABAAttAQF/IwBBMGsiAyQAIAMgATYCBCADIAA2AgAgA0EcakECNgIAIANBLGpBBTYCACADQgI3AgwgA0HcisAANgIIIANBBTYCJCADIANBIGo2AhggAyADQQRqNgIoIAMgAzYCICADQQhqIAIQkAEAC3ABAX8jAEEwayICJAAgAiABNgIEIAIgADYCACACQRxqQQI2AgAgAkEsakEFNgIAIAJCAjcCDCACQcyRwAA2AgggAkEFNgIkIAIgAkEgajYCGCACIAJBBGo2AiggAiACNgIgIAJBCGpB3JHAABCQAQALVAEBfyMAQSBrIgIkACACIAAoAgA2AgQgAkEYaiABQRBqKQIANwMAIAJBEGogAUEIaikCADcDACACIAEpAgA3AwggAkEEaiACQQhqEBYgAkEgaiQAC30BAn9BASEAQeChwABB4KHAACgCAEEBajYCAAJAAkBBqKXAACgCAEEBRwRAQailwABCgYCAgBA3AwAMAQtBrKXAAEGspcAAKAIAQQFqIgA2AgAgAEECSw0BC0GwpcAAKAIAIgFBf0wNAEGwpcAAIAE2AgAgAEEBSw0AAAsAC2ICAX8BfiMAQRBrIgIkAAJAIAEEQCABKAIADQEgAUF/N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DACAAQQA2AhwgAEH4l8AAKQMANwMIIABBEGpBgJjAACkDADcDACAAQRhqQYiYwAAoAgA2AgALPQAgAEEANgIcIABCADcDACAAQRhqQYiYwAAoAgA2AgAgAEEQakGAmMAAKQMANwMAIABB+JfAACkDADcDCAtMAQF/IwBBEGsiAiQAIAIgATYCDCACIAA2AgggAkGYiMAANgIEIAJByKDAADYCACACKAIIRQRAQZ2gwABBK0HIoMAAEIgBAAsQgQEACykBAX8gAgRAIAAhAwNAIAMgAToAACADQQFqIQMgAkF/aiICDQALCyAACy4AIABBADYCCCAAQgA3AwAgAEHUAGpByJfAACkCADcCACAAQcCXwAApAgA3AkwLIAACQCABQXxLDQAgACABQQQgAhCaASIARQ0AIAAPCwALHAAgASgCGEH/h8AAQQggAUEcaigCACgCDBEDAAscACABKAIYQYKMwABBBSABQRxqKAIAKAIMEQMACxQAIAAoAgAgASAAKAIEKAIMEQEACxAAIAEgACgCACAAKAIEEBILEgAgAEEAQcgBEJEBQQA2AsgBCwsAIAEEQCAAEBALCwwAIAAgASACIAMQFwsSAEHEhsAAQRFB2IbAABCIAQALDgAgACgCABoDQAwACwALDQBB76DAAEEbEKABAAsOAEGKocAAQc8AEKABAAsLACAANQIAIAEQVQsJACAAIAEQAQALGQACfyABQQlPBEAgASAAEEYMAQsgABAJCwsNAEKtqduM/5imovgACwQAQRALBABBKAsEAEEUCwUAQcAACwQAQTALBABBHAsEAEEgCwMAAQsDAAELC+MhAQBBgIDAAAvZIW1kMgAHAAAAVAAAAAQAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAABtZDQABwAAAGAAAAAIAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAbWQ1AAcAAABgAAAACAAAABQAAAAVAAAAFgAAABEAAAASAAAAFwAAAHJpcGVtZDE2MAAAAAcAAABgAAAACAAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAHJpcGVtZDMyMAAAAAcAAAB4AAAACAAAAB4AAAAfAAAAIAAAACEAAAAiAAAA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RlY3RlZCB3aGljaCB3b3VsZCBsZWFkIHRvIHVuc2FmZSBhbGlhc2luZyBpbiBydXN0AHsJcHJvZHVjZXJzAghsYW5ndWFnZQEEUnVzdAAMcHJvY2Vzc2VkLWJ5AwVydXN0Yx0xLjQ2LjAgKDA0NDg4YWZlMyAyMDIwLTA4LTI0KQZ3YWxydXMGMC4xOC4wDHdhc20tYmluZGdlbhIwLjIuNjggKGEwNGUxODk3MSk="); -let wasm; - -let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachegetUint8Memory0 = null; -function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); - } - return cachegetUint8Memory0; -} - -function getStringFromWasm0(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); -} - -const heap = new Array(32).fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function getObject(idx) { return heap[idx]; } - -function dropObject(idx) { - if (idx < 36) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - -let WASM_VECTOR_LEN = 0; - -let cachedTextEncoder = new TextEncoder('utf-8'); - -const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' - ? function (arg, view) { - return cachedTextEncoder.encodeInto(arg, view); -} - : function (arg, view) { - const buf = cachedTextEncoder.encode(arg); - view.set(buf); - return { - read: arg.length, - written: buf.length - }; -}); - -function passStringToWasm0(arg, malloc, realloc) { - - if (realloc === undefined) { - const buf = cachedTextEncoder.encode(arg); - const ptr = malloc(buf.length); - getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); - WASM_VECTOR_LEN = buf.length; - return ptr; - } - - let len = arg.length; - let ptr = malloc(len); - - const mem = getUint8Memory0(); - - let offset = 0; - - for (; offset < len; offset++) { - const code = arg.charCodeAt(offset); - if (code > 0x7F) break; - mem[ptr + offset] = code; - } - - if (offset !== len) { - if (offset !== 0) { - arg = arg.slice(offset); - } - ptr = realloc(ptr, len, len = offset + arg.length * 3); - const view = getUint8Memory0().subarray(ptr + offset, ptr + len); - const ret = encodeString(arg, view); - - offset += ret.written; - } - - WASM_VECTOR_LEN = offset; - return ptr; -} -/** -* @param {string} algorithm -* @returns {DenoHash} -*/ -export function create_hash(algorithm) { - var ptr0 = passStringToWasm0(algorithm, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - var ret = wasm.create_hash(ptr0, len0); - return DenoHash.__wrap(ret); -} - -function _assertClass(instance, klass) { - if (!(instance instanceof klass)) { - throw new Error(`expected instance of ${klass.name}`); - } - return instance.ptr; -} - -function passArray8ToWasm0(arg, malloc) { - const ptr = malloc(arg.length * 1); - getUint8Memory0().set(arg, ptr / 1); - WASM_VECTOR_LEN = arg.length; - return ptr; -} -/** -* @param {DenoHash} hash -* @param {Uint8Array} data -*/ -export function update_hash(hash, data) { - _assertClass(hash, DenoHash); - var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc); - var len0 = WASM_VECTOR_LEN; - wasm.update_hash(hash.ptr, ptr0, len0); -} - -let cachegetInt32Memory0 = null; -function getInt32Memory0() { - if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { - cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); - } - return cachegetInt32Memory0; -} - -function getArrayU8FromWasm0(ptr, len) { - return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); -} -/** -* @param {DenoHash} hash -* @returns {Uint8Array} -*/ -export function digest_hash(hash) { - try { - const retptr = wasm.__wbindgen_export_2.value - 16; - wasm.__wbindgen_export_2.value = retptr; - _assertClass(hash, DenoHash); - wasm.digest_hash(retptr, hash.ptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var v0 = getArrayU8FromWasm0(r0, r1).slice(); - wasm.__wbindgen_free(r0, r1 * 1); - return v0; - } finally { - wasm.__wbindgen_export_2.value += 16; - } -} - -/** -*/ -export class DenoHash { - - static __wrap(ptr) { - const obj = Object.create(DenoHash.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_denohash_free(ptr); - } -} - -async function load(module, imports) { - if (typeof Response === 'function' && module instanceof Response) { - - if (typeof WebAssembly.instantiateStreaming === 'function') { - try { - return await WebAssembly.instantiateStreaming(module, imports); - - } catch (e) { - if (module.headers.get('Content-Type') != 'application/wasm') { - console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - - } else { - throw e; - } - } - } - - const bytes = await module.arrayBuffer(); - return await WebAssembly.instantiate(bytes, imports); - - } else { - - const instance = await WebAssembly.instantiate(module, imports); - - if (instance instanceof WebAssembly.Instance) { - return { instance, module }; - - } else { - return instance; - } - } -} - -async function init(input) { - if (typeof input === 'undefined') { - input = import.meta.url.replace(/\.js$/, '_bg.wasm'); - } - const imports = {}; - imports.wbg = {}; - imports.wbg.__wbindgen_string_new = function(arg0, arg1) { - var ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); - }; - imports.wbg.__wbindgen_rethrow = function(arg0) { - throw takeObject(arg0); - }; - - if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { - input = fetch(input); - } - - const { instance, module } = await load(await input, imports); - - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - - return wasm; -} - -export default init; - diff --git a/crates/swc_bundler/tests/.cache/deno/0c7a0d6c694f85dee0238660c0f31e7e2fd20633.ts b/crates/swc_bundler/tests/.cache/deno/0c7a0d6c694f85dee0238660c0f31e7e2fd20633.ts deleted file mode 100644 index b0706c60414c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0c7a0d6c694f85dee0238660c0f31e7e2fd20633.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/discovery/validate_discovery_search_term_params.ts - - -// TODO: add docs link -export interface ValidateDiscoverySearchTermParams { - /** The search term to check */ - term: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0c7ae39177272e7cc7929cdc37af066f08d303eb.ts b/crates/swc_bundler/tests/.cache/deno/0c7ae39177272e7cc7929cdc37af066f08d303eb.ts deleted file mode 100644 index 86cc874fe57e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0c7ae39177272e7cc7929cdc37af066f08d303eb.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_xmap.js - - -import _curry2 from './_curry2.js'; -import _xfBase from './_xfBase.js'; - - -function XMap(f, xf) { - this.xf = xf; - this.f = f; -} -XMap.prototype['@@transducer/init'] = _xfBase.init; -XMap.prototype['@@transducer/result'] = _xfBase.result; -XMap.prototype['@@transducer/step'] = function(result, input) { - return this.xf['@@transducer/step'](result, this.f(input)); -}; - -var _xmap = _curry2(function _xmap(f, xf) { return new XMap(f, xf); }); -export default _xmap; diff --git a/crates/swc_bundler/tests/.cache/deno/0c7c964a9fa6eb6c0d13fa7542363da68da91e1e.ts b/crates/swc_bundler/tests/.cache/deno/0c7c964a9fa6eb6c0d13fa7542363da68da91e1e.ts deleted file mode 100644 index 1e85d5920a9f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0c7c964a9fa6eb6c0d13fa7542363da68da91e1e.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/io/writers.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -type Writer = Deno.Writer; -type WriterSync = Deno.WriterSync; -import { decode, encode } from "../encoding/utf8.ts"; - -/** Writer utility for buffering string chunks */ -export class StringWriter implements Writer, WriterSync { - private chunks: Uint8Array[] = []; - private byteLength = 0; - private cache: string | undefined; - - constructor(private base: string = "") { - const c = encode(base); - this.chunks.push(c); - this.byteLength += c.byteLength; - } - - write(p: Uint8Array): Promise { - return Promise.resolve(this.writeSync(p)); - } - - writeSync(p: Uint8Array): number { - this.chunks.push(p); - this.byteLength += p.byteLength; - this.cache = undefined; - return p.byteLength; - } - - toString(): string { - if (this.cache) { - return this.cache; - } - const buf = new Uint8Array(this.byteLength); - let offs = 0; - for (const chunk of this.chunks) { - buf.set(chunk, offs); - offs += chunk.byteLength; - } - this.cache = decode(buf); - return this.cache; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0ccc1e4f8ec7667a215d3cfe848bd04fab48ecea.ts b/crates/swc_bundler/tests/.cache/deno/0ccc1e4f8ec7667a215d3cfe848bd04fab48ecea.ts deleted file mode 100644 index 6b720fb7edf7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0ccc1e4f8ec7667a215d3cfe848bd04fab48ecea.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/ansi/deps.ts - - -export { - encode as encodeBase64, -} from "https://deno.land/std@0.89.0/encoding/base64.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/0cd7f74af998eea7ac9eb8d676fe7ebf85a2f5cf.ts b/crates/swc_bundler/tests/.cache/deno/0cd7f74af998eea7ac9eb8d676fe7ebf85a2f5cf.ts deleted file mode 100644 index a71e48d4dc3f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0cd7f74af998eea7ac9eb8d676fe7ebf85a2f5cf.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/drop.js - - -import _curry2 from './internal/_curry2.js'; -import _dispatchable from './internal/_dispatchable.js'; -import _xdrop from './internal/_xdrop.js'; -import slice from './slice.js'; - - -/** - * Returns all but the first `n` elements of the given list, string, or - * transducer/transformer (or object with a `drop` method). - * - * Dispatches to the `drop` method of the second argument, if present. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Number -> [a] -> [a] - * @sig Number -> String -> String - * @param {Number} n - * @param {*} list - * @return {*} A copy of list without the first `n` elements - * @see R.take, R.transduce, R.dropLast, R.dropWhile - * @example - * - * R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] - * R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz'] - * R.drop(3, ['foo', 'bar', 'baz']); //=> [] - * R.drop(4, ['foo', 'bar', 'baz']); //=> [] - * R.drop(3, 'ramda'); //=> 'da' - */ -var drop = _curry2(_dispatchable(['drop'], _xdrop, function drop(n, xs) { - return slice(Math.max(0, n), Infinity, xs); -})); -export default drop; diff --git a/crates/swc_bundler/tests/.cache/deno/0cdc36c0fbd42779e71f6f7280e4c0fdfe8276cb.ts b/crates/swc_bundler/tests/.cache/deno/0cdc36c0fbd42779e71f6f7280e4c0fdfe8276cb.ts deleted file mode 100644 index 5509b23793ab..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0cdc36c0fbd42779e71f6f7280e4c0fdfe8276cb.ts +++ /dev/null @@ -1,325 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/command/completions/_zsh_completions_generator.ts - - -import type { Command } from "../command.ts"; -import type { IArgument, IOption } from "../types.ts"; - -interface ICompletionAction { - arg: IArgument; - label: string; - name: string; - cmd: string; -} - -/** Generates zsh completions script. */ -export class ZshCompletionsGenerator { - private actions: Map = new Map(); - - /** Generates zsh completions script for given command. */ - public static generate(cmd: Command) { - return new ZshCompletionsGenerator(cmd).generate(); - } - - private constructor(protected cmd: Command) {} - - /** Generates zsh completions code. */ - private generate(): string { - const path = this.cmd.getPath(); - const name = this.cmd.getName(); - const version: string | undefined = this.cmd.getVersion() - ? ` v${this.cmd.getVersion()}` - : ""; - - return `#!/usr/bin/env zsh -# zsh completion support for ${path}${version} - -autoload -U is-at-least - -# shellcheck disable=SC2154 -(( $+functions[__${replaceSpecialChars(name)}_complete] )) || -function __${replaceSpecialChars(name)}_complete { - local name="$1"; shift - local action="$1"; shift - integer ret=1 - local -a values - local expl lines - _tags "$name" - while _tags; do - if _requested "$name"; then - # shellcheck disable=SC2034 - lines="$(${name} completions complete "\${action}" "\${@}")" - values=("\${(ps:\\n:)lines}") - if (( \${#values[@]} )); then - while _next_label "$name" expl "$action"; do - compadd -S '' "\${expl[@]}" "\${values[@]}" - done - fi - fi - done -} - -${this.generateCompletions(this.cmd).trim()} - -# _${replaceSpecialChars(path)} "\${@}" - -compdef _${replaceSpecialChars(path)} ${path} - -`; - } - - /** Generates zsh completions method for given command and child commands. */ - private generateCompletions(command: Command, path = ""): string { - if ( - !command.hasCommands(false) && !command.hasOptions(false) && - !command.hasArguments() - ) { - return ""; - } - - path = (path ? path + " " : "") + command.getName(); - - return `# shellcheck disable=SC2154 -(( $+functions[_${replaceSpecialChars(path)}] )) || -function _${replaceSpecialChars(path)}() {` + - (!command.getParent() - ? ` - local state` - : "") + - this.generateCommandCompletions(command, path) + - this.generateSubCommandCompletions(command, path) + - this.generateArgumentCompletions(command, path) + - this.generateActions(command) + - `\n}\n\n` + - command.getCommands(false) - .filter((subCommand: Command) => subCommand !== command) - .map((subCommand: Command) => - this.generateCompletions(subCommand, path) - ) - .join(""); - } - - private generateCommandCompletions(command: Command, path: string): string { - const commands = command.getCommands(false); - - let completions: string = commands - .map((subCommand: Command) => - `'${subCommand.getName()}:${subCommand.getShortDescription()}'` - ) - .join("\n "); - - if (completions) { - completions = ` - local -a commands - # shellcheck disable=SC2034 - commands=( - ${completions} - ) - _describe 'command' commands`; - } - - if (command.hasArguments()) { - const completionsPath: string = path.split(" ").slice(1).join(" "); - // @TODO: support multiple arguments zsh completions - const arg: IArgument = command.getArguments()[0]; - const action = this.addAction(arg, completionsPath); - if (action && command.getCompletion(arg.action)) { - completions += `\n __${ - replaceSpecialChars(this.cmd.getName()) - }_complete ${action.arg.name} ${action.arg.action} ${action.cmd}`; - } - } - - if (completions) { - completions = `\n\n function _commands() {${completions}\n }`; - } - - return completions; - } - - private generateSubCommandCompletions( - command: Command, - path: string, - ): string { - if (command.hasCommands(false)) { - const actions: string = command - .getCommands(false) - .map((command: Command) => - `${command.getName()}) _${ - replaceSpecialChars(path + " " + command.getName()) - } ;;` - ) - .join("\n "); - - return `\n - function _command_args() { - case "\${words[1]}" in\n ${actions}\n esac - }`; - } - - return ""; - } - - private generateArgumentCompletions(command: Command, path: string): string { - /* clear actions from previously parsed command. */ - this.actions.clear(); - - const options: string[] = this.generateOptions(command, path); - - let argIndex = 0; - // @TODO: add stop early option: -A "-*" - // http://zsh.sourceforge.net/Doc/Release/Completion-System.html - let argsCommand = "\n\n _arguments -w -s -S -C"; - - if (command.hasOptions()) { - argsCommand += ` \\\n ${options.join(" \\\n ")}`; - } - - if ( - command.hasCommands(false) || ( - command.getArguments() - .filter((arg) => command.getCompletion(arg.action)).length - ) - ) { - argsCommand += ` \\\n '${++argIndex}: :_commands'`; - } - - if (command.hasArguments() || command.hasCommands(false)) { - const args: string[] = []; - - for (const arg of command.getArguments().slice(1)) { - const completionsPath: string = path.split(" ").slice(1).join(" "); - - const action = this.addAction(arg, completionsPath); - - args.push( - `${++argIndex}${arg.optionalValue ? "::" : ":"}${action.name}`, - ); - } - - argsCommand += args.map((arg: string) => `\\\n '${arg}'`).join(""); - - if (command.hasCommands(false)) { - argsCommand += ` \\\n '*:: :->command_args'`; - } - } - - return argsCommand; - } - - private generateOptions(command: Command, path: string) { - const options: string[] = []; - const cmdArgs: string[] = path.split(" "); - const _baseName: string = cmdArgs.shift() as string; - const completionsPath: string = cmdArgs.join(" "); - - const excludedFlags: string[] = command.getOptions(false) - .map((option) => option.standalone ? option.flags : false) - .flat() - .filter((flag) => typeof flag === "string") as string[]; - - for (const option of command.getOptions(false)) { - options.push(this.generateOption(option, completionsPath, excludedFlags)); - } - - return options; - } - - private generateOption( - option: IOption, - completionsPath: string, - excludedOptions: string[], - ): string { - const flags = option.flags; - let excludedFlags = option.conflicts?.length - ? [ - ...excludedOptions, - ...option.conflicts.map((opt) => "--" + opt.replace(/^--/, "")), - ] - : excludedOptions; - excludedFlags = option.collect ? excludedFlags : [ - ...excludedFlags, - ...flags, - ]; - - let args = ""; - for (const arg of option.args) { - const action = this.addAction(arg, completionsPath); - - if (arg.variadic) { - args += `${arg.optionalValue ? "::" : ":"}${arg.name}:->${action.name}`; - } else { - args += `${arg.optionalValue ? "::" : ":"}${arg.name}:->${action.name}`; - } - } - - let description: string = option.description - .trim() - .split("\n") - .shift() as string; - - // escape brackets and quotes - description = description - .replace(/\[/g, "\\[") - .replace(/]/g, "\\]") - .replace(/"/g, '\\"') - .replace(/'/g, "'\"'\"'"); - - const collect: string = option.collect ? "*" : ""; - - if (option.standalone) { - return `'(- *)'{${collect}${flags}}'[${description}]${args}'`; - } else { - const excluded: string = excludedFlags.length - ? `'(${excludedFlags.join(" ")})'` - : ""; - if (collect || flags.length > 1) { - return `${excluded}{${collect}${flags}}'[${description}]${args}'`; - } else { - return `${excluded}${flags}'[${description}]${args}'`; - } - } - } - - private addAction(arg: IArgument, cmd: string): ICompletionAction { - const action = `${arg.name}-${arg.action}`; - - if (!this.actions.has(action)) { - this.actions.set(action, { - arg: arg, - label: `${arg.name}: ${arg.action}`, - name: action, - cmd, - }); - } - - return this.actions.get(action) as ICompletionAction; - } - - private generateActions(command: Command): string { - let actions: string[] = []; - - if (this.actions.size) { - actions = Array - .from(this.actions) - .map(([name, action]) => - `${name}) __${ - replaceSpecialChars(this.cmd.getName()) - }_complete ${action.arg.name} ${action.arg.action} ${action.cmd} ;;` - ); - } - - if (command.hasCommands(false)) { - actions.unshift(`command_args) _command_args ;;`); - } - - if (actions.length) { - return `\n\n case "$state" in\n ${actions.join("\n ")}\n esac`; - } - - return ""; - } -} - -function replaceSpecialChars(str: string): string { - return str.replace(/[^a-zA-Z0-9]/g, "_"); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0cec2c496ae1ff3e1b5d55c14e0a1668ace7a495.ts b/crates/swc_bundler/tests/.cache/deno/0cec2c496ae1ff3e1b5d55c14e0a1668ace7a495.ts deleted file mode 100644 index edf7619cbe74..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0cec2c496ae1ff3e1b5d55c14e0a1668ace7a495.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/discordeno/interaction_response.ts - - -import { InteractionResponse } from "../interactions/interaction_response.ts"; - -export interface DiscordenoInteractionResponse extends InteractionResponse { - /** Set to true if the response should be private */ - private?: boolean; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0d07b97042b0ea4818087ca2b6e808496581bb52.ts b/crates/swc_bundler/tests/.cache/deno/0d07b97042b0ea4818087ca2b6e808496581bb52.ts deleted file mode 100644 index 5723fb983258..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d07b97042b0ea4818087ca2b6e808496581bb52.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/nodejsCustomInspectSymbol.js - - -/* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */ -const nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; -export default nodejsCustomInspectSymbol; \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/0d11afcb85ce307ca57356ebc5e83b4a32ca9cd7.ts b/crates/swc_bundler/tests/.cache/deno/0d11afcb85ce307ca57356ebc5e83b4a32ca9cd7.ts deleted file mode 100644 index f19cd4abdfbd..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d11afcb85ce307ca57356ebc5e83b4a32ca9cd7.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/std@0.73.0/path/_interface.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** This module is browser compatible. */ - -/** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ -export interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; -} - -export type FormatInputPathObject = Partial; diff --git a/crates/swc_bundler/tests/.cache/deno/0d13bad4776062d351b45fa0be0cc06239fbb9f1.ts b/crates/swc_bundler/tests/.cache/deno/0d13bad4776062d351b45fa0be0cc06239fbb9f1.ts deleted file mode 100644 index 079b71f361f1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d13bad4776062d351b45fa0be0cc06239fbb9f1.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/std@0.79.0/path/separator.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** This module is browser compatible. */ - -import { isWindows } from "../_util/os.ts"; - -export const SEP = isWindows ? "\\" : "/"; -export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/; diff --git a/crates/swc_bundler/tests/.cache/deno/0d23c5b9cc93892c0b3962151240a8fd65b69297.ts b/crates/swc_bundler/tests/.cache/deno/0d23c5b9cc93892c0b3962151240a8fd65b69297.ts deleted file mode 100644 index 0289173259d9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d23c5b9cc93892c0b3962151240a8fd65b69297.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Loaded from https://deno.land/std@0.89.0/io/writers.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -type Writer = Deno.Writer; -type WriterSync = Deno.WriterSync; - -/** Writer utility for buffering string chunks */ -export class StringWriter implements Writer, WriterSync { - private chunks: Uint8Array[] = []; - private byteLength = 0; - private cache: string | undefined; - - constructor(private base: string = "") { - const c = new TextEncoder().encode(base); - this.chunks.push(c); - this.byteLength += c.byteLength; - } - - write(p: Uint8Array): Promise { - return Promise.resolve(this.writeSync(p)); - } - - writeSync(p: Uint8Array): number { - this.chunks.push(p); - this.byteLength += p.byteLength; - this.cache = undefined; - return p.byteLength; - } - - toString(): string { - if (this.cache) { - return this.cache; - } - const buf = new Uint8Array(this.byteLength); - let offs = 0; - for (const chunk of this.chunks) { - buf.set(chunk, offs); - offs += chunk.byteLength; - } - this.cache = new TextDecoder().decode(buf); - return this.cache; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0d24ee36aec622d55db1ac9087c2eb045d25fd78.ts b/crates/swc_bundler/tests/.cache/deno/0d24ee36aec622d55db1ac9087c2eb045d25fd78.ts deleted file mode 100644 index 3071ecc92d0b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d24ee36aec622d55db1ac9087c2eb045d25fd78.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Loaded from https://deno.land/x/case/vendor/camelCaseUpperRegexp.ts - - -const camelCaseUpperRegexp: RegExp = - /([A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\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2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A])([A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A][a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u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212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A])/g; - -export default camelCaseUpperRegexp; diff --git a/crates/swc_bundler/tests/.cache/deno/0d46a97f5f1e7e868c2dffc8a349254afcb53f54.ts b/crates/swc_bundler/tests/.cache/deno/0d46a97f5f1e7e868c2dffc8a349254afcb53f54.ts deleted file mode 100644 index 854c656fa14d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d46a97f5f1e7e868c2dffc8a349254afcb53f54.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_xdropRepeatsWith.js - - -import _curry2 from './_curry2.js'; -import _xfBase from './_xfBase.js'; - - -function XDropRepeatsWith(pred, xf) { - this.xf = xf; - this.pred = pred; - this.lastValue = undefined; - this.seenFirstValue = false; -} - -XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init; -XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result; -XDropRepeatsWith.prototype['@@transducer/step'] = function(result, input) { - var sameAsLast = false; - if (!this.seenFirstValue) { - this.seenFirstValue = true; - } else if (this.pred(this.lastValue, input)) { - sameAsLast = true; - } - this.lastValue = input; - return sameAsLast ? result : this.xf['@@transducer/step'](result, input); -}; - -var _xdropRepeatsWith = _curry2(function _xdropRepeatsWith(pred, xf) { return new XDropRepeatsWith(pred, xf); }); -export default _xdropRepeatsWith; diff --git a/crates/swc_bundler/tests/.cache/deno/0d47e0f97f3400f94d64ddaea361b231dfec322a.ts b/crates/swc_bundler/tests/.cache/deno/0d47e0f97f3400f94d64ddaea361b231dfec322a.ts deleted file mode 100644 index aa7c403605cb..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d47e0f97f3400f94d64ddaea361b231dfec322a.ts +++ /dev/null @@ -1,721 +0,0 @@ -// Loaded from https://deno.land/std@0.83.0/io/bufio.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// Based on https://github.com/golang/go/blob/891682/src/bufio/bufio.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -type Reader = Deno.Reader; -type Writer = Deno.Writer; -type WriterSync = Deno.WriterSync; -import { copy } from "../bytes/mod.ts"; -import { assert } from "../_util/assert.ts"; - -const DEFAULT_BUF_SIZE = 4096; -const MIN_BUF_SIZE = 16; -const MAX_CONSECUTIVE_EMPTY_READS = 100; -const CR = "\r".charCodeAt(0); -const LF = "\n".charCodeAt(0); - -export class BufferFullError extends Error { - name = "BufferFullError"; - constructor(public partial: Uint8Array) { - super("Buffer full"); - } -} - -export class PartialReadError extends Deno.errors.UnexpectedEof { - name = "PartialReadError"; - partial?: Uint8Array; - constructor() { - super("Encountered UnexpectedEof, data only partially read"); - } -} - -/** Result type returned by of BufReader.readLine(). */ -export interface ReadLineResult { - line: Uint8Array; - more: boolean; -} - -/** BufReader implements buffering for a Reader object. */ -export class BufReader implements Reader { - private buf!: Uint8Array; - private rd!: Reader; // Reader provided by caller. - private r = 0; // buf read position. - private w = 0; // buf write position. - private eof = false; - // private lastByte: number; - // private lastCharSize: number; - - /** return new BufReader unless r is BufReader */ - static create(r: Reader, size: number = DEFAULT_BUF_SIZE): BufReader { - return r instanceof BufReader ? r : new BufReader(r, size); - } - - constructor(rd: Reader, size: number = DEFAULT_BUF_SIZE) { - if (size < MIN_BUF_SIZE) { - size = MIN_BUF_SIZE; - } - this._reset(new Uint8Array(size), rd); - } - - /** Returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - buffered(): number { - return this.w - this.r; - } - - // Reads a new chunk into the buffer. - private async _fill(): Promise { - // Slide existing data to beginning. - if (this.r > 0) { - this.buf.copyWithin(0, this.r, this.w); - this.w -= this.r; - this.r = 0; - } - - if (this.w >= this.buf.byteLength) { - throw Error("bufio: tried to fill full buffer"); - } - - // Read new data: try a limited number of times. - for (let i = MAX_CONSECUTIVE_EMPTY_READS; i > 0; i--) { - const rr = await this.rd.read(this.buf.subarray(this.w)); - if (rr === null) { - this.eof = true; - return; - } - assert(rr >= 0, "negative read"); - this.w += rr; - if (rr > 0) { - return; - } - } - - throw new Error( - `No progress after ${MAX_CONSECUTIVE_EMPTY_READS} read() calls`, - ); - } - - /** Discards any buffered data, resets all state, and switches - * the buffered reader to read from r. - */ - reset(r: Reader): void { - this._reset(this.buf, r); - } - - private _reset(buf: Uint8Array, rd: Reader): void { - this.buf = buf; - this.rd = rd; - this.eof = false; - // this.lastByte = -1; - // this.lastCharSize = -1; - } - - /** reads data into p. - * It returns the number of bytes read into p. - * The bytes are taken from at most one Read on the underlying Reader, - * hence n may be less than len(p). - * To read exactly len(p) bytes, use io.ReadFull(b, p). - */ - async read(p: Uint8Array): Promise { - let rr: number | null = p.byteLength; - if (p.byteLength === 0) return rr; - - if (this.r === this.w) { - if (p.byteLength >= this.buf.byteLength) { - // Large read, empty buffer. - // Read directly into p to avoid copy. - const rr = await this.rd.read(p); - const nread = rr ?? 0; - assert(nread >= 0, "negative read"); - // if (rr.nread > 0) { - // this.lastByte = p[rr.nread - 1]; - // this.lastCharSize = -1; - // } - return rr; - } - - // One read. - // Do not use this.fill, which will loop. - this.r = 0; - this.w = 0; - rr = await this.rd.read(this.buf); - if (rr === 0 || rr === null) return rr; - assert(rr >= 0, "negative read"); - this.w += rr; - } - - // copy as much as we can - const copied = copy(this.buf.subarray(this.r, this.w), p, 0); - this.r += copied; - // this.lastByte = this.buf[this.r - 1]; - // this.lastCharSize = -1; - return copied; - } - - /** reads exactly `p.length` bytes into `p`. - * - * If successful, `p` is returned. - * - * If the end of the underlying stream has been reached, and there are no more - * bytes available in the buffer, `readFull()` returns `null` instead. - * - * An error is thrown if some bytes could be read, but not enough to fill `p` - * entirely before the underlying stream reported an error or EOF. Any error - * thrown will have a `partial` property that indicates the slice of the - * buffer that has been successfully filled with data. - * - * Ported from https://golang.org/pkg/io/#ReadFull - */ - async readFull(p: Uint8Array): Promise { - let bytesRead = 0; - while (bytesRead < p.length) { - try { - const rr = await this.read(p.subarray(bytesRead)); - if (rr === null) { - if (bytesRead === 0) { - return null; - } else { - throw new PartialReadError(); - } - } - bytesRead += rr; - } catch (err) { - err.partial = p.subarray(0, bytesRead); - throw err; - } - } - return p; - } - - /** Returns the next byte [0, 255] or `null`. */ - async readByte(): Promise { - while (this.r === this.w) { - if (this.eof) return null; - await this._fill(); // buffer is empty. - } - const c = this.buf[this.r]; - this.r++; - // this.lastByte = c; - return c; - } - - /** readString() reads until the first occurrence of delim in the input, - * returning a string containing the data up to and including the delimiter. - * If ReadString encounters an error before finding a delimiter, - * it returns the data read before the error and the error itself - * (often `null`). - * ReadString returns err != nil if and only if the returned data does not end - * in delim. - * For simple uses, a Scanner may be more convenient. - */ - async readString(delim: string): Promise { - if (delim.length !== 1) { - throw new Error("Delimiter should be a single character"); - } - const buffer = await this.readSlice(delim.charCodeAt(0)); - if (buffer === null) return null; - return new TextDecoder().decode(buffer); - } - - /** `readLine()` is a low-level line-reading primitive. Most callers should - * use `readString('\n')` instead or use a Scanner. - * - * `readLine()` tries to return a single line, not including the end-of-line - * bytes. If the line was too long for the buffer then `more` is set and the - * beginning of the line is returned. The rest of the line will be returned - * from future calls. `more` will be false when returning the last fragment - * of the line. The returned buffer is only valid until the next call to - * `readLine()`. - * - * The text returned from ReadLine does not include the line end ("\r\n" or - * "\n"). - * - * When the end of the underlying stream is reached, the final bytes in the - * stream are returned. No indication or error is given if the input ends - * without a final line end. When there are no more trailing bytes to read, - * `readLine()` returns `null`. - * - * Calling `unreadByte()` after `readLine()` will always unread the last byte - * read (possibly a character belonging to the line end) even if that byte is - * not part of the line returned by `readLine()`. - */ - async readLine(): Promise { - let line: Uint8Array | null; - - try { - line = await this.readSlice(LF); - } catch (err) { - let { partial } = err; - assert( - partial instanceof Uint8Array, - "bufio: caught error from `readSlice()` without `partial` property", - ); - - // Don't throw if `readSlice()` failed with `BufferFullError`, instead we - // just return whatever is available and set the `more` flag. - if (!(err instanceof BufferFullError)) { - throw err; - } - - // Handle the case where "\r\n" straddles the buffer. - if ( - !this.eof && - partial.byteLength > 0 && - partial[partial.byteLength - 1] === CR - ) { - // Put the '\r' back on buf and drop it from line. - // Let the next call to ReadLine check for "\r\n". - assert(this.r > 0, "bufio: tried to rewind past start of buffer"); - this.r--; - partial = partial.subarray(0, partial.byteLength - 1); - } - - return { line: partial, more: !this.eof }; - } - - if (line === null) { - return null; - } - - if (line.byteLength === 0) { - return { line, more: false }; - } - - if (line[line.byteLength - 1] == LF) { - let drop = 1; - if (line.byteLength > 1 && line[line.byteLength - 2] === CR) { - drop = 2; - } - line = line.subarray(0, line.byteLength - drop); - } - return { line, more: false }; - } - - /** `readSlice()` reads until the first occurrence of `delim` in the input, - * returning a slice pointing at the bytes in the buffer. The bytes stop - * being valid at the next read. - * - * If `readSlice()` encounters an error before finding a delimiter, or the - * buffer fills without finding a delimiter, it throws an error with a - * `partial` property that contains the entire buffer. - * - * If `readSlice()` encounters the end of the underlying stream and there are - * any bytes left in the buffer, the rest of the buffer is returned. In other - * words, EOF is always treated as a delimiter. Once the buffer is empty, - * it returns `null`. - * - * Because the data returned from `readSlice()` will be overwritten by the - * next I/O operation, most clients should use `readString()` instead. - */ - async readSlice(delim: number): Promise { - let s = 0; // search start index - let slice: Uint8Array | undefined; - - while (true) { - // Search buffer. - let i = this.buf.subarray(this.r + s, this.w).indexOf(delim); - if (i >= 0) { - i += s; - slice = this.buf.subarray(this.r, this.r + i + 1); - this.r += i + 1; - break; - } - - // EOF? - if (this.eof) { - if (this.r === this.w) { - return null; - } - slice = this.buf.subarray(this.r, this.w); - this.r = this.w; - break; - } - - // Buffer full? - if (this.buffered() >= this.buf.byteLength) { - this.r = this.w; - // #4521 The internal buffer should not be reused across reads because it causes corruption of data. - const oldbuf = this.buf; - const newbuf = this.buf.slice(0); - this.buf = newbuf; - throw new BufferFullError(oldbuf); - } - - s = this.w - this.r; // do not rescan area we scanned before - - // Buffer is not full. - try { - await this._fill(); - } catch (err) { - err.partial = slice; - throw err; - } - } - - // Handle last byte, if any. - // const i = slice.byteLength - 1; - // if (i >= 0) { - // this.lastByte = slice[i]; - // this.lastCharSize = -1 - // } - - return slice; - } - - /** `peek()` returns the next `n` bytes without advancing the reader. The - * bytes stop being valid at the next read call. - * - * When the end of the underlying stream is reached, but there are unread - * bytes left in the buffer, those bytes are returned. If there are no bytes - * left in the buffer, it returns `null`. - * - * If an error is encountered before `n` bytes are available, `peek()` throws - * an error with the `partial` property set to a slice of the buffer that - * contains the bytes that were available before the error occurred. - */ - async peek(n: number): Promise { - if (n < 0) { - throw Error("negative count"); - } - - let avail = this.w - this.r; - while (avail < n && avail < this.buf.byteLength && !this.eof) { - try { - await this._fill(); - } catch (err) { - err.partial = this.buf.subarray(this.r, this.w); - throw err; - } - avail = this.w - this.r; - } - - if (avail === 0 && this.eof) { - return null; - } else if (avail < n && this.eof) { - return this.buf.subarray(this.r, this.r + avail); - } else if (avail < n) { - throw new BufferFullError(this.buf.subarray(this.r, this.w)); - } - - return this.buf.subarray(this.r, this.r + n); - } -} - -abstract class AbstractBufBase { - buf!: Uint8Array; - usedBufferBytes = 0; - err: Error | null = null; - - /** Size returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - /** Returns how many bytes are unused in the buffer. */ - available(): number { - return this.buf.byteLength - this.usedBufferBytes; - } - - /** buffered returns the number of bytes that have been written into the - * current buffer. - */ - buffered(): number { - return this.usedBufferBytes; - } -} - -/** BufWriter implements buffering for an deno.Writer object. - * If an error occurs writing to a Writer, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.Writer. - */ -export class BufWriter extends AbstractBufBase implements Writer { - /** return new BufWriter unless writer is BufWriter */ - static create(writer: Writer, size: number = DEFAULT_BUF_SIZE): BufWriter { - return writer instanceof BufWriter ? writer : new BufWriter(writer, size); - } - - constructor(private writer: Writer, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: Writer): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.Writer. */ - async flush(): Promise { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - await Deno.writeAll( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - async write(data: Uint8Array): Promise { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = await this.writer.write(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - await this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** BufWriterSync implements buffering for a deno.WriterSync object. - * If an error occurs writing to a WriterSync, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.WriterSync. - */ -export class BufWriterSync extends AbstractBufBase implements WriterSync { - /** return new BufWriterSync unless writer is BufWriterSync */ - static create( - writer: WriterSync, - size: number = DEFAULT_BUF_SIZE, - ): BufWriterSync { - return writer instanceof BufWriterSync - ? writer - : new BufWriterSync(writer, size); - } - - constructor(private writer: WriterSync, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: WriterSync): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.WriterSync. */ - flush(): void { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - Deno.writeAllSync( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - writeSync(data: Uint8Array): number { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = this.writer.writeSync(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** Generate longest proper prefix which is also suffix array. */ -function createLPS(pat: Uint8Array): Uint8Array { - const lps = new Uint8Array(pat.length); - lps[0] = 0; - let prefixEnd = 0; - let i = 1; - while (i < lps.length) { - if (pat[i] == pat[prefixEnd]) { - prefixEnd++; - lps[i] = prefixEnd; - i++; - } else if (prefixEnd === 0) { - lps[i] = 0; - i++; - } else { - prefixEnd = pat[prefixEnd - 1]; - } - } - return lps; -} - -/** Read delimited bytes from a Reader. */ -export async function* readDelim( - reader: Reader, - delim: Uint8Array, -): AsyncIterableIterator { - // Avoid unicode problems - const delimLen = delim.length; - const delimLPS = createLPS(delim); - - let inputBuffer = new Deno.Buffer(); - const inspectArr = new Uint8Array(Math.max(1024, delimLen + 1)); - - // Modified KMP - let inspectIndex = 0; - let matchIndex = 0; - while (true) { - const result = await reader.read(inspectArr); - if (result === null) { - // Yield last chunk. - yield inputBuffer.bytes(); - return; - } - if ((result as number) < 0) { - // Discard all remaining and silently fail. - return; - } - const sliceRead = inspectArr.subarray(0, result as number); - await Deno.writeAll(inputBuffer, sliceRead); - - let sliceToProcess = inputBuffer.bytes(); - while (inspectIndex < sliceToProcess.length) { - if (sliceToProcess[inspectIndex] === delim[matchIndex]) { - inspectIndex++; - matchIndex++; - if (matchIndex === delimLen) { - // Full match - const matchEnd = inspectIndex - delimLen; - const readyBytes = sliceToProcess.subarray(0, matchEnd); - // Copy - const pendingBytes = sliceToProcess.slice(inspectIndex); - yield readyBytes; - // Reset match, different from KMP. - sliceToProcess = pendingBytes; - inspectIndex = 0; - matchIndex = 0; - } - } else { - if (matchIndex === 0) { - inspectIndex++; - } else { - matchIndex = delimLPS[matchIndex - 1]; - } - } - } - // Keep inspectIndex and matchIndex. - inputBuffer = new Deno.Buffer(sliceToProcess); - } -} - -/** Read delimited strings from a Reader. */ -export async function* readStringDelim( - reader: Reader, - delim: string, -): AsyncIterableIterator { - const encoder = new TextEncoder(); - const decoder = new TextDecoder(); - for await (const chunk of readDelim(reader, encoder.encode(delim))) { - yield decoder.decode(chunk); - } -} - -/** Read strings line-by-line from a Reader. */ -export async function* readLines( - reader: Reader, -): AsyncIterableIterator { - for await (let chunk of readStringDelim(reader, "\n")) { - // Finding a CR at the end of the line is evidence of a - // "\r\n" at the end of the line. The "\r" part should be - // removed too. - if (chunk.endsWith("\r")) { - chunk = chunk.slice(0, -1); - } - yield chunk; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0d6d743987ee8a4cb56e5a7d90307745c12f7a87.ts b/crates/swc_bundler/tests/.cache/deno/0d6d743987ee8a4cb56e5a7d90307745c12f7a87.ts deleted file mode 100644 index e82c32d63b9a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0d6d743987ee8a4cb56e5a7d90307745c12f7a87.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/embeds/embed_thumbnail.ts - - -/** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */ -export interface EmbedThumbnail { - /** Source url of thumbnail (only supports http(s) and attachments) */ - url?: string; - /** A proxied url of the thumbnail */ - proxyUrl?: string; - /** Height of thumbnail */ - height?: number; - /** Width of thumbnail */ - width?: number; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0dd29d6944d00bffe1f39444ea233e2fd11c7006.ts b/crates/swc_bundler/tests/.cache/deno/0dd29d6944d00bffe1f39444ea233e2fd11c7006.ts deleted file mode 100644 index c6c820e6af97..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0dd29d6944d00bffe1f39444ea233e2fd11c7006.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Loaded from https://deno.land/x/mysql/src/packets/builders/auth.ts - - -import auth from "../../auth.ts"; -import { BufferWriter } from "../../buffer.ts"; -import ServerCapabilities from "../../constant/capabilities.ts"; -import { Charset } from "../../constant/charset.ts"; -import type { HandshakeBody } from "../parsers/handshake.ts"; - -/** @ignore */ -export function buildAuth( - packet: HandshakeBody, - params: { username: string; password?: string; db?: string }, -): Uint8Array { - const clientParam: number = - (params.db ? ServerCapabilities.CLIENT_CONNECT_WITH_DB : 0) | - ServerCapabilities.CLIENT_PLUGIN_AUTH | - ServerCapabilities.CLIENT_LONG_PASSWORD | - ServerCapabilities.CLIENT_PROTOCOL_41 | - ServerCapabilities.CLIENT_TRANSACTIONS | - ServerCapabilities.CLIENT_MULTI_RESULTS | - ServerCapabilities.CLIENT_SECURE_CONNECTION | - (ServerCapabilities.CLIENT_LONG_FLAG & packet.serverCapabilities) | - (ServerCapabilities.CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA & - packet.serverCapabilities) | - (ServerCapabilities.CLIENT_DEPRECATE_EOF & packet.serverCapabilities); - - if (packet.serverCapabilities & ServerCapabilities.CLIENT_PLUGIN_AUTH) { - const writer = new BufferWriter(new Uint8Array(1000)); - writer - .writeUint32(clientParam) - .writeUint32(2 ** 24 - 1) - .write(Charset.UTF8_GENERAL_CI) - .skip(23) - .writeNullTerminatedString(params.username); - if (params.password) { - const authData = auth( - packet.authPluginName, - params.password, - packet.seed, - ); - if ( - clientParam & - ServerCapabilities.CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA || - clientParam & ServerCapabilities.CLIENT_SECURE_CONNECTION - ) { - // request lenenc-int length of auth-response and string[n] auth-response - writer.write(authData.length); - writer.writeBuffer(authData); - } else { - writer.writeBuffer(authData); - writer.write(0); - } - } else { - writer.write(0); - } - if (clientParam & ServerCapabilities.CLIENT_CONNECT_WITH_DB && params.db) { - writer.writeNullTerminatedString(params.db); - } - if (clientParam & ServerCapabilities.CLIENT_PLUGIN_AUTH) { - writer.writeNullTerminatedString(packet.authPluginName); - } - return writer.wroteData; - } - return Uint8Array.from([]); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0de042643e033407fefa8933f0387a5f4271257c.ts b/crates/swc_bundler/tests/.cache/deno/0de042643e033407fefa8933f0387a5f4271257c.ts deleted file mode 100644 index 5939d65f9bb0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0de042643e033407fefa8933f0387a5f4271257c.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isDate.ts - - -/** - * @ignore - */ -const isValidFormat = (format: string) => { - return /(^(y{4}|y{2})[\/-](m{1,2})[\/-](d{1,2})$)|(^(m{1,2})[\/-](d{1,2})[\/-]((y{4}|y{2})$))|(^(d{1,2})[\/-](m{1,2})[\/-]((y{4}|y{2})$))/gi.test( - format - ); -}; - -/** - * @ignore - */ -const zip = (date: string[], format: string[]) => { - const zippedArr = []; - const len = Math.min(date.length, format.length); - - for (let i = 0; i < len; i++) { - zippedArr.push([date[i], format[i]]); - } - - return zippedArr; -}; - -export const isDate = (input: any, format = 'YYYY/MM/DD') => { - if (typeof input === 'string' && isValidFormat(format)) { - const splitter = /[-/]/; - const dateAndFormat = zip( - input.split(splitter), - format.toLowerCase().split(splitter) - ); - const dateObj = {} as any; - - for (const [dateWord, formatWord] of dateAndFormat) { - if (dateWord.length !== formatWord.length) { - return false; - } - - dateObj[formatWord.charAt(0)] = dateWord; - } - - return ( - new Date(`${dateObj.m}/${dateObj.d}/${dateObj.y}`).getDate() === - +dateObj.d - ); - } - - return ( - Object.prototype.toString.call(input) === '[object Date]' && isFinite(input) - ); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/0e10ac285f46cdbd723a2e09e09540b56bb39d77.ts b/crates/swc_bundler/tests/.cache/deno/0e10ac285f46cdbd723a2e09e09540b56bb39d77.ts deleted file mode 100644 index 51f17b4265f6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0e10ac285f46cdbd723a2e09e09540b56bb39d77.ts +++ /dev/null @@ -1,123 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isCurrency.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -type CurrencyOptions = { - symbol?: string; - requireSymbol?: boolean; - allowSpaceAfterSymbol?: boolean; - symbolAfterDigits?: boolean; - allowNegatives?: boolean; - parensForNegatives?: boolean; - negativeSignBeforeDigits?: boolean; - negativeSignAfterDigits?: boolean; - allowNegativeSignPlaceholder?: boolean; - thousandsSeparator?: string; - decimalSeparator?: string; - allowDecimal?: boolean; - requireDecimal?: boolean; - digitsAfterDecimal?: number[]; - allowSpaceAfterDigits?: boolean; -}; - -/** - * @ignore - */ -const currencyRegex = (options: Required) => { - let decimalDigits = `\\d{${options.digitsAfterDecimal[0]}}`; - options.digitsAfterDecimal.forEach((digit, index) => { - if (index !== 0) decimalDigits = `${decimalDigits}|\\d{${digit}}`; - }); - - const symbol = `(${options.symbol.replace(/\W/, (m) => `\\${m}`)})${ - options.requireSymbol ? '' : '?' - }`, - negative = '-?', - whole_dollar_amount_without_sep = '[1-9]\\d*', - whole_dollar_amount_with_sep = `[1-9]\\d{0,2}(\\${options.thousandsSeparator}\\d{3})*`, - valid_whole_dollar_amounts = [ - '0', - whole_dollar_amount_without_sep, - whole_dollar_amount_with_sep, - ], - whole_dollar_amount = `(${valid_whole_dollar_amounts.join('|')})?`, - decimal_amount = `(\\${options.decimalSeparator}(${decimalDigits}))${ - options.requireDecimal ? '' : '?' - }`; - - let pattern = - whole_dollar_amount + - (options.allowDecimal || options.requireDecimal ? decimal_amount : ''); - - // default is negative sign before symbol, but there are two other options (besides parens) - if (options.allowNegatives && !options.parensForNegatives) { - if (options.negativeSignAfterDigits) { - pattern += negative; - } else if (options.negativeSignBeforeDigits) { - pattern = negative + pattern; - } - } - - // South African Rand, for example, uses R 123 (space) and R-123 (no space) - if (options.allowNegativeSignPlaceholder) { - pattern = `( (?!\\-))?${pattern}`; - } else if (options.allowSpaceAfterSymbol) { - pattern = ` ?${pattern}`; - } else if (options.allowSpaceAfterDigits) { - pattern += '( (?!$))?'; - } - - if (options.symbolAfterDigits) { - pattern += symbol; - } else { - pattern = symbol + pattern; - } - - if (options.allowNegatives) { - if (options.parensForNegatives) { - pattern = `(\\(${pattern}\\)|${pattern})`; - } else if ( - !(options.negativeSignBeforeDigits || options.negativeSignAfterDigits) - ) { - pattern = negative + pattern; - } - } - - // ensure there's a dollar and/or decimal amount, and that - // it doesn't start with a space or a negative sign followed by a space - return new RegExp(`^(?!-? )(?=.*\\d)${pattern}$`); -}; - -/** - * @ignore - */ -const defaultCurrencyOptions: CurrencyOptions = { - symbol: '$', - requireSymbol: false, - allowSpaceAfterSymbol: false, - symbolAfterDigits: false, - allowNegatives: true, - parensForNegatives: false, - negativeSignBeforeDigits: false, - negativeSignAfterDigits: false, - allowNegativeSignPlaceholder: false, - thousandsSeparator: ',', - decimalSeparator: '.', - allowDecimal: true, - requireDecimal: false, - digitsAfterDecimal: [2], - allowSpaceAfterDigits: false, -}; - -export const isCurrency = (str: string, options?: CurrencyOptions) => { - assertString(str); - - options = { - ...defaultCurrencyOptions, - ...options, - }; - - return currencyRegex(options as Required).test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/0e357b6b47106575272f7ed539c47656b9e86d3d.ts b/crates/swc_bundler/tests/.cache/deno/0e357b6b47106575272f7ed539c47656b9e86d3d.ts deleted file mode 100644 index 6d462a5d9303..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0e357b6b47106575272f7ed539c47656b9e86d3d.ts +++ /dev/null @@ -1,207 +0,0 @@ -// Loaded from https://deno.land/std@0.81.0/http/cookie.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// Structured similarly to Go's cookie.go -// https://github.com/golang/go/blob/master/src/net/http/cookie.go -import { assert } from "../_util/assert.ts"; -import { toIMF } from "../datetime/mod.ts"; - -export type Cookies = Record; - -export interface Cookie { - /** Name of the cookie. */ - name: string; - /** Value of the cookie. */ - value: string; - /** Expiration date of the cookie. */ - expires?: Date; - /** Max-Age of the Cookie. Must be integer superior to 0. */ - maxAge?: number; - /** Specifies those hosts to which the cookie will be sent. */ - domain?: string; - /** Indicates a URL path that must exist in the request. */ - path?: string; - /** Indicates if the cookie is made using SSL & HTTPS. */ - secure?: boolean; - /** Indicates that cookie is not accessible via JavaScript. **/ - httpOnly?: boolean; - /** Allows servers to assert that a cookie ought not to - * be sent along with cross-site requests. */ - sameSite?: SameSite; - /** Additional key value pairs with the form "key=value" */ - unparsed?: string[]; -} - -export type SameSite = "Strict" | "Lax" | "None"; - -const FIELD_CONTENT_REGEXP = /^(?=[\x20-\x7E]*$)[^()@<>,;:\\"\[\]?={}\s]+$/; - -function toString(cookie: Cookie): string { - if (!cookie.name) { - return ""; - } - const out: string[] = []; - validateCookieName(cookie.name); - validateCookieValue(cookie.name, cookie.value); - out.push(`${cookie.name}=${cookie.value}`); - - // Fallback for invalid Set-Cookie - // ref: https://tools.ietf.org/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1 - if (cookie.name.startsWith("__Secure")) { - cookie.secure = true; - } - if (cookie.name.startsWith("__Host")) { - cookie.path = "/"; - cookie.secure = true; - delete cookie.domain; - } - - if (cookie.secure) { - out.push("Secure"); - } - if (cookie.httpOnly) { - out.push("HttpOnly"); - } - if (typeof cookie.maxAge === "number" && Number.isInteger(cookie.maxAge)) { - assert(cookie.maxAge > 0, "Max-Age must be an integer superior to 0"); - out.push(`Max-Age=${cookie.maxAge}`); - } - if (cookie.domain) { - out.push(`Domain=${cookie.domain}`); - } - if (cookie.sameSite) { - out.push(`SameSite=${cookie.sameSite}`); - } - if (cookie.path) { - validatePath(cookie.path); - out.push(`Path=${cookie.path}`); - } - if (cookie.expires) { - const dateString = toIMF(cookie.expires); - out.push(`Expires=${dateString}`); - } - if (cookie.unparsed) { - out.push(cookie.unparsed.join("; ")); - } - return out.join("; "); -} - -/** - * Validate Cookie Name. - * @param name Cookie name. - */ -function validateCookieName(name: string | undefined | null): void { - if (name && !FIELD_CONTENT_REGEXP.test(name)) { - throw new TypeError(`Invalid cookie name: "${name}".`); - } -} - -/** - * Validate Path Value. - * @see https://tools.ietf.org/html/rfc6265#section-4.1.2.4 - * @param path Path value. - */ -function validatePath(path: string | null): void { - if (path == null) { - return; - } - for (let i = 0; i < path.length; i++) { - const c = path.charAt(i); - if ( - c < String.fromCharCode(0x20) || c > String.fromCharCode(0x7E) || c == ";" - ) { - throw new Error( - path + ": Invalid cookie path char '" + c + "'", - ); - } - } -} - -/** - *Validate Cookie Value. - * @see https://tools.ietf.org/html/rfc6265#section-4.1 - * @param value Cookie value. - */ -function validateCookieValue(name: string, value: string | null): void { - if (value == null || name == null) return; - for (let i = 0; i < value.length; i++) { - const c = value.charAt(i); - if ( - c < String.fromCharCode(0x21) || c == String.fromCharCode(0x22) || - c == String.fromCharCode(0x2c) || c == String.fromCharCode(0x3b) || - c == String.fromCharCode(0x5c) || c == String.fromCharCode(0x7f) - ) { - throw new Error( - "RFC2616 cookie '" + name + "' cannot have '" + c + "' as value", - ); - } - if (c > String.fromCharCode(0x80)) { - throw new Error( - "RFC2616 cookie '" + name + "' can only have US-ASCII chars as value" + - c.charCodeAt(0).toString(16), - ); - } - } -} - -/** - * Parse the cookies of the Server Request - * @param req An object which has a `headers` property - */ -export function getCookies(req: { headers: Headers }): Cookies { - const cookie = req.headers.get("Cookie"); - if (cookie != null) { - const out: Cookies = {}; - const c = cookie.split(";"); - for (const kv of c) { - const [cookieKey, ...cookieVal] = kv.split("="); - assert(cookieKey != null); - const key = cookieKey.trim(); - out[key] = cookieVal.join("="); - } - return out; - } - return {}; -} - -/** - * Set the cookie header properly in the Response - * @param res An object which has a headers property - * @param cookie Cookie to set - * - * Example: - * - * ```ts - * setCookie(response, { name: 'deno', value: 'runtime', - * httpOnly: true, secure: true, maxAge: 2, domain: "deno.land" }); - * ``` - */ -export function setCookie(res: { headers?: Headers }, cookie: Cookie): void { - if (!res.headers) { - res.headers = new Headers(); - } - // TODO (zekth) : Add proper parsing of Set-Cookie headers - // Parsing cookie headers to make consistent set-cookie header - // ref: https://tools.ietf.org/html/rfc6265#section-4.1.1 - const v = toString(cookie); - if (v) { - res.headers.append("Set-Cookie", v); - } -} - -/** - * Set the cookie header properly in the Response to delete it - * @param res Server Response - * @param name Name of the cookie to Delete - * Example: - * - * deleteCookie(res,'foo'); - */ -export function deleteCookie(res: { headers?: Headers }, name: string): void { - setCookie(res, { - name: name, - value: "", - expires: new Date(0), - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0e47d8913c6b47a431dc17cdbcc20d4d2041ab54.ts b/crates/swc_bundler/tests/.cache/deno/0e47d8913c6b47a431dc17cdbcc20d4d2041ab54.ts deleted file mode 100644 index 29ac3764e74f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0e47d8913c6b47a431dc17cdbcc20d4d2041ab54.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/guilds/get_widget_settings.ts - - -import { rest } from "../../rest/rest.ts"; -import type { GuildWidget } from "../../types/guilds/guild_widget.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** Returns the guild widget object. Requires the MANAGE_GUILD permission. */ -export async function getWidgetSettings(guildId: bigint) { - await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - - return await rest.runMethod("get", endpoints.GUILD_WIDGET(guildId)); -} diff --git a/crates/swc_bundler/tests/.cache/deno/0edccd409d61a4468d09126b0d058cde514f2056.ts b/crates/swc_bundler/tests/.cache/deno/0edccd409d61a4468d09126b0d058cde514f2056.ts deleted file mode 100644 index 9b207f811deb..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0edccd409d61a4468d09126b0d058cde514f2056.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/io/mod.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./bufio.ts"; -export * from "./ioutil.ts"; -export * from "./readers.ts"; -export * from "./writers.ts"; -export * from "./streams.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/0ee19e5fb8e5787dc6229b7b0c22dac41fadcf37.ts b/crates/swc_bundler/tests/.cache/deno/0ee19e5fb8e5787dc6229b7b0c22dac41fadcf37.ts deleted file mode 100644 index d7c326c8a160..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0ee19e5fb8e5787dc6229b7b0c22dac41fadcf37.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/get_guild_prune_count.ts - - -/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */ -export interface GetGuildPruneCountQuery { - /** Number of days to count prune for (1 or more), default: 7 */ - days?: number; - /** Role(s) to include, default: none */ - includeRoles: string | string[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/0ee1e04aa3313526b5b5280d4b60128e8867138f.ts b/crates/swc_bundler/tests/.cache/deno/0ee1e04aa3313526b5b5280d4b60128e8867138f.ts deleted file mode 100644 index 7694165af8f7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0ee1e04aa3313526b5b5280d4b60128e8867138f.ts +++ /dev/null @@ -1,190 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/prompt/list.ts - - -import { GenericPrompt } from "./_generic_prompt.ts"; -import { - GenericSuggestions, - GenericSuggestionsKeys, - GenericSuggestionsOptions, - GenericSuggestionsSettings, -} from "./_generic_suggestions.ts"; -import { blue, dim, underline } from "./deps.ts"; -import { Figures } from "./figures.ts"; - -/** List key options. */ -export type ListKeys = GenericSuggestionsKeys; - -/** List prompt options. */ -export interface ListOptions - extends GenericSuggestionsOptions { - separator?: string; - minLength?: number; - maxLength?: number; - minTags?: number; - maxTags?: number; - keys?: ListKeys; -} - -/** List prompt settings. */ -interface ListSettings extends GenericSuggestionsSettings { - separator: string; - minLength: number; - maxLength: number; - minTags: number; - maxTags: number; - keys?: ListKeys; -} - -/** List prompt representation. */ -export class List extends GenericSuggestions { - /** Execute the prompt and show cursor on end. */ - public static prompt(options: string | ListOptions): Promise { - if (typeof options === "string") { - options = { message: options }; - } - - return new this({ - pointer: blue(Figures.POINTER_SMALL), - indent: " ", - listPointer: blue(Figures.POINTER), - maxRows: 8, - separator: ",", - minLength: 0, - maxLength: Infinity, - minTags: 0, - maxTags: Infinity, - ...options, - }).prompt(); - } - - /** - * Inject prompt value. Can be used for unit tests or pre selections. - * @param value Input value. - */ - public static inject(value: string): void { - GenericPrompt.inject(value); - } - - protected input(): string { - const oldInput: string = this.inputValue; - const tags: string[] = this.getTags(oldInput); - const separator: string = this.settings.separator + " "; - - this.inputValue = tags.join(separator); - - const diff = oldInput.length - this.inputValue.length; - this.inputIndex -= diff; - this.cursor.x -= diff; - - return tags - .map((val: string) => underline(val)) - .join(separator) + - dim(this.getSuggestion()); - } - - protected getTags(value: string = this.inputValue): Array { - return value.trim().split(this.regexp()); - } - - /** Create list regex.*/ - protected regexp(): RegExp { - return new RegExp( - this.settings.separator === " " ? ` +` : ` *${this.settings.separator} *`, - ); - } - - /** Get input value. */ - protected getValue(): string { - // Remove trailing comma and spaces. - return this.inputValue.replace(/,+\s*$/, ""); - } - - protected getCurrentInputValue(): string { - return this.getTags().pop() ?? ""; - } - - /** Add char. */ - protected addChar(char: string): void { - switch (char) { - case this.settings.separator: - if ( - this.inputValue.length && - this.inputValue.trim().slice(-1) !== this.settings.separator - ) { - super.addChar(char); - } - this.suggestionsIndex = -1; - this.suggestionsOffset = 0; - break; - default: - super.addChar(char); - } - } - - /** Delete char left. */ - protected deleteChar(): void { - if (this.inputValue[this.inputIndex - 1] === " ") { - super.deleteChar(); - } - super.deleteChar(); - } - - protected complete(): void { - if (this.suggestions.length && this.suggestions[this.suggestionsIndex]) { - const tags = this.getTags().slice(0, -1); - tags.push(this.suggestions[this.suggestionsIndex].toString()); - this.inputValue = tags.join(this.settings.separator + " "); - this.inputIndex = this.inputValue.length; - this.suggestionsIndex = 0; - this.suggestionsOffset = 0; - } - } - - /** - * Validate input value. - * @param value User input value. - * @return True on success, false or error message on error. - */ - protected validate(value: string): boolean | string { - if (typeof value !== "string") { - return false; - } - - const values = this.transform(value); - - for (const val of values) { - if (val.length < this.settings.minLength) { - return `Value must be longer then ${this.settings.minLength} but has a length of ${val.length}.`; - } - if (val.length > this.settings.maxLength) { - return `Value can't be longer then ${this.settings.maxLength} but has a length of ${val.length}.`; - } - } - - if (values.length < this.settings.minTags) { - return `The minimum number of tags is ${this.settings.minTags} but got ${values.length}.`; - } - if (values.length > this.settings.maxTags) { - return `The maximum number of tags is ${this.settings.maxTags} but got ${values.length}.`; - } - - return true; - } - - /** - * Map input value to output value. - * @param value Input value. - * @return Output value. - */ - protected transform(value: string): string[] { - return this.getTags(value).filter((val) => val !== ""); - } - - /** - * Format output value. - * @param value Output value. - */ - protected format(value: string[]): string { - return value.join(`, `); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0ef781beeea83aa8b2b5e6dad06dad46e12064be.ts b/crates/swc_bundler/tests/.cache/deno/0ef781beeea83aa8b2b5e6dad06dad46e12064be.ts deleted file mode 100644 index 7b3ffcf4a1df..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0ef781beeea83aa8b2b5e6dad06dad46e12064be.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_clone.js - - -import _cloneRegExp from './_cloneRegExp.js'; -import type from '../type.js'; - - -/** - * Copies an object. - * - * @private - * @param {*} value The value to be copied - * @param {Array} refFrom Array containing the source references - * @param {Array} refTo Array containing the copied source references - * @param {Boolean} deep Whether or not to perform deep cloning. - * @return {*} The copied value. - */ -export default function _clone(value, refFrom, refTo, deep) { - var copy = function copy(copiedValue) { - var len = refFrom.length; - var idx = 0; - while (idx < len) { - if (value === refFrom[idx]) { - return refTo[idx]; - } - idx += 1; - } - refFrom[idx] = value; - refTo[idx] = copiedValue; - for (var key in value) { - if (value.hasOwnProperty(key)) { - copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key]; - } - } - return copiedValue; - }; - switch (type(value)) { - case 'Object': return copy(Object.create(Object.getPrototypeOf(value))); - case 'Array': return copy([]); - case 'Date': return new Date(value.valueOf()); - case 'RegExp': return _cloneRegExp(value); - default: return value; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0ef9a4598fa5881690a2f4b35c76defd573a8523.ts b/crates/swc_bundler/tests/.cache/deno/0ef9a4598fa5881690a2f4b35c76defd573a8523.ts deleted file mode 100644 index eebeb61681d0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0ef9a4598fa5881690a2f4b35c76defd573a8523.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/pick.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Returns a partial copy of an object containing only the keys specified. If - * the key does not exist, the property is ignored. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Object - * @sig [k] -> {k: v} -> {k: v} - * @param {Array} names an array of String property names to copy onto a new object - * @param {Object} obj The object to copy from - * @return {Object} A new object with only properties from `names` on it. - * @see R.omit, R.props - * @example - * - * R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} - * R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1} - */ -var pick = _curry2(function pick(names, obj) { - var result = {}; - var idx = 0; - while (idx < names.length) { - if (names[idx] in obj) { - result[names[idx]] = obj[names[idx]]; - } - idx += 1; - } - return result; -}); -export default pick; diff --git a/crates/swc_bundler/tests/.cache/deno/0f4f26c742d59b7600f30283fbcabab7c92d3f6d.ts b/crates/swc_bundler/tests/.cache/deno/0f4f26c742d59b7600f30283fbcabab7c92d3f6d.ts deleted file mode 100644 index 461df4d0c7ff..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0f4f26c742d59b7600f30283fbcabab7c92d3f6d.ts +++ /dev/null @@ -1,84 +0,0 @@ -// Loaded from https://deno.land/x/denodb@v1.0.18/lib/relationships.ts - - -import type { ModelSchema } from "./model.ts"; -import { DataTypes, FieldTypeString, RelationshipType } from "./data-types.ts"; -import { PivotModel } from "./model-pivot.ts"; - -type RelationshipOptions = { - primaryKey?: string; - foreignKey?: string; -}; - -export const Relationships = { - /** Define a one-to-one or one-to-many relationship for a given model. */ - belongsTo(model: ModelSchema): RelationshipType { - return { - type: DataTypes.INTEGER, - relationship: { - kind: "single", - model, - }, - }; - }, - - /** Add corresponding fields to each model for a one-to-one relationship. */ - oneToOne( - modelA: ModelSchema, - modelB: ModelSchema, - options?: RelationshipOptions, - ) { - let primaryKey = options?.primaryKey; - let foreignKey = options?.foreignKey; - - modelA.fields[primaryKey || `${modelB.name.toLowerCase()}Id`] = this - .belongsTo(modelB); - modelB.fields[foreignKey || `${modelA.name.toLowerCase()}Id`] = this - .belongsTo(modelA); - }, - - /** Generate a many-to-many pivot model for two given models. - * - * const AirportFlight = Relationships.manyToMany(Airport, Flight); - */ - manyToMany( - modelA: ModelSchema, - modelB: ModelSchema, - options?: RelationshipOptions, - ): ModelSchema { - let primaryKey = options?.primaryKey; - let foreignKey = options?.foreignKey; - - const pivotClassName = `${modelA.table}_${modelB.table}`; - const modelAFieldName = primaryKey || `${modelA.name.toLowerCase()}Id`; - const modelBFieldName = foreignKey || `${modelB.name.toLowerCase()}Id`; - - class PivotClass extends PivotModel { - static table = pivotClassName; - - static fields = { - id: { - primaryKey: true, - autoIncrement: true, - }, - [modelAFieldName]: Relationships.belongsTo(modelA), - [modelBFieldName]: Relationships.belongsTo(modelB), - }; - - static _pivotsModels = { - [modelA.name]: modelA, - [modelB.name]: modelB, - }; - - static _pivotsFields = { - [modelA.name]: modelAFieldName, - [modelB.name]: modelBFieldName, - }; - } - - modelA.pivot[modelB.name] = PivotClass; - modelB.pivot[modelA.name] = PivotClass; - - return PivotClass; - }, -}; diff --git a/crates/swc_bundler/tests/.cache/deno/0f69c7e97d1f7eb852db11328506cbb50171e5e3.ts b/crates/swc_bundler/tests/.cache/deno/0f69c7e97d1f7eb852db11328506cbb50171e5e3.ts deleted file mode 100644 index 4e1ffcfa3822..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0f69c7e97d1f7eb852db11328506cbb50171e5e3.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/explicit_content_filter_levels.ts - - -/** https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level */ -export enum DiscordExplicitContentFilterLevels { - /** Media content will not be scanned */ - Disabled, - /** Media content sent by members without roles will be scanned */ - MembersWithoutRoles, - /** Media content sent by all members will be scanned */ - AllMembers, -} - -export type ExplicitContentFilterLevels = DiscordExplicitContentFilterLevels; -export const ExplicitContentFilterLevels = DiscordExplicitContentFilterLevels; diff --git a/crates/swc_bundler/tests/.cache/deno/0f6f644c56410f6a8540ac63779169fec060c331.ts b/crates/swc_bundler/tests/.cache/deno/0f6f644c56410f6a8540ac63779169fec060c331.ts deleted file mode 100644 index 4ea4feccd96b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0f6f644c56410f6a8540ac63779169fec060c331.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/zipObj.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Creates a new object out of a list of keys and a list of values. - * Key/value pairing is truncated to the length of the shorter of the two lists. - * Note: `zipObj` is equivalent to `pipe(zip, fromPairs)`. - * - * @func - * @memberOf R - * @since v0.3.0 - * @category List - * @sig [String] -> [*] -> {String: *} - * @param {Array} keys The array that will be properties on the output object. - * @param {Array} values The list of values on the output object. - * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`. - * @example - * - * R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} - */ -var zipObj = _curry2(function zipObj(keys, values) { - var idx = 0; - var len = Math.min(keys.length, values.length); - var out = {}; - while (idx < len) { - out[keys[idx]] = values[idx]; - idx += 1; - } - return out; -}); -export default zipObj; diff --git a/crates/swc_bundler/tests/.cache/deno/0f7dfad28dcd32a1ab1390591772d2adc69b73d7.ts b/crates/swc_bundler/tests/.cache/deno/0f7dfad28dcd32a1ab1390591772d2adc69b73d7.ts deleted file mode 100644 index 0940beb9928a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0f7dfad28dcd32a1ab1390591772d2adc69b73d7.ts +++ /dev/null @@ -1,185 +0,0 @@ -// Loaded from https://deno.land/x/oak@v6.3.1/context.ts - - -// Copyright 2018-2020 the oak authors. All rights reserved. MIT license. - -import type { Application, State } from "./application.ts"; -import { Cookies } from "./cookies.ts"; -import { acceptable, acceptWebSocket, WebSocket } from "./deps.ts"; -import { createHttpError } from "./httpError.ts"; -import type { KeyStack } from "./keyStack.ts"; -import { Request } from "./request.ts"; -import { Response } from "./response.ts"; -import { send, SendOptions } from "./send.ts"; -import { - ServerSentEventTarget, - ServerSentEventTargetOptions, -} from "./server_sent_event.ts"; -import type { ErrorStatus, ServerRequest } from "./types.d.ts"; - -export interface ContextSendOptions extends SendOptions { - /** The filename to send, which will be resolved based on the other options. - * If this property is omitted, the current context's `.request.url.pathname` - * will be used. */ - path?: string; -} - -/** Provides context about the current request and response to middleware - * functions. */ -// deno-lint-ignore no-explicit-any -export class Context> { - #socket?: WebSocket; - #sse?: ServerSentEventTarget; - - /** A reference to the current application. */ - app: Application; - - /** An object which allows access to cookies, mediating both the request and - * response. */ - cookies: Cookies; - - /** Is `true` if the current connection is upgradeable to a web socket. - * Otherwise the value is `false`. Use `.upgrade()` to upgrade the connection - * and return the web socket. */ - get isUpgradable(): boolean { - return acceptable(this.request); - } - - /** Determines if the request should be responded to. If `false` when the - * middleware completes processing, the response will not be sent back to the - * requestor. Typically this is used if the middleware will take over low - * level processing of requests and responses, for example if using web - * sockets. This automatically gets set to `false` when the context is - * upgraded to a web socket via the `.upgrade()` method. - * - * The default is `true`. */ - respond: boolean; - - /** An object which contains information about the current request. */ - request: Request; - - /** An object which contains information about the response that will be sent - * when the middleware finishes processing. */ - response: Response; - - /** If the the current context has been upgraded, then this will be set to - * with the web socket, otherwise it is `undefined`. */ - get socket(): WebSocket | undefined { - return this.#socket; - } - - /** The object to pass state to front-end views. This can be typed by - * supplying the generic state argument when creating a new app. For - * example: - * - * ```ts - * const app = new Application<{ foo: string }>(); - * ``` - * - * Or can be contextually inferred based on setting an initial state object: - * - * ```ts - * const app = new Application({ state: { foo: "bar" } }); - * ``` - */ - state: S; - - constructor( - app: Application, - serverRequest: ServerRequest, - secure = false, - ) { - this.app = app; - this.state = app.state; - this.request = new Request(serverRequest, app.proxy, secure); - this.respond = true; - this.response = new Response(this.request); - this.cookies = new Cookies(this.request, this.response, { - keys: this.app.keys as KeyStack | undefined, - secure: this.request.secure, - }); - } - - /** Asserts the condition and if the condition fails, creates an HTTP error - * with the provided status (which defaults to `500`). The error status by - * default will be set on the `.response.status`. - */ - assert( - // deno-lint-ignore no-explicit-any - condition: any, - errorStatus: ErrorStatus = 500, - message?: string, - props?: Record, - ): asserts condition { - if (condition) { - return; - } - const err = createHttpError(errorStatus, message); - if (props) { - Object.assign(err, props); - } - throw err; - } - - /** Asynchronously fulfill a response with a file from the local file - * system. - * - * If the `options.path` is not supplied, the file to be sent will default - * to this `.request.url.pathname`. - * - * Requires Deno read permission. */ - send(options: ContextSendOptions): Promise { - const { path = this.request.url.pathname, ...sendOptions } = options; - return send(this, path, sendOptions); - } - - /** Convert the connection to stream events, returning an event target for - * sending server sent events. Events dispatched on the returned target will - * be sent to the client and be available in the client's `EventSource` that - * initiated the connection. - * - * This will set `.respond` to `false`. */ - sendEvents(options?: ServerSentEventTargetOptions): ServerSentEventTarget { - if (this.#sse) { - return this.#sse; - } - this.respond = false; - return this.#sse = new ServerSentEventTarget( - this.app, - this.request.serverRequest, - options, - ); - } - - /** Create and throw an HTTP Error, which can be used to pass status - * information which can be caught by other middleware to send more - * meaningful error messages back to the client. The passed error status will - * be set on the `.response.status` by default as well. - */ - throw( - errorStatus: ErrorStatus, - message?: string, - props?: Record, - ): never { - const err = createHttpError(errorStatus, message); - if (props) { - Object.assign(err, props); - } - throw err; - } - - /** Take the current request and upgrade it to a web socket, resolving with - * the web socket object. This will set `.respond` to `false`. */ - async upgrade(): Promise { - if (this.#socket) { - return this.#socket; - } - const { conn, r: bufReader, w: bufWriter, headers } = - this.request.serverRequest; - this.#socket = await acceptWebSocket( - { conn, bufReader, bufWriter, headers }, - ); - this.respond = false; - return this.#socket; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/0f8cfd82f215e35382a230fd72bcd7094f42c8ce.ts b/crates/swc_bundler/tests/.cache/deno/0f8cfd82f215e35382a230fd72bcd7094f42c8ce.ts deleted file mode 100644 index f4fe63b06cf1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0f8cfd82f215e35382a230fd72bcd7094f42c8ce.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isHexadecimal.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * @ignore - */ -const hexadecimal = /^(0x|0h)?[0-9A-F]+$/i; - -export const isHexadecimal = (str: string) => { - assertString(str); - return hexadecimal.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/0fa28d6816fcab5d11ba4ee1ede2a72680b8b6c0.ts b/crates/swc_bundler/tests/.cache/deno/0fa28d6816fcab5d11ba4ee1ede2a72680b8b6c0.ts deleted file mode 100644 index 957121e80926..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0fa28d6816fcab5d11ba4ee1ede2a72680b8b6c0.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/update.js - - -import _curry3 from './internal/_curry3.js'; -import adjust from './adjust.js'; -import always from './always.js'; - - -/** - * Returns a new copy of the array with the element at the provided index - * replaced with the given value. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category List - * @sig Number -> a -> [a] -> [a] - * @param {Number} idx The index to update. - * @param {*} x The value to exist at the given index of the returned array. - * @param {Array|Arguments} list The source array-like object to be updated. - * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`. - * @see R.adjust - * @example - * - * R.update(1, '_', ['a', 'b', 'c']); //=> ['a', '_', 'c'] - * R.update(-1, '_', ['a', 'b', 'c']); //=> ['a', 'b', '_'] - * @symb R.update(-1, a, [b, c]) = [b, a] - * @symb R.update(0, a, [b, c]) = [a, c] - * @symb R.update(1, a, [b, c]) = [b, a] - */ -var update = _curry3(function update(idx, x, list) { - return adjust(idx, always(x), list); -}); -export default update; diff --git a/crates/swc_bundler/tests/.cache/deno/0ff16ed81878dbaa6c6dce1a42c7e986260c2c1d.ts b/crates/swc_bundler/tests/.cache/deno/0ff16ed81878dbaa6c6dce1a42c7e986260c2c1d.ts deleted file mode 100644 index dd16dd6b566d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/0ff16ed81878dbaa6c6dce1a42c7e986260c2c1d.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/median.js - - -import _curry1 from './internal/_curry1.js'; -import mean from './mean.js'; - - -/** - * Returns the median of the given list of numbers. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category Math - * @sig [Number] -> Number - * @param {Array} list - * @return {Number} - * @see R.mean - * @example - * - * R.median([2, 9, 7]); //=> 7 - * R.median([7, 2, 10, 9]); //=> 8 - * R.median([]); //=> NaN - */ -var median = _curry1(function median(list) { - var len = list.length; - if (len === 0) { - return NaN; - } - var width = 2 - len % 2; - var idx = (len - width) / 2; - return mean(Array.prototype.slice.call(list, 0).sort(function(a, b) { - return a < b ? -1 : a > b ? 1 : 0; - }).slice(idx, idx + width)); -}); -export default median; diff --git a/crates/swc_bundler/tests/.cache/deno/10211d0af78bc73c80c5c4de7927515eaf13db69.ts b/crates/swc_bundler/tests/.cache/deno/10211d0af78bc73c80c5c4de7927515eaf13db69.ts deleted file mode 100644 index 7fda3bd7d55c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/10211d0af78bc73c80c5c4de7927515eaf13db69.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/std@0.67.0/path/common.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** This module is browser compatible. */ - -import { SEP } from "./separator.ts"; - -/** Determines the common path from a set of paths, using an optional separator, - * which defaults to the OS default separator. - * - * import { common } from "https://deno.land/std/path/mod.ts"; - * const p = common([ - * "./deno/std/path/mod.ts", - * "./deno/std/fs/mod.ts", - * ]); - * console.log(p); // "./deno/std/" - * - */ -export function common(paths: string[], sep = SEP): string { - const [first = "", ...remaining] = paths; - if (first === "" || remaining.length === 0) { - return first.substring(0, first.lastIndexOf(sep) + 1); - } - const parts = first.split(sep); - - let endOfPrefix = parts.length; - for (const path of remaining) { - const compare = path.split(sep); - for (let i = 0; i < endOfPrefix; i++) { - if (compare[i] !== parts[i]) { - endOfPrefix = i; - } - } - - if (endOfPrefix === 0) { - return ""; - } - } - const prefix = parts.slice(0, endOfPrefix).join(sep); - return prefix.endsWith(sep) ? prefix : `${prefix}${sep}`; -} diff --git a/crates/swc_bundler/tests/.cache/deno/102b68862ac1918ef4cf8a2b19164384c89f8290.ts b/crates/swc_bundler/tests/.cache/deno/102b68862ac1918ef4cf8a2b19164384c89f8290.ts deleted file mode 100644 index 8c5fbfbd3ca5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/102b68862ac1918ef4cf8a2b19164384c89f8290.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isBoolean.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -export const isBoolean = (str: string) => { - assertString(str); - return ['true', 'false', '1', '0'].indexOf(str) >= 0; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/102eb79561b7bc6a50ed8bae5d2a37ac9b465a42.ts b/crates/swc_bundler/tests/.cache/deno/102eb79561b7bc6a50ed8bae5d2a37ac9b465a42.ts deleted file mode 100644 index caf0f5952ad7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/102eb79561b7bc6a50ed8bae5d2a37ac9b465a42.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/mongo@v0.20.0/src/collection/mod.ts - - -export { Collection } from "./collection.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/103b3ea1f747fc5a984b3f75a82b94024de14e5f.ts b/crates/swc_bundler/tests/.cache/deno/103b3ea1f747fc5a984b3f75a82b94024de14e5f.ts deleted file mode 100644 index 926fa26e355a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/103b3ea1f747fc5a984b3f75a82b94024de14e5f.ts +++ /dev/null @@ -1,126 +0,0 @@ -// Loaded from https://deno.land/x/status@0.1.0/maps.ts - - -// Copyright 2020 Filippo Rossi. All rights reserved. MIT license. - -import * as codes from "./codes.ts"; - -/** - * Mapping all status codes to status phrases. - */ -export const STATUS_MESSAGES: { [key: number]: string } = { - [codes.ACCEPTED]: "ACCEPTED", - [codes.BAD_GATEWAY]: "BAD_GATEWAY", - [codes.BAD_REQUEST]: "BAD_REQUEST", - [codes.CONFLICT]: "CONFLICT", - [codes.CONTINUE]: "CONTINUE", - [codes.CREATED]: "CREATED", - [codes.EXPECTATION_FAILED]: "EXPECTATION_FAILED", - [codes.FAILED_DEPENDENCY]: "FAILED_DEPENDENCY", - [codes.FORBIDDEN]: "FORBIDDEN", - [codes.GATEWAY_TIMEOUT]: "GATEWAY_TIMEOUT", - [codes.GONE]: "GONE", - [codes.HTTP_VERSION_NOT_SUPPORTED]: "HTTP_VERSION_NOT_SUPPORTED", - [codes.IM_A_TEAPOT]: "IM_A_TEAPOT", - [codes.INSUFFICIENT_SPACE_ON_RESOURCE]: "INSUFFICIENT_SPACE_ON_RESOURCE", - [codes.INSUFFICIENT_STORAGE]: "INSUFFICIENT_STORAGE", - [codes.INTERNAL_SERVER_ERROR]: "INTERNAL_SERVER_ERROR", - [codes.LENGTH_REQUIRED]: "LENGTH_REQUIRED", - [codes.LOCKED]: "LOCKED", - [codes.METHOD_FAILURE]: "METHOD_FAILURE", - [codes.METHOD_NOT_ALLOWED]: "METHOD_NOT_ALLOWED", - [codes.MOVED_PERMANENTLY]: "MOVED_PERMANENTLY", - [codes.MOVED_TEMPORARILY]: "MOVED_TEMPORARILY", - [codes.MULTI_STATUS]: "MULTI_STATUS", - [codes.MULTIPLE_CHOICES]: "MULTIPLE_CHOICES", - [codes.NETWORK_AUTHENTICATION_REQUIRED]: "NETWORK_AUTHENTICATION_REQUIRED", - [codes.NO_CONTENT]: "NO_CONTENT", - [codes.NON_AUTHORITATIVE_INFORMATION]: "NON_AUTHORITATIVE_INFORMATION", - [codes.NOT_ACCEPTABLE]: "NOT_ACCEPTABLE", - [codes.NOT_FOUND]: "NOT_FOUND", - [codes.NOT_IMPLEMENTED]: "NOT_IMPLEMENTED", - [codes.NOT_MODIFIED]: "NOT_MODIFIED", - [codes.OK]: "OK", - [codes.PARTIAL_CONTENT]: "PARTIAL_CONTENT", - [codes.PAYMENT_REQUIRED]: "PAYMENT_REQUIRED", - [codes.PERMANENT_REDIRECT]: "PERMANENT_REDIRECT", - [codes.PRECONDITION_FAILED]: "PRECONDITION_FAILED", - [codes.PRECONDITION_REQUIRED]: "PRECONDITION_REQUIRED", - [codes.PROCESSING]: "PROCESSING", - [codes.PROXY_AUTHENTICATION_REQUIRED]: "PROXY_AUTHENTICATION_REQUIRED", - [codes.REQUEST_HEADER_FIELDS_TOO_LARGE]: "REQUEST_HEADER_FIELDS_TOO_LARGE", - [codes.REQUEST_TIMEOUT]: "REQUEST_TIMEOUT", - [codes.REQUEST_TOO_LONG]: "REQUEST_TOO_LONG", - [codes.REQUEST_URI_TOO_LONG]: "REQUEST_URI_TOO_LONG", - [codes.REQUESTED_RANGE_NOT_SATISFIABLE]: "REQUESTED_RANGE_NOT_SATISFIABLE", - [codes.RESET_CONTENT]: "RESET_CONTENT", - [codes.SEE_OTHER]: "SEE_OTHER", - [codes.SERVICE_UNAVAILABLE]: "SERVICE_UNAVAILABLE", - [codes.SWITCHING_PROTOCOLS]: "SWITCHING_PROTOCOLS", - [codes.TEMPORARY_REDIRECT]: "TEMPORARY_REDIRECT", - [codes.TOO_MANY_REQUESTS]: "TOO_MANY_REQUESTS", - [codes.UNAUTHORIZED]: "UNAUTHORIZED", - [codes.UNPROCESSABLE_ENTITY]: "UNPROCESSABLE_ENTITY", - [codes.UNSUPPORTED_MEDIA_TYPE]: "UNSUPPORTED_MEDIA_TYPE", - [codes.USE_PROXY]: "USE_PROXY", -}; - -/** - * Mapping all status phrases to status codes. - */ -export const STATUS_CODES: { [key: string]: number } = { - "ACCEPTED": codes.ACCEPTED, - "BAD_GATEWAY": codes.BAD_GATEWAY, - "BAD_REQUEST": codes.BAD_REQUEST, - "CONFLICT": codes.CONFLICT, - "CONTINUE": codes.CONTINUE, - "CREATED": codes.CREATED, - "EXPECTATION_FAILED": codes.EXPECTATION_FAILED, - "FAILED_DEPENDENCY": codes.FAILED_DEPENDENCY, - "FORBIDDEN": codes.FORBIDDEN, - "GATEWAY_TIMEOUT": codes.GATEWAY_TIMEOUT, - "GONE": codes.GONE, - "HTTP_VERSION_NOT_SUPPORTED": codes.HTTP_VERSION_NOT_SUPPORTED, - "IM_A_TEAPOT": codes.IM_A_TEAPOT, - "INSUFFICIENT_SPACE_ON_RESOURCE": codes.INSUFFICIENT_SPACE_ON_RESOURCE, - "INSUFFICIENT_STORAGE": codes.INSUFFICIENT_STORAGE, - "INTERNAL_SERVER_ERROR": codes.INTERNAL_SERVER_ERROR, - "LENGTH_REQUIRED": codes.LENGTH_REQUIRED, - "LOCKED": codes.LOCKED, - "METHOD_FAILURE": codes.METHOD_FAILURE, - "METHOD_NOT_ALLOWED": codes.METHOD_NOT_ALLOWED, - "MOVED_PERMANENTLY": codes.MOVED_PERMANENTLY, - "MOVED_TEMPORARILY": codes.MOVED_TEMPORARILY, - "MULTI_STATUS": codes.MULTI_STATUS, - "MULTIPLE_CHOICES": codes.MULTIPLE_CHOICES, - "NETWORK_AUTHENTICATION_REQUIRED": codes.NETWORK_AUTHENTICATION_REQUIRED, - "NO_CONTENT": codes.NO_CONTENT, - "NON_AUTHORITATIVE_INFORMATION": codes.NON_AUTHORITATIVE_INFORMATION, - "NOT_ACCEPTABLE": codes.NOT_ACCEPTABLE, - "NOT_FOUND": codes.NOT_FOUND, - "NOT_IMPLEMENTED": codes.NOT_IMPLEMENTED, - "NOT_MODIFIED": codes.NOT_MODIFIED, - "OK": codes.OK, - "PARTIAL_CONTENT": codes.PARTIAL_CONTENT, - "PAYMENT_REQUIRED": codes.PAYMENT_REQUIRED, - "PERMANENT_REDIRECT": codes.PERMANENT_REDIRECT, - "PRECONDITION_FAILED": codes.PRECONDITION_FAILED, - "PRECONDITION_REQUIRED": codes.PRECONDITION_REQUIRED, - "PROCESSING": codes.PROCESSING, - "PROXY_AUTHENTICATION_REQUIRED": codes.PROXY_AUTHENTICATION_REQUIRED, - "REQUEST_HEADER_FIELDS_TOO_LARGE": codes.REQUEST_HEADER_FIELDS_TOO_LARGE, - "REQUEST_TIMEOUT": codes.REQUEST_TIMEOUT, - "REQUEST_TOO_LONG": codes.REQUEST_TOO_LONG, - "REQUEST_URI_TOO_LONG": codes.REQUEST_URI_TOO_LONG, - "REQUESTED_RANGE_NOT_SATISFIABLE": codes.REQUESTED_RANGE_NOT_SATISFIABLE, - "RESET_CONTENT": codes.RESET_CONTENT, - "SEE_OTHER": codes.SEE_OTHER, - "SERVICE_UNAVAILABLE": codes.SERVICE_UNAVAILABLE, - "SWITCHING_PROTOCOLS": codes.SWITCHING_PROTOCOLS, - "TEMPORARY_REDIRECT": codes.TEMPORARY_REDIRECT, - "TOO_MANY_REQUESTS": codes.TOO_MANY_REQUESTS, - "UNAUTHORIZED": codes.UNAUTHORIZED, - "UNPROCESSABLE_ENTITY": codes.UNPROCESSABLE_ENTITY, - "UNSUPPORTED_MEDIA_TYPE": codes.UNSUPPORTED_MEDIA_TYPE, - "USE_PROXY": codes.USE_PROXY, -}; diff --git a/crates/swc_bundler/tests/.cache/deno/105e20f2af89b6331d0b5b450ea2998c90fa869c.ts b/crates/swc_bundler/tests/.cache/deno/105e20f2af89b6331d0b5b450ea2998c90fa869c.ts deleted file mode 100644 index c16895e647cf..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/105e20f2af89b6331d0b5b450ea2998c90fa869c.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/encoding/_yaml/type/bool.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { Type } from "../type.ts"; -import { isBoolean } from "../utils.ts"; - -function resolveYamlBoolean(data: string): boolean { - const max = data.length; - - return ( - (max === 4 && (data === "true" || data === "True" || data === "TRUE")) || - (max === 5 && (data === "false" || data === "False" || data === "FALSE")) - ); -} - -function constructYamlBoolean(data: string): boolean { - return data === "true" || data === "True" || data === "TRUE"; -} - -export const bool = new Type("tag:yaml.org,2002:bool", { - construct: constructYamlBoolean, - defaultStyle: "lowercase", - kind: "scalar", - predicate: isBoolean, - represent: { - lowercase(object: boolean): string { - return object ? "true" : "false"; - }, - uppercase(object: boolean): string { - return object ? "TRUE" : "FALSE"; - }, - camelcase(object: boolean): string { - return object ? "True" : "False"; - }, - }, - resolve: resolveYamlBoolean, -}); diff --git a/crates/swc_bundler/tests/.cache/deno/10b8210f532d7000c016d4d3dc2ebe84c0c1d1e7.ts b/crates/swc_bundler/tests/.cache/deno/10b8210f532d7000c016d4d3dc2ebe84c0c1d1e7.ts deleted file mode 100644 index ca9a2036cc0c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/10b8210f532d7000c016d4d3dc2ebe84c0c1d1e7.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/std@0.101.0/async/delay.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -/* Resolves after the given number of milliseconds. */ -export function delay(ms: number): Promise { - return new Promise((res): number => - setTimeout((): void => { - res(); - }, ms) - ); -} diff --git a/crates/swc_bundler/tests/.cache/deno/10b947c996f852af42218239739b6f6c991c496e.ts b/crates/swc_bundler/tests/.cache/deno/10b947c996f852af42218239739b6f6c991c496e.ts deleted file mode 100644 index 9f05fa567150..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/10b947c996f852af42218239739b6f6c991c496e.ts +++ /dev/null @@ -1,131 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/util/collection.ts - - -export class Collection extends Map { - maxSize?: number; - private sweeper?: CollectionSweeper & { intervalId?: number }; - - constructor(entries?: (readonly (readonly [K, V])[] | null) | Map, options?: CollectionOptions) { - super(entries ?? []); - - this.maxSize = options?.maxSize; - if (!options?.sweeper) return; - - this.startSweeper(options.sweeper); - } - - startSweeper(options: CollectionSweeper): number { - if (this.sweeper?.intervalId) clearInterval(this.sweeper.intervalId); - - this.sweeper = options; - this.sweeper.intervalId = setInterval(() => { - this.map(async (value, key) => { - if (!(await this.sweeper?.filter(value, key))) return; - - this.delete(key); - return key; - }); - }, options.interval); - - return this.sweeper.intervalId!; - } - - stopSweeper(): void { - return clearInterval(this.sweeper?.intervalId); - } - - set(key: K, value: V) { - // When this collection is maxSizeed make sure we can add first - if ((this.maxSize || this.maxSize === 0) && this.size >= this.maxSize) { - return this; - } - - return super.set(key, value); - } - - array() { - return [...this.values()]; - } - - /** Retrieve the value of the first element in this collection */ - first(): V | undefined { - return this.values().next().value; - } - - last(): V | undefined { - return [...this.values()][this.size - 1]; - } - - random(): V | undefined { - const array = [...this.values()]; - return array[Math.floor(Math.random() * array.length)]; - } - - find(callback: (value: V, key: K) => boolean) { - for (const key of this.keys()) { - const value = this.get(key)!; - if (callback(value, key)) return value; - } - // If nothing matched - return; - } - - filter(callback: (value: V, key: K) => boolean) { - const relevant = new Collection(); - this.forEach((value, key) => { - if (callback(value, key)) relevant.set(key, value); - }); - - return relevant; - } - - map(callback: (value: V, key: K) => T) { - const results = []; - for (const key of this.keys()) { - const value = this.get(key)!; - results.push(callback(value, key)); - } - return results; - } - - some(callback: (value: V, key: K) => boolean) { - for (const key of this.keys()) { - const value = this.get(key)!; - if (callback(value, key)) return true; - } - - return false; - } - - every(callback: (value: V, key: K) => boolean) { - for (const key of this.keys()) { - const value = this.get(key)!; - if (!callback(value, key)) return false; - } - - return true; - } - - reduce(callback: (accumulator: T, value: V, key: K) => T, initialValue?: T): T { - let accumulator: T = initialValue!; - - for (const key of this.keys()) { - const value = this.get(key)!; - accumulator = callback(accumulator, value, key); - } - - return accumulator; - } -} - -interface CollectionOptions { - sweeper?: CollectionSweeper; - maxSize?: number; -} - -interface CollectionSweeper { - /** The filter to determine whether an element should be deleted or not */ - filter: (value: V, key: K) => boolean | Promise; - /** The interval in which the sweeper should run */ - interval: number; -} diff --git a/crates/swc_bundler/tests/.cache/deno/10c5d90b3aecacee0f0511e8ea317f3174d065ce.ts b/crates/swc_bundler/tests/.cache/deno/10c5d90b3aecacee0f0511e8ea317f3174d065ce.ts deleted file mode 100644 index 01e1cb694f82..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/10c5d90b3aecacee0f0511e8ea317f3174d065ce.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/objOf.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Creates an object containing a single key:value pair. - * - * @func - * @memberOf R - * @since v0.18.0 - * @category Object - * @sig String -> a -> {String:a} - * @param {String} key - * @param {*} val - * @return {Object} - * @see R.pair - * @example - * - * const matchPhrases = R.compose( - * R.objOf('must'), - * R.map(R.objOf('match_phrase')) - * ); - * matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]} - */ -var objOf = _curry2(function objOf(key, val) { - var obj = {}; - obj[key] = val; - return obj; -}); -export default objOf; diff --git a/crates/swc_bundler/tests/.cache/deno/10ecf12c1b876c0c6ef22f96c5340b05644d69eb.ts b/crates/swc_bundler/tests/.cache/deno/10ecf12c1b876c0c6ef22f96c5340b05644d69eb.ts deleted file mode 100644 index cbca6a2e9e64..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/10ecf12c1b876c0c6ef22f96c5340b05644d69eb.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/channels/channel_pins_update.ts - - -/** https://discord.com/developers/docs/topics/gateway#channel-pins-update */ -export interface ChannelPinsUpdate { - /** The id of the guild */ - guildId?: string; - /** The id of the channel */ - channelId: string; - /** The time at which the most recent pinned message was pinned */ - lastPinTimestamp?: string | null; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1111434a0697d95cf1a2f8f34fa771885b5be26a.ts b/crates/swc_bundler/tests/.cache/deno/1111434a0697d95cf1a2f8f34fa771885b5be26a.ts deleted file mode 100644 index 2a07a14076ac..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1111434a0697d95cf1a2f8f34fa771885b5be26a.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Loaded from https://deno.land/x/regexparam@v2.0.0/src/index.js - - -export function parse(str, loose) { - if (str instanceof RegExp) return { keys:false, pattern:str }; - var c, o, tmp, ext, keys=[], pattern='', arr = str.split('/'); - arr[0] || arr.shift(); - - while (tmp = arr.shift()) { - c = tmp[0]; - if (c === '*') { - keys.push('wild'); - pattern += '/(.*)'; - } else if (c === ':') { - o = tmp.indexOf('?', 1); - ext = tmp.indexOf('.', 1); - keys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) ); - pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)'; - if (!!~ext) pattern += (!!~o ? '?' : '') + '\\' + tmp.substring(ext); - } else { - pattern += '/' + tmp; - } - } - - return { - keys: keys, - pattern: new RegExp('^' + pattern + (loose ? '(?=$|\/)' : '\/?$'), 'i') - }; -} - -var RGX = /*#__PURE__*/ /(\/|^)([:*][^/]*?)(\?)?(?=[/.]|$)/g; - -// error if key missing? -export function inject(route, values) { - return route.replace(RGX, (x, lead, key, optional) => { - x = values[key=='*' ? 'wild' : key.substring(1)]; - return x ? '/'+x : (optional || key=='*') ? '' : '/' + key; - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/112f65ca7363e7b053f7dc0f5b44098a12cb67fb.ts b/crates/swc_bundler/tests/.cache/deno/112f65ca7363e7b053f7dc0f5b44098a12cb67fb.ts deleted file mode 100644 index 08d882f42803..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/112f65ca7363e7b053f7dc0f5b44098a12cb67fb.ts +++ /dev/null @@ -1,721 +0,0 @@ -// Loaded from https://deno.land/std@0.88.0/io/bufio.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// Based on https://github.com/golang/go/blob/891682/src/bufio/bufio.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -type Reader = Deno.Reader; -type Writer = Deno.Writer; -type WriterSync = Deno.WriterSync; -import { copy } from "../bytes/mod.ts"; -import { assert } from "../_util/assert.ts"; - -const DEFAULT_BUF_SIZE = 4096; -const MIN_BUF_SIZE = 16; -const MAX_CONSECUTIVE_EMPTY_READS = 100; -const CR = "\r".charCodeAt(0); -const LF = "\n".charCodeAt(0); - -export class BufferFullError extends Error { - name = "BufferFullError"; - constructor(public partial: Uint8Array) { - super("Buffer full"); - } -} - -export class PartialReadError extends Deno.errors.UnexpectedEof { - name = "PartialReadError"; - partial?: Uint8Array; - constructor() { - super("Encountered UnexpectedEof, data only partially read"); - } -} - -/** Result type returned by of BufReader.readLine(). */ -export interface ReadLineResult { - line: Uint8Array; - more: boolean; -} - -/** BufReader implements buffering for a Reader object. */ -export class BufReader implements Reader { - private buf!: Uint8Array; - private rd!: Reader; // Reader provided by caller. - private r = 0; // buf read position. - private w = 0; // buf write position. - private eof = false; - // private lastByte: number; - // private lastCharSize: number; - - /** return new BufReader unless r is BufReader */ - static create(r: Reader, size: number = DEFAULT_BUF_SIZE): BufReader { - return r instanceof BufReader ? r : new BufReader(r, size); - } - - constructor(rd: Reader, size: number = DEFAULT_BUF_SIZE) { - if (size < MIN_BUF_SIZE) { - size = MIN_BUF_SIZE; - } - this._reset(new Uint8Array(size), rd); - } - - /** Returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - buffered(): number { - return this.w - this.r; - } - - // Reads a new chunk into the buffer. - private async _fill(): Promise { - // Slide existing data to beginning. - if (this.r > 0) { - this.buf.copyWithin(0, this.r, this.w); - this.w -= this.r; - this.r = 0; - } - - if (this.w >= this.buf.byteLength) { - throw Error("bufio: tried to fill full buffer"); - } - - // Read new data: try a limited number of times. - for (let i = MAX_CONSECUTIVE_EMPTY_READS; i > 0; i--) { - const rr = await this.rd.read(this.buf.subarray(this.w)); - if (rr === null) { - this.eof = true; - return; - } - assert(rr >= 0, "negative read"); - this.w += rr; - if (rr > 0) { - return; - } - } - - throw new Error( - `No progress after ${MAX_CONSECUTIVE_EMPTY_READS} read() calls`, - ); - } - - /** Discards any buffered data, resets all state, and switches - * the buffered reader to read from r. - */ - reset(r: Reader): void { - this._reset(this.buf, r); - } - - private _reset(buf: Uint8Array, rd: Reader): void { - this.buf = buf; - this.rd = rd; - this.eof = false; - // this.lastByte = -1; - // this.lastCharSize = -1; - } - - /** reads data into p. - * It returns the number of bytes read into p. - * The bytes are taken from at most one Read on the underlying Reader, - * hence n may be less than len(p). - * To read exactly len(p) bytes, use io.ReadFull(b, p). - */ - async read(p: Uint8Array): Promise { - let rr: number | null = p.byteLength; - if (p.byteLength === 0) return rr; - - if (this.r === this.w) { - if (p.byteLength >= this.buf.byteLength) { - // Large read, empty buffer. - // Read directly into p to avoid copy. - const rr = await this.rd.read(p); - const nread = rr ?? 0; - assert(nread >= 0, "negative read"); - // if (rr.nread > 0) { - // this.lastByte = p[rr.nread - 1]; - // this.lastCharSize = -1; - // } - return rr; - } - - // One read. - // Do not use this.fill, which will loop. - this.r = 0; - this.w = 0; - rr = await this.rd.read(this.buf); - if (rr === 0 || rr === null) return rr; - assert(rr >= 0, "negative read"); - this.w += rr; - } - - // copy as much as we can - const copied = copy(this.buf.subarray(this.r, this.w), p, 0); - this.r += copied; - // this.lastByte = this.buf[this.r - 1]; - // this.lastCharSize = -1; - return copied; - } - - /** reads exactly `p.length` bytes into `p`. - * - * If successful, `p` is returned. - * - * If the end of the underlying stream has been reached, and there are no more - * bytes available in the buffer, `readFull()` returns `null` instead. - * - * An error is thrown if some bytes could be read, but not enough to fill `p` - * entirely before the underlying stream reported an error or EOF. Any error - * thrown will have a `partial` property that indicates the slice of the - * buffer that has been successfully filled with data. - * - * Ported from https://golang.org/pkg/io/#ReadFull - */ - async readFull(p: Uint8Array): Promise { - let bytesRead = 0; - while (bytesRead < p.length) { - try { - const rr = await this.read(p.subarray(bytesRead)); - if (rr === null) { - if (bytesRead === 0) { - return null; - } else { - throw new PartialReadError(); - } - } - bytesRead += rr; - } catch (err) { - err.partial = p.subarray(0, bytesRead); - throw err; - } - } - return p; - } - - /** Returns the next byte [0, 255] or `null`. */ - async readByte(): Promise { - while (this.r === this.w) { - if (this.eof) return null; - await this._fill(); // buffer is empty. - } - const c = this.buf[this.r]; - this.r++; - // this.lastByte = c; - return c; - } - - /** readString() reads until the first occurrence of delim in the input, - * returning a string containing the data up to and including the delimiter. - * If ReadString encounters an error before finding a delimiter, - * it returns the data read before the error and the error itself - * (often `null`). - * ReadString returns err != nil if and only if the returned data does not end - * in delim. - * For simple uses, a Scanner may be more convenient. - */ - async readString(delim: string): Promise { - if (delim.length !== 1) { - throw new Error("Delimiter should be a single character"); - } - const buffer = await this.readSlice(delim.charCodeAt(0)); - if (buffer === null) return null; - return new TextDecoder().decode(buffer); - } - - /** `readLine()` is a low-level line-reading primitive. Most callers should - * use `readString('\n')` instead or use a Scanner. - * - * `readLine()` tries to return a single line, not including the end-of-line - * bytes. If the line was too long for the buffer then `more` is set and the - * beginning of the line is returned. The rest of the line will be returned - * from future calls. `more` will be false when returning the last fragment - * of the line. The returned buffer is only valid until the next call to - * `readLine()`. - * - * The text returned from ReadLine does not include the line end ("\r\n" or - * "\n"). - * - * When the end of the underlying stream is reached, the final bytes in the - * stream are returned. No indication or error is given if the input ends - * without a final line end. When there are no more trailing bytes to read, - * `readLine()` returns `null`. - * - * Calling `unreadByte()` after `readLine()` will always unread the last byte - * read (possibly a character belonging to the line end) even if that byte is - * not part of the line returned by `readLine()`. - */ - async readLine(): Promise { - let line: Uint8Array | null; - - try { - line = await this.readSlice(LF); - } catch (err) { - let { partial } = err; - assert( - partial instanceof Uint8Array, - "bufio: caught error from `readSlice()` without `partial` property", - ); - - // Don't throw if `readSlice()` failed with `BufferFullError`, instead we - // just return whatever is available and set the `more` flag. - if (!(err instanceof BufferFullError)) { - throw err; - } - - // Handle the case where "\r\n" straddles the buffer. - if ( - !this.eof && - partial.byteLength > 0 && - partial[partial.byteLength - 1] === CR - ) { - // Put the '\r' back on buf and drop it from line. - // Let the next call to ReadLine check for "\r\n". - assert(this.r > 0, "bufio: tried to rewind past start of buffer"); - this.r--; - partial = partial.subarray(0, partial.byteLength - 1); - } - - return { line: partial, more: !this.eof }; - } - - if (line === null) { - return null; - } - - if (line.byteLength === 0) { - return { line, more: false }; - } - - if (line[line.byteLength - 1] == LF) { - let drop = 1; - if (line.byteLength > 1 && line[line.byteLength - 2] === CR) { - drop = 2; - } - line = line.subarray(0, line.byteLength - drop); - } - return { line, more: false }; - } - - /** `readSlice()` reads until the first occurrence of `delim` in the input, - * returning a slice pointing at the bytes in the buffer. The bytes stop - * being valid at the next read. - * - * If `readSlice()` encounters an error before finding a delimiter, or the - * buffer fills without finding a delimiter, it throws an error with a - * `partial` property that contains the entire buffer. - * - * If `readSlice()` encounters the end of the underlying stream and there are - * any bytes left in the buffer, the rest of the buffer is returned. In other - * words, EOF is always treated as a delimiter. Once the buffer is empty, - * it returns `null`. - * - * Because the data returned from `readSlice()` will be overwritten by the - * next I/O operation, most clients should use `readString()` instead. - */ - async readSlice(delim: number): Promise { - let s = 0; // search start index - let slice: Uint8Array | undefined; - - while (true) { - // Search buffer. - let i = this.buf.subarray(this.r + s, this.w).indexOf(delim); - if (i >= 0) { - i += s; - slice = this.buf.subarray(this.r, this.r + i + 1); - this.r += i + 1; - break; - } - - // EOF? - if (this.eof) { - if (this.r === this.w) { - return null; - } - slice = this.buf.subarray(this.r, this.w); - this.r = this.w; - break; - } - - // Buffer full? - if (this.buffered() >= this.buf.byteLength) { - this.r = this.w; - // #4521 The internal buffer should not be reused across reads because it causes corruption of data. - const oldbuf = this.buf; - const newbuf = this.buf.slice(0); - this.buf = newbuf; - throw new BufferFullError(oldbuf); - } - - s = this.w - this.r; // do not rescan area we scanned before - - // Buffer is not full. - try { - await this._fill(); - } catch (err) { - err.partial = slice; - throw err; - } - } - - // Handle last byte, if any. - // const i = slice.byteLength - 1; - // if (i >= 0) { - // this.lastByte = slice[i]; - // this.lastCharSize = -1 - // } - - return slice; - } - - /** `peek()` returns the next `n` bytes without advancing the reader. The - * bytes stop being valid at the next read call. - * - * When the end of the underlying stream is reached, but there are unread - * bytes left in the buffer, those bytes are returned. If there are no bytes - * left in the buffer, it returns `null`. - * - * If an error is encountered before `n` bytes are available, `peek()` throws - * an error with the `partial` property set to a slice of the buffer that - * contains the bytes that were available before the error occurred. - */ - async peek(n: number): Promise { - if (n < 0) { - throw Error("negative count"); - } - - let avail = this.w - this.r; - while (avail < n && avail < this.buf.byteLength && !this.eof) { - try { - await this._fill(); - } catch (err) { - err.partial = this.buf.subarray(this.r, this.w); - throw err; - } - avail = this.w - this.r; - } - - if (avail === 0 && this.eof) { - return null; - } else if (avail < n && this.eof) { - return this.buf.subarray(this.r, this.r + avail); - } else if (avail < n) { - throw new BufferFullError(this.buf.subarray(this.r, this.w)); - } - - return this.buf.subarray(this.r, this.r + n); - } -} - -abstract class AbstractBufBase { - buf!: Uint8Array; - usedBufferBytes = 0; - err: Error | null = null; - - /** Size returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - /** Returns how many bytes are unused in the buffer. */ - available(): number { - return this.buf.byteLength - this.usedBufferBytes; - } - - /** buffered returns the number of bytes that have been written into the - * current buffer. - */ - buffered(): number { - return this.usedBufferBytes; - } -} - -/** BufWriter implements buffering for an deno.Writer object. - * If an error occurs writing to a Writer, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.Writer. - */ -export class BufWriter extends AbstractBufBase implements Writer { - /** return new BufWriter unless writer is BufWriter */ - static create(writer: Writer, size: number = DEFAULT_BUF_SIZE): BufWriter { - return writer instanceof BufWriter ? writer : new BufWriter(writer, size); - } - - constructor(private writer: Writer, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: Writer): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.Writer. */ - async flush(): Promise { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - await Deno.writeAll( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - async write(data: Uint8Array): Promise { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = await this.writer.write(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - await this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** BufWriterSync implements buffering for a deno.WriterSync object. - * If an error occurs writing to a WriterSync, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.WriterSync. - */ -export class BufWriterSync extends AbstractBufBase implements WriterSync { - /** return new BufWriterSync unless writer is BufWriterSync */ - static create( - writer: WriterSync, - size: number = DEFAULT_BUF_SIZE, - ): BufWriterSync { - return writer instanceof BufWriterSync - ? writer - : new BufWriterSync(writer, size); - } - - constructor(private writer: WriterSync, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: WriterSync): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.WriterSync. */ - flush(): void { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - Deno.writeAllSync( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - writeSync(data: Uint8Array): number { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = this.writer.writeSync(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** Generate longest proper prefix which is also suffix array. */ -function createLPS(pat: Uint8Array): Uint8Array { - const lps = new Uint8Array(pat.length); - lps[0] = 0; - let prefixEnd = 0; - let i = 1; - while (i < lps.length) { - if (pat[i] == pat[prefixEnd]) { - prefixEnd++; - lps[i] = prefixEnd; - i++; - } else if (prefixEnd === 0) { - lps[i] = 0; - i++; - } else { - prefixEnd = pat[prefixEnd - 1]; - } - } - return lps; -} - -/** Read delimited bytes from a Reader. */ -export async function* readDelim( - reader: Reader, - delim: Uint8Array, -): AsyncIterableIterator { - // Avoid unicode problems - const delimLen = delim.length; - const delimLPS = createLPS(delim); - - let inputBuffer = new Deno.Buffer(); - const inspectArr = new Uint8Array(Math.max(1024, delimLen + 1)); - - // Modified KMP - let inspectIndex = 0; - let matchIndex = 0; - while (true) { - const result = await reader.read(inspectArr); - if (result === null) { - // Yield last chunk. - yield inputBuffer.bytes(); - return; - } - if ((result as number) < 0) { - // Discard all remaining and silently fail. - return; - } - const sliceRead = inspectArr.subarray(0, result as number); - await Deno.writeAll(inputBuffer, sliceRead); - - let sliceToProcess = inputBuffer.bytes(); - while (inspectIndex < sliceToProcess.length) { - if (sliceToProcess[inspectIndex] === delim[matchIndex]) { - inspectIndex++; - matchIndex++; - if (matchIndex === delimLen) { - // Full match - const matchEnd = inspectIndex - delimLen; - const readyBytes = sliceToProcess.subarray(0, matchEnd); - // Copy - const pendingBytes = sliceToProcess.slice(inspectIndex); - yield readyBytes; - // Reset match, different from KMP. - sliceToProcess = pendingBytes; - inspectIndex = 0; - matchIndex = 0; - } - } else { - if (matchIndex === 0) { - inspectIndex++; - } else { - matchIndex = delimLPS[matchIndex - 1]; - } - } - } - // Keep inspectIndex and matchIndex. - inputBuffer = new Deno.Buffer(sliceToProcess); - } -} - -/** Read delimited strings from a Reader. */ -export async function* readStringDelim( - reader: Reader, - delim: string, -): AsyncIterableIterator { - const encoder = new TextEncoder(); - const decoder = new TextDecoder(); - for await (const chunk of readDelim(reader, encoder.encode(delim))) { - yield decoder.decode(chunk); - } -} - -/** Read strings line-by-line from a Reader. */ -export async function* readLines( - reader: Reader, -): AsyncIterableIterator { - for await (let chunk of readStringDelim(reader, "\n")) { - // Finding a CR at the end of the line is evidence of a - // "\r\n" at the end of the line. The "\r" part should be - // removed too. - if (chunk.endsWith("\r")) { - chunk = chunk.slice(0, -1); - } - yield chunk; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1133466265e7072d7293c6c60857590974a94e3e.ts b/crates/swc_bundler/tests/.cache/deno/1133466265e7072d7293c6c60857590974a94e3e.ts deleted file mode 100644 index c40f251a6765..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1133466265e7072d7293c6c60857590974a94e3e.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/partialObject.js - - -import mergeDeepRight from './mergeDeepRight.js'; -import _curry2 from './internal/_curry2.js'; - -/** - * Takes a function `f` and an object, and returns a function `g`. - * When applied, `g` returns the result of applying `f` to the object - * provided initially merged deeply (right) with the object provided as an argument to `g`. - * - * @func - * @memberOf R - * @category Function - * @sig (({ a, b, c, ..., n }) -> x) -> { a, b, c, ...} -> ({ d, e, f, ..., n } -> x) - * @param {Function} f - * @param {Object} props - * @return {Function} - * @see R.partial, R.partialRight, R.curry, R.mergeDeepRight - * @example - * - * const multiply2 = ({ a, b }) => a * b; - * const double = R.partialObject(multiply2, { a: 2 }); - * double({ b: 2 }); //=> 4 - * - * const greet = ({ salutation, title, firstName, lastName }) => - * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; - * - * const sayHello = R.partialObject(greet, { salutation: 'Hello' }); - * const sayHelloToMs = R.partialObject(sayHello, { title: 'Ms.' }); - * sayHelloToMs({ firstName: 'Jane', lastName: 'Jones' }); //=> 'Hello, Ms. Jane Jones!' - * @symb R.partialObject(f, { a, b })({ c, d }) = f({ a, b, c, d }) - */ - -export default _curry2((f, o) => (props) => f.call(this, mergeDeepRight(o, props))); diff --git a/crates/swc_bundler/tests/.cache/deno/11349b40e4bb0ed8d54e10349a3f20d8763b3eab.ts b/crates/swc_bundler/tests/.cache/deno/11349b40e4bb0ed8d54e10349a3f20d8763b3eab.ts deleted file mode 100644 index e810bf293c73..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11349b40e4bb0ed8d54e10349a3f20d8763b3eab.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/objectValues.js - - -/* eslint-disable no-redeclare */ -// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/2221 -const objectValues = Object.values || (obj => Object.keys(obj).map(key => obj[key])); - -export default objectValues; \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/115a40773b0e1166b5298d48028e9f966d50d7c4.ts b/crates/swc_bundler/tests/.cache/deno/115a40773b0e1166b5298d48028e9f966d50d7c4.ts deleted file mode 100644 index 4339de2e5b26..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/115a40773b0e1166b5298d48028e9f966d50d7c4.ts +++ /dev/null @@ -1,77 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/separateOperations.js - - -import { Kind } from '../language/kinds.js'; -import { visit } from '../language/visitor.js'; - -/** - * separateOperations accepts a single AST document which may contain many - * operations and fragments and returns a collection of AST documents each of - * which contains a single operation as well the fragment definitions it - * refers to. - */ -export function separateOperations(documentAST) { - const operations = []; - const depGraph = Object.create(null); - let fromName; // Populate metadata and build a dependency graph. - - visit(documentAST, { - OperationDefinition(node) { - fromName = opName(node); - operations.push(node); - }, - - FragmentDefinition(node) { - fromName = node.name.value; - }, - - FragmentSpread(node) { - const toName = node.name.value; - let dependents = depGraph[fromName]; - - if (dependents === undefined) { - dependents = depGraph[fromName] = Object.create(null); - } - - dependents[toName] = true; - } - - }); // For each operation, produce a new synthesized AST which includes only what - // is necessary for completing that operation. - - const separatedDocumentASTs = Object.create(null); - - for (const operation of operations) { - const operationName = opName(operation); - const dependencies = Object.create(null); - collectTransitiveDependencies(dependencies, depGraph, operationName); // The list of definition nodes to be included for this operation, sorted - // to retain the same order as the original document. - - separatedDocumentASTs[operationName] = { - kind: Kind.DOCUMENT, - definitions: documentAST.definitions.filter(node => node === operation || node.kind === Kind.FRAGMENT_DEFINITION && dependencies[node.name.value]) - }; - } - - return separatedDocumentASTs; -} - -// Provides the empty string for anonymous operations. -function opName(operation) { - return operation.name ? operation.name.value : ''; -} // From a dependency graph, collects a list of transitive dependencies by -// recursing through a dependency graph. - - -function collectTransitiveDependencies(collected, depGraph, fromName) { - const immediateDeps = depGraph[fromName]; - - if (immediateDeps) { - for (const toName of Object.keys(immediateDeps)) { - if (!collected[toName]) { - collected[toName] = true; - collectTransitiveDependencies(collected, depGraph, toName); - } - } - } -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/115e402f22b76a4d9cf60ca6db4f6eb2d8e968aa.ts b/crates/swc_bundler/tests/.cache/deno/115e402f22b76a4d9cf60ca6db4f6eb2d8e968aa.ts deleted file mode 100644 index 9492b1a79402..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/115e402f22b76a4d9cf60ca6db4f6eb2d8e968aa.ts +++ /dev/null @@ -1,205 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/PNGEncoder.ts - - -import { IOBuffer } from './iobuffer/IOBuffer.ts'; -import { deflate } from './pako/index.js'; - -import { pngSignature, crc } from './common.ts'; -import { - DeflateFunctionOptions, - IPNGEncoderOptions, - IImageData, - IDecodedPNG, - PNGDataArray, - BitDepth, -} from './types.ts'; -import { - ColorType, - CompressionMethod, - FilterMethod, - InterlaceMethod, -} from './internalTypes.ts'; - -const defaultZlibOptions: DeflateFunctionOptions = { - level: 3, -}; - -export default class PNGEncoder extends IOBuffer { - private _png: IDecodedPNG; - private _zlibOptions: DeflateFunctionOptions; - private _colorType: ColorType; - - public constructor(data: IImageData, options: IPNGEncoderOptions = {}) { - super(); - this._colorType = ColorType.UNKNOWN; - this._zlibOptions = Object.assign({}, defaultZlibOptions, options.zlib); - this._png = this._checkData(data); - this.setBigEndian(); - } - - public encode(): Uint8Array { - this.encodeSignature(); - this.encodeIHDR(); - this.encodeData(); - this.encodeIEND(); - return this.toArray(); - } - - // https://www.w3.org/TR/PNG/#5PNG-file-signature - private encodeSignature(): void { - this.writeBytes(pngSignature); - } - - // https://www.w3.org/TR/PNG/#11IHDR - private encodeIHDR(): void { - this.writeUint32(13); - - this.writeChars('IHDR'); - - this.writeUint32(this._png.width); - this.writeUint32(this._png.height); - this.writeByte(this._png.depth); - this.writeByte(this._colorType); - this.writeByte(CompressionMethod.DEFLATE); - this.writeByte(FilterMethod.ADAPTIVE); - this.writeByte(InterlaceMethod.NO_INTERLACE); - - this.writeCrc(17); - } - - // https://www.w3.org/TR/PNG/#11IEND - private encodeIEND(): void { - this.writeUint32(0); - - this.writeChars('IEND'); - - this.writeCrc(4); - } - - // https://www.w3.org/TR/PNG/#11IDAT - private encodeIDAT(data: PNGDataArray): void { - this.writeUint32(data.length); - - this.writeChars('IDAT'); - - this.writeBytes(data); - - this.writeCrc(data.length + 4); - } - - private encodeData(): void { - const { width, height, channels, depth, data } = this._png; - const slotsPerLine = channels * width; - const newData = new IOBuffer().setBigEndian(); - let offset = 0; - for (let i = 0; i < height; i++) { - newData.writeByte(0); // no filter - /* istanbul ignore else */ - if (depth === 8) { - offset = writeDataBytes(data, newData, slotsPerLine, offset); - } else if (depth === 16) { - offset = writeDataUint16(data, newData, slotsPerLine, offset); - } else { - throw new Error('unreachable'); - } - } - const buffer = newData.toArray(); - const compressed = deflate(buffer, this._zlibOptions); - this.encodeIDAT(compressed); - } - - private _checkData(data: IImageData): IDecodedPNG { - const { colorType, channels, depth } = getColorType(data); - const png: IDecodedPNG = { - width: checkInteger(data.width, 'width'), - height: checkInteger(data.height, 'height'), - channels: channels, - data: data.data, - depth: depth, - text: {}, - }; - this._colorType = colorType; - const expectedSize = png.width * png.height * channels; - if (png.data.length !== expectedSize) { - throw new RangeError( - `wrong data size. Found ${png.data.length}, expected ${expectedSize}`, - ); - } - return png; - } - - private writeCrc(length: number): void { - this.writeUint32( - crc( - new Uint8Array( - this.buffer, - this.byteOffset + this.offset - length, - length, - ), - length, - ), - ); - } -} - -function checkInteger(value: number, name: string): number { - if (Number.isInteger(value) && value > 0) { - return value; - } - throw new TypeError(`${name} must be a positive integer`); -} - -function getColorType( - data: IImageData, -): { channels: number; depth: BitDepth; colorType: ColorType } { - const { channels = 4, depth = 8 } = data; - if (channels !== 4 && channels !== 3 && channels !== 2 && channels !== 1) { - throw new RangeError(`unsupported number of channels: ${channels}`); - } - if (depth !== 8 && depth !== 16) { - throw new RangeError(`unsupported bit depth: ${depth}`); - } - - const returnValue = { channels, depth, colorType: ColorType.UNKNOWN }; - switch (channels) { - case 4: - returnValue.colorType = ColorType.TRUECOLOUR_ALPHA; - break; - case 3: - returnValue.colorType = ColorType.TRUECOLOUR; - break; - case 1: - returnValue.colorType = ColorType.GREYSCALE; - break; - case 2: - returnValue.colorType = ColorType.GREYSCALE_ALPHA; - break; - default: - throw new Error(`unsupported number of channels: ${channels}`); - } - return returnValue; -} - -function writeDataBytes( - data: PNGDataArray, - newData: IOBuffer, - slotsPerLine: number, - offset: number, -): number { - for (let j = 0; j < slotsPerLine; j++) { - newData.writeByte(data[offset++]); - } - return offset; -} - -function writeDataUint16( - data: PNGDataArray, - newData: IOBuffer, - slotsPerLine: number, - offset: number, -): number { - for (let j = 0; j < slotsPerLine; j++) { - newData.writeUint16(data[offset++]); - } - return offset; -} diff --git a/crates/swc_bundler/tests/.cache/deno/116ba6253b5d5bd32254969887c98bbcea71684a.ts b/crates/swc_bundler/tests/.cache/deno/116ba6253b5d5bd32254969887c98bbcea71684a.ts deleted file mode 100644 index 544ad42d00ad..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/116ba6253b5d5bd32254969887c98bbcea71684a.ts +++ /dev/null @@ -1,63 +0,0 @@ -// Loaded from https://deno.land/std@0.89.0/io/readers.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// Based on https://github.com/golang/go/blob/0452f9460f50f0f0aba18df43dc2b31906fb66cc/src/io/io.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/** Reader utility for strings */ -export class StringReader extends Deno.Buffer { - constructor(s: string) { - super(new TextEncoder().encode(s).buffer); - } -} - -/** Reader utility for combining multiple readers */ -export class MultiReader implements Deno.Reader { - private readonly readers: Deno.Reader[]; - private currentIndex = 0; - - constructor(...readers: Deno.Reader[]) { - this.readers = readers; - } - - async read(p: Uint8Array): Promise { - const r = this.readers[this.currentIndex]; - if (!r) return null; - const result = await r.read(p); - if (result === null) { - this.currentIndex++; - return 0; - } - return result; - } -} - -/** - * A `LimitedReader` reads from `reader` but limits the amount of data returned to just `limit` bytes. - * Each call to `read` updates `limit` to reflect the new amount remaining. - * `read` returns `null` when `limit` <= `0` or - * when the underlying `reader` returns `null`. - */ -export class LimitedReader implements Deno.Reader { - constructor(public reader: Deno.Reader, public limit: number) {} - - async read(p: Uint8Array): Promise { - if (this.limit <= 0) { - return null; - } - - if (p.length > this.limit) { - p = p.subarray(0, this.limit); - } - const n = await this.reader.read(p); - if (n == null) { - return null; - } - - this.limit -= n; - return n; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/11731133752a9f2dfb2bc8c2653138a5fbcbd000.ts b/crates/swc_bundler/tests/.cache/deno/11731133752a9f2dfb2bc8c2653138a5fbcbd000.ts deleted file mode 100644 index e86dd0050625..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11731133752a9f2dfb2bc8c2653138a5fbcbd000.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/mergeWithKey.js - - -import _curry3 from './internal/_curry3.js'; -import _has from './internal/_has.js'; - - -/** - * Creates a new object with the own properties of the two provided objects. If - * a key exists in both objects, the provided function is applied to the key - * and the values associated with the key in each object, with the result being - * used as the value associated with the key in the returned object. - * - * @func - * @memberOf R - * @since v0.19.0 - * @category Object - * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a} - * @param {Function} fn - * @param {Object} l - * @param {Object} r - * @return {Object} - * @see R.mergeDeepWithKey, R.merge, R.mergeWith - * @example - * - * let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r - * R.mergeWithKey(concatValues, - * { a: true, thing: 'foo', values: [10, 20] }, - * { b: true, thing: 'bar', values: [15, 35] }); - * //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] } - * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 } - */ -var mergeWithKey = _curry3(function mergeWithKey(fn, l, r) { - var result = {}; - var k; - - for (k in l) { - if (_has(k, l)) { - result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k]; - } - } - - for (k in r) { - if (_has(k, r) && !(_has(k, result))) { - result[k] = r[k]; - } - } - - return result; -}); -export default mergeWithKey; diff --git a/crates/swc_bundler/tests/.cache/deno/11921180889ceb1e2e8489fd1fb40e2bb2475b4b.ts b/crates/swc_bundler/tests/.cache/deno/11921180889ceb1e2e8489fd1fb40e2bb2475b4b.ts deleted file mode 100644 index e429e0dc677c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11921180889ceb1e2e8489fd1fb40e2bb2475b4b.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/zlib/zlib/gzheader.ts - - -export default class GZheader { - /* true if compressed data believed to be text */ - text: number = 0; - /* modification time */ - time: number = 0; - /* extra flags (not used when writing a gzip file) */ - xflags: number = 0; - /* operating system */ - os: number = 0; - /* pointer to extra field or Z_NULL if none */ - extra: any = null; - /* extra field length (valid if extra != Z_NULL) */ - extra_len: number = 0; // Actually, we don't need it in JS, - // but leave for few code modifications - - // - // Setup limits is not necessary because in js we should not preallocate memory - // for inflate use constant limit in 65536 bytes - // - - /* space at extra (only when reading header) */ - // extra_max = 0; - /* pointer to zero-terminated file name or Z_NULL */ - name: string = ""; - /* space at name (only when reading header) */ - // name_max = 0; - /* pointer to zero-terminated comment or Z_NULL */ - comment: string = ""; - /* space at comment (only when reading header) */ - // comm_max = 0; - /* true if there was or will be a header crc */ - hcrc: number = 0; - /* true when done reading gzip header (not used when writing a gzip file) */ - done: boolean = false; -} diff --git a/crates/swc_bundler/tests/.cache/deno/119f1607e3e28768f400a64e01095baf828bcf81.ts b/crates/swc_bundler/tests/.cache/deno/119f1607e3e28768f400a64e01095baf828bcf81.ts deleted file mode 100644 index 9a0f0a49a0cf..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/119f1607e3e28768f400a64e01095baf828bcf81.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/abc@v1.2.4/vendor/https/deno.land/std/mime/multipart.ts - - -export * from "https://deno.land/std@0.81.0/mime/multipart.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/11a4de00d24d9b82a70c0195ef88b69a637e4cc5.ts b/crates/swc_bundler/tests/.cache/deno/11a4de00d24d9b82a70c0195ef88b69a637e4cc5.ts deleted file mode 100644 index 5b8105f045b8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11a4de00d24d9b82a70c0195ef88b69a637e4cc5.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/async/deferred.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// TODO(ry) It'd be better to make Deferred a class that inherits from -// Promise, rather than an interface. This is possible in ES2016, however -// typescript produces broken code when targeting ES5 code. -// See https://github.com/Microsoft/TypeScript/issues/15202 -// At the time of writing, the github issue is closed but the problem remains. -export interface Deferred extends Promise { - resolve(value?: T | PromiseLike): void; - // deno-lint-ignore no-explicit-any - reject(reason?: any): void; -} - -/** Creates a Promise with the `reject` and `resolve` functions - * placed as methods on the promise object itself. It allows you to do: - * - * const p = deferred(); - * // ... - * p.resolve(42); - */ -export function deferred(): Deferred { - let methods; - const promise = new Promise((resolve, reject): void => { - methods = { resolve, reject }; - }); - return Object.assign(promise, methods) as Deferred; -} diff --git a/crates/swc_bundler/tests/.cache/deno/11ae24958a62172fdc6378c70238c9b5d5807de9.ts b/crates/swc_bundler/tests/.cache/deno/11ae24958a62172fdc6378c70238c9b5d5807de9.ts deleted file mode 100644 index 16d55c79c77c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11ae24958a62172fdc6378c70238c9b5d5807de9.ts +++ /dev/null @@ -1,570 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/node/events.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// Copyright (c) 2019 Denolibs authors. All rights reserved. MIT license. -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -import { validateIntegerRange } from "./_utils.ts"; -import { assert } from "../_util/assert.ts"; - -// deno-lint-ignore no-explicit-any -export type GenericFunction = (...args: any[]) => any; - -export interface WrappedFunction extends Function { - listener: GenericFunction; -} - -// deno-lint-ignore no-explicit-any -function createIterResult(value: any, done: boolean): IteratorResult { - return { value, done }; -} - -interface AsyncIterable { - // deno-lint-ignore no-explicit-any - next(): Promise>; - // deno-lint-ignore no-explicit-any - return(): Promise>; - throw(err: Error): void; - // deno-lint-ignore no-explicit-any - [Symbol.asyncIterator](): any; -} - -export let defaultMaxListeners = 10; - -/** - * See also https://nodejs.org/api/events.html - */ -export class EventEmitter { - public static captureRejectionSymbol = Symbol.for("nodejs.rejection"); - public static errorMonitor = Symbol("events.errorMonitor"); - public static get defaultMaxListeners() { - return defaultMaxListeners; - } - public static set defaultMaxListeners(value: number) { - defaultMaxListeners = value; - } - - private maxListeners: number | undefined; - private _events: Map< - string | symbol, - Array - >; - - public constructor() { - this._events = new Map(); - } - - private _addListener( - eventName: string | symbol, - listener: GenericFunction | WrappedFunction, - prepend: boolean, - ): this { - this.emit("newListener", eventName, listener); - if (this._events.has(eventName)) { - const listeners = this._events.get(eventName) as Array< - GenericFunction | WrappedFunction - >; - if (prepend) { - listeners.unshift(listener); - } else { - listeners.push(listener); - } - } else { - this._events.set(eventName, [listener]); - } - const max = this.getMaxListeners(); - if (max > 0 && this.listenerCount(eventName) > max) { - const warning = new Error( - `Possible EventEmitter memory leak detected. - ${this.listenerCount(eventName)} ${eventName.toString()} listeners. - Use emitter.setMaxListeners() to increase limit`, - ); - warning.name = "MaxListenersExceededWarning"; - console.warn(warning); - } - - return this; - } - - /** Alias for emitter.on(eventName, listener). */ - public addListener( - eventName: string | symbol, - listener: GenericFunction | WrappedFunction, - ): this { - return this._addListener(eventName, listener, false); - } - - /** - * Synchronously calls each of the listeners registered for the event named - * eventName, in the order they were registered, passing the supplied - * arguments to each. - * @return true if the event had listeners, false otherwise - */ - // deno-lint-ignore no-explicit-any - public emit(eventName: string | symbol, ...args: any[]): boolean { - if (this._events.has(eventName)) { - if ( - eventName === "error" && - this._events.get(EventEmitter.errorMonitor) - ) { - this.emit(EventEmitter.errorMonitor, ...args); - } - const listeners = (this._events.get( - eventName, - ) as GenericFunction[]).slice(); // We copy with slice() so array is not mutated during emit - for (const listener of listeners) { - try { - listener.apply(this, args); - } catch (err) { - this.emit("error", err); - } - } - return true; - } else if (eventName === "error") { - if (this._events.get(EventEmitter.errorMonitor)) { - this.emit(EventEmitter.errorMonitor, ...args); - } - const errMsg = args.length > 0 ? args[0] : Error("Unhandled error."); - throw errMsg; - } - return false; - } - - /** - * Returns an array listing the events for which the emitter has - * registered listeners. - */ - public eventNames(): [string | symbol] { - return Array.from(this._events.keys()) as [string | symbol]; - } - - /** - * Returns the current max listener value for the EventEmitter which is - * either set by emitter.setMaxListeners(n) or defaults to - * EventEmitter.defaultMaxListeners. - */ - public getMaxListeners(): number { - return this.maxListeners || EventEmitter.defaultMaxListeners; - } - - /** - * Returns the number of listeners listening to the event named - * eventName. - */ - public listenerCount(eventName: string | symbol): number { - if (this._events.has(eventName)) { - return (this._events.get(eventName) as GenericFunction[]).length; - } else { - return 0; - } - } - - static listenerCount( - emitter: EventEmitter, - eventName: string | symbol, - ): number { - return emitter.listenerCount(eventName); - } - - private _listeners( - target: EventEmitter, - eventName: string | symbol, - unwrap: boolean, - ): GenericFunction[] { - if (!target._events.has(eventName)) { - return []; - } - const eventListeners = target._events.get(eventName) as GenericFunction[]; - - return unwrap - ? this.unwrapListeners(eventListeners) - : eventListeners.slice(0); - } - - private unwrapListeners(arr: GenericFunction[]): GenericFunction[] { - const unwrappedListeners = new Array(arr.length) as GenericFunction[]; - for (let i = 0; i < arr.length; i++) { - // deno-lint-ignore no-explicit-any - unwrappedListeners[i] = (arr[i] as any)["listener"] || arr[i]; - } - return unwrappedListeners; - } - - /** Returns a copy of the array of listeners for the event named eventName.*/ - public listeners(eventName: string | symbol): GenericFunction[] { - return this._listeners(this, eventName, true); - } - - /** - * Returns a copy of the array of listeners for the event named eventName, - * including any wrappers (such as those created by .once()). - */ - public rawListeners( - eventName: string | symbol, - ): Array { - return this._listeners(this, eventName, false); - } - - /** Alias for emitter.removeListener(). */ - public off(eventName: string | symbol, listener: GenericFunction): this { - return this.removeListener(eventName, listener); - } - - /** - * Adds the listener function to the end of the listeners array for the event - * named eventName. No checks are made to see if the listener has already - * been added. Multiple calls passing the same combination of eventName and - * listener will result in the listener being added, and called, multiple - * times. - */ - public on( - eventName: string | symbol, - listener: GenericFunction | WrappedFunction, - ): this { - return this._addListener(eventName, listener, false); - } - - /** - * Adds a one-time listener function for the event named eventName. The next - * time eventName is triggered, this listener is removed and then invoked. - */ - public once(eventName: string | symbol, listener: GenericFunction): this { - const wrapped: WrappedFunction = this.onceWrap(eventName, listener); - this.on(eventName, wrapped); - return this; - } - - // Wrapped function that calls EventEmitter.removeListener(eventName, self) on execution. - private onceWrap( - eventName: string | symbol, - listener: GenericFunction, - ): WrappedFunction { - const wrapper = function ( - this: { - eventName: string | symbol; - listener: GenericFunction; - rawListener: GenericFunction | WrappedFunction; - context: EventEmitter; - }, - // deno-lint-ignore no-explicit-any - ...args: any[] - ): void { - this.context.removeListener( - this.eventName, - this.rawListener as GenericFunction, - ); - this.listener.apply(this.context, args); - }; - const wrapperContext = { - eventName: eventName, - listener: listener, - rawListener: (wrapper as unknown) as WrappedFunction, - context: this, - }; - const wrapped = (wrapper.bind( - wrapperContext, - ) as unknown) as WrappedFunction; - wrapperContext.rawListener = wrapped; - wrapped.listener = listener; - return wrapped as WrappedFunction; - } - - /** - * Adds the listener function to the beginning of the listeners array for the - * event named eventName. No checks are made to see if the listener has - * already been added. Multiple calls passing the same combination of - * eventName and listener will result in the listener being added, and - * called, multiple times. - */ - public prependListener( - eventName: string | symbol, - listener: GenericFunction | WrappedFunction, - ): this { - return this._addListener(eventName, listener, true); - } - - /** - * Adds a one-time listener function for the event named eventName to the - * beginning of the listeners array. The next time eventName is triggered, - * this listener is removed, and then invoked. - */ - public prependOnceListener( - eventName: string | symbol, - listener: GenericFunction, - ): this { - const wrapped: WrappedFunction = this.onceWrap(eventName, listener); - this.prependListener(eventName, wrapped); - return this; - } - - /** Removes all listeners, or those of the specified eventName. */ - public removeAllListeners(eventName?: string | symbol): this { - if (this._events === undefined) { - return this; - } - - if (eventName) { - if (this._events.has(eventName)) { - const listeners = (this._events.get(eventName) as Array< - GenericFunction | WrappedFunction - >).slice(); // Create a copy; We use it AFTER it's deleted. - this._events.delete(eventName); - for (const listener of listeners) { - this.emit("removeListener", eventName, listener); - } - } - } else { - const eventList: [string | symbol] = this.eventNames(); - eventList.map((value: string | symbol) => { - this.removeAllListeners(value); - }); - } - - return this; - } - - /** - * Removes the specified listener from the listener array for the event - * named eventName. - */ - public removeListener( - eventName: string | symbol, - listener: GenericFunction, - ): this { - if (this._events.has(eventName)) { - const arr: - | Array - | undefined = this._events.get(eventName); - - assert(arr); - - let listenerIndex = -1; - for (let i = arr.length - 1; i >= 0; i--) { - // arr[i]["listener"] is the reference to the listener inside a bound 'once' wrapper - if ( - arr[i] == listener || - (arr[i] && (arr[i] as WrappedFunction)["listener"] == listener) - ) { - listenerIndex = i; - break; - } - } - - if (listenerIndex >= 0) { - arr.splice(listenerIndex, 1); - this.emit("removeListener", eventName, listener); - if (arr.length === 0) { - this._events.delete(eventName); - } - } - } - return this; - } - - /** - * By default EventEmitters will print a warning if more than 10 listeners - * are added for a particular event. This is a useful default that helps - * finding memory leaks. Obviously, not all events should be limited to just - * 10 listeners. The emitter.setMaxListeners() method allows the limit to be - * modified for this specific EventEmitter instance. The value can be set to - * Infinity (or 0) to indicate an unlimited number of listeners. - */ - public setMaxListeners(n: number): this { - if (n !== Infinity) { - if (n === 0) { - n = Infinity; - } else { - validateIntegerRange(n, "maxListeners", 0); - } - } - - this.maxListeners = n; - return this; - } - - /** - * Creates a Promise that is fulfilled when the EventEmitter emits the given - * event or that is rejected when the EventEmitter emits 'error'. The Promise - * will resolve with an array of all the arguments emitted to the given event. - */ - public static once( - emitter: EventEmitter | EventTarget, - name: string, - // deno-lint-ignore no-explicit-any - ): Promise { - return new Promise((resolve, reject) => { - if (emitter instanceof EventTarget) { - // EventTarget does not have `error` event semantics like Node - // EventEmitters, we do not listen to `error` events here. - emitter.addEventListener( - name, - (...args) => { - resolve(args); - }, - { once: true, passive: false, capture: false }, - ); - return; - } else if (emitter instanceof EventEmitter) { - // deno-lint-ignore no-explicit-any - const eventListener = (...args: any[]): void => { - if (errorListener !== undefined) { - emitter.removeListener("error", errorListener); - } - resolve(args); - }; - let errorListener: GenericFunction; - - // Adding an error listener is not optional because - // if an error is thrown on an event emitter we cannot - // guarantee that the actual event we are waiting will - // be fired. The result could be a silent way to create - // memory or file descriptor leaks, which is something - // we should avoid. - if (name !== "error") { - // deno-lint-ignore no-explicit-any - errorListener = (err: any): void => { - emitter.removeListener(name, eventListener); - reject(err); - }; - - emitter.once("error", errorListener); - } - - emitter.once(name, eventListener); - return; - } - }); - } - - /** - * Returns an AsyncIterator that iterates eventName events. It will throw if - * the EventEmitter emits 'error'. It removes all listeners when exiting the - * loop. The value returned by each iteration is an array composed of the - * emitted event arguments. - */ - public static on( - emitter: EventEmitter, - event: string | symbol, - ): AsyncIterable { - // deno-lint-ignore no-explicit-any - const unconsumedEventValues: any[] = []; - // deno-lint-ignore no-explicit-any - const unconsumedPromises: any[] = []; - let error: Error | null = null; - let finished = false; - - const iterator = { - // deno-lint-ignore no-explicit-any - next(): Promise> { - // First, we consume all unread events - // deno-lint-ignore no-explicit-any - const value: any = unconsumedEventValues.shift(); - if (value) { - return Promise.resolve(createIterResult(value, false)); - } - - // Then we error, if an error happened - // This happens one time if at all, because after 'error' - // we stop listening - if (error) { - const p: Promise = Promise.reject(error); - // Only the first element errors - error = null; - return p; - } - - // If the iterator is finished, resolve to done - if (finished) { - return Promise.resolve(createIterResult(undefined, true)); - } - - // Wait until an event happens - return new Promise(function (resolve, reject) { - unconsumedPromises.push({ resolve, reject }); - }); - }, - - // deno-lint-ignore no-explicit-any - return(): Promise> { - emitter.removeListener(event, eventHandler); - emitter.removeListener("error", errorHandler); - finished = true; - - for (const promise of unconsumedPromises) { - promise.resolve(createIterResult(undefined, true)); - } - - return Promise.resolve(createIterResult(undefined, true)); - }, - - throw(err: Error): void { - error = err; - emitter.removeListener(event, eventHandler); - emitter.removeListener("error", errorHandler); - }, - - // deno-lint-ignore no-explicit-any - [Symbol.asyncIterator](): any { - return this; - }, - }; - - emitter.on(event, eventHandler); - emitter.on("error", errorHandler); - - return iterator; - - // deno-lint-ignore no-explicit-any - function eventHandler(...args: any[]): void { - const promise = unconsumedPromises.shift(); - if (promise) { - promise.resolve(createIterResult(args, false)); - } else { - unconsumedEventValues.push(args); - } - } - - // deno-lint-ignore no-explicit-any - function errorHandler(err: any): void { - finished = true; - - const toError = unconsumedPromises.shift(); - if (toError) { - toError.reject(err); - } else { - // The next time we call next() - error = err; - } - - iterator.return(); - } - } -} - -export default Object.assign(EventEmitter, { EventEmitter }); - -export const captureRejectionSymbol = EventEmitter.captureRejectionSymbol; -export const errorMonitor = EventEmitter.errorMonitor; -export const listenerCount = EventEmitter.listenerCount; -export const on = EventEmitter.on; -export const once = EventEmitter.once; diff --git a/crates/swc_bundler/tests/.cache/deno/11ba86e63300472c082d26d8a3f1e4d8fe8fe76f.ts b/crates/swc_bundler/tests/.cache/deno/11ba86e63300472c082d26d8a3f1e4d8fe8fe76f.ts deleted file mode 100644 index fd7f12da1542..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11ba86e63300472c082d26d8a3f1e4d8fe8fe76f.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Loaded from https://deno.land/x/case/titleCase.ts - - -import upperCase from "./upperCase.ts"; -import normalCase from "./normalCase.ts"; - -export default function titleCase(value: string, locale?: string): string { - return normalCase(value, locale).replace(/^.| ./g, function ( - m: string, - ): string { - return upperCase(m, locale); - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/11cb63f852dc07cf7b8b40eb21f9001224b3292d.ts b/crates/swc_bundler/tests/.cache/deno/11cb63f852dc07cf7b8b40eb21f9001224b3292d.ts deleted file mode 100644 index 39f86e0507ef..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11cb63f852dc07cf7b8b40eb21f9001224b3292d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/command/types/command.ts - - -import { Command } from '../lib/command.ts'; -import { StringType } from './string.ts'; - -export class CommandType extends StringType { - - public complete( cmd: Command, parent?: Command ): string[] { - return parent?.getCommands( false ) - .map( ( cmd: Command ) => cmd.getName() ) || []; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/11f0bd5f0035639283309990494297d8e582b77e.ts b/crates/swc_bundler/tests/.cache/deno/11f0bd5f0035639283309990494297d8e582b77e.ts deleted file mode 100644 index e2d0ad16e847..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/11f0bd5f0035639283309990494297d8e582b77e.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/roles/edit_role.ts - - -import { rest } from "../../rest/rest.ts"; -import { structures } from "../../structures/mod.ts"; -import type { CreateGuildRole } from "../../types/guilds/create_guild_role.ts"; -import type { Role } from "../../types/permissions/role.ts"; -import { endpoints } from "../../util/constants.ts"; -import { calculateBits, requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** Edit a guild role. Requires the MANAGE_ROLES permission. */ -export async function editRole(guildId: bigint, id: bigint, options: CreateGuildRole) { - await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]); - - const result = await rest.runMethod("patch", endpoints.GUILD_ROLE(guildId, id), { - ...options, - permissions: options.permissions ? calculateBits(options.permissions) : undefined, - }); - - return await structures.createDiscordenoRole({ role: result, guildId }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/12443b1c9163cb6b513538c9e3bed70f14aad464.ts b/crates/swc_bundler/tests/.cache/deno/12443b1c9163cb6b513538c9e3bed70f14aad464.ts deleted file mode 100644 index 18653341ed8e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/12443b1c9163cb6b513538c9e3bed70f14aad464.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Loaded from https://deno.land/std@0.67.0/path/_constants.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -/** This module is browser compatible. */ - -// Alphabet chars. -export const CHAR_UPPERCASE_A = 65; /* A */ -export const CHAR_LOWERCASE_A = 97; /* a */ -export const CHAR_UPPERCASE_Z = 90; /* Z */ -export const CHAR_LOWERCASE_Z = 122; /* z */ - -// Non-alphabetic chars. -export const CHAR_DOT = 46; /* . */ -export const CHAR_FORWARD_SLASH = 47; /* / */ -export const CHAR_BACKWARD_SLASH = 92; /* \ */ -export const CHAR_VERTICAL_LINE = 124; /* | */ -export const CHAR_COLON = 58; /* : */ -export const CHAR_QUESTION_MARK = 63; /* ? */ -export const CHAR_UNDERSCORE = 95; /* _ */ -export const CHAR_LINE_FEED = 10; /* \n */ -export const CHAR_CARRIAGE_RETURN = 13; /* \r */ -export const CHAR_TAB = 9; /* \t */ -export const CHAR_FORM_FEED = 12; /* \f */ -export const CHAR_EXCLAMATION_MARK = 33; /* ! */ -export const CHAR_HASH = 35; /* # */ -export const CHAR_SPACE = 32; /* */ -export const CHAR_NO_BREAK_SPACE = 160; /* \u00A0 */ -export const CHAR_ZERO_WIDTH_NOBREAK_SPACE = 65279; /* \uFEFF */ -export const CHAR_LEFT_SQUARE_BRACKET = 91; /* [ */ -export const CHAR_RIGHT_SQUARE_BRACKET = 93; /* ] */ -export const CHAR_LEFT_ANGLE_BRACKET = 60; /* < */ -export const CHAR_RIGHT_ANGLE_BRACKET = 62; /* > */ -export const CHAR_LEFT_CURLY_BRACKET = 123; /* { */ -export const CHAR_RIGHT_CURLY_BRACKET = 125; /* } */ -export const CHAR_HYPHEN_MINUS = 45; /* - */ -export const CHAR_PLUS = 43; /* + */ -export const CHAR_DOUBLE_QUOTE = 34; /* " */ -export const CHAR_SINGLE_QUOTE = 39; /* ' */ -export const CHAR_PERCENT = 37; /* % */ -export const CHAR_SEMICOLON = 59; /* ; */ -export const CHAR_CIRCUMFLEX_ACCENT = 94; /* ^ */ -export const CHAR_GRAVE_ACCENT = 96; /* ` */ -export const CHAR_AT = 64; /* @ */ -export const CHAR_AMPERSAND = 38; /* & */ -export const CHAR_EQUAL = 61; /* = */ - -// Digits -export const CHAR_0 = 48; /* 0 */ -export const CHAR_9 = 57; /* 9 */ - -let NATIVE_OS: typeof Deno.build.os = "linux"; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const navigator = (globalThis as any).navigator; -if (globalThis.Deno != null) { - NATIVE_OS = Deno.build.os; -} else if (navigator?.appVersion?.includes?.("Win") ?? false) { - NATIVE_OS = "windows"; -} -// TODO(nayeemrmn): Improve OS detection in browsers beyond Windows. - -export const isWindows = NATIVE_OS == "windows"; - -export { NATIVE_OS }; diff --git a/crates/swc_bundler/tests/.cache/deno/125d246dc76a9a556045ceeae1153d884ebfdbf4.ts b/crates/swc_bundler/tests/.cache/deno/125d246dc76a9a556045ceeae1153d884ebfdbf4.ts deleted file mode 100644 index bb722d6d15f1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/125d246dc76a9a556045ceeae1153d884ebfdbf4.ts +++ /dev/null @@ -1,150 +0,0 @@ -// Loaded from https://deno.land/x/god_crypto@v1.4.3/src/rsa/rsa_internal.ts - - -import { power_mod } from "./../math.ts"; -import { eme_oaep_encode, eme_oaep_decode } from "./eme_oaep.ts"; -import { os2ip, i2osp } from "./primitives.ts"; -import { concat, random_bytes } from "./../helper.ts"; -import { ber_decode, ber_simple } from "./basic_encoding_rule.ts"; -import { RawBinary } from "../binary.ts"; - -/** - * @param n public key modulus - * @param e public key exponent - * @param m message representative - */ -export function rsaep(n: bigint, e: bigint, m: bigint): bigint { - return power_mod(m, e, n); -} - -/** - * @param n private key modulus - * @param d private key exponent - * @param c ciphertext representative - */ -export function rsadp(n: bigint, d: bigint, c: bigint): bigint { - return power_mod(c, d, n); -} - -export function rsa_oaep_encrypt( - bytes: number, - n: bigint, - e: bigint, - m: Uint8Array, - algorithm: "sha1" | "sha256", -) { - const em = eme_oaep_encode(new Uint8Array(0), m, bytes, algorithm); - const msg = os2ip(em); - const c = rsaep(n, e, msg); - return i2osp(c, bytes); -} - -export function rsa_oaep_decrypt( - bytes: number, - n: bigint, - d: bigint, - c: Uint8Array, - algorithm: "sha1" | "sha256", -) { - const em = rsadp(n, d, os2ip(c)); - const m = eme_oaep_decode( - new Uint8Array(0), - i2osp(em, bytes), - bytes, - algorithm, - ); - return m; -} - -export function rsa_pkcs1_encrypt( - bytes: number, - n: bigint, - e: bigint, - m: Uint8Array, -) { - const p = concat([0x00, 0x02], random_bytes(bytes - m.length - 3), [0x00], m); - const msg = os2ip(p); - const c = rsaep(n, e, msg); - return i2osp(c, bytes); -} - -export function rsa_pkcs1_decrypt( - bytes: number, - n: bigint, - d: bigint, - c: Uint8Array, -) { - const em = i2osp(rsadp(n, d, os2ip(c)), bytes); - - if (em[0] !== 0) throw "Decryption error"; - if (em[1] !== 0x02) throw "Decryption error"; - - let psCursor = 2; - for (; psCursor < em.length; psCursor++) { - if (em[psCursor] === 0x00) break; - } - - if (psCursor < 10) throw "Decryption error"; - - return em.slice(psCursor + 1); -} - -export function rsa_pkcs1_verify( - bytes: number, - n: bigint, - d: bigint, - s: Uint8Array, - m: Uint8Array, -): boolean { - let em = i2osp(rsadp(n, d, os2ip(s)), bytes); - - if (em[0] !== 0) throw "Decryption error"; - if (em[1] !== 0x01) throw "Decryption error"; - - let psCursor = 2; - for (; psCursor < em.length; psCursor++) { - if (em[psCursor] === 0x00) break; - } - - if (psCursor < 10) throw "Decryption error"; - - // Removing padding - em = em.slice(psCursor + 1); - - // Parsing the BER - const ber: [[number, null], Uint8Array] = ber_simple(ber_decode(em)) as any; - const decryptedMessage = ber[1]; - - // Comparing the value - if (decryptedMessage.length !== m.length) return false; - for (let i = 0; i < decryptedMessage.length; i++) { - if (decryptedMessage[i] !== m[i]) return false; - } - - return true; -} - -export function rsa_pkcs1_sign( - bytes: number, - n: bigint, - d: bigint, - message: Uint8Array, -): RawBinary { - // deno-fmt-ignore - const oid = [0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00] - const der = [ - 0x30, - message.length + 2 + oid.length, - ...oid, - 0x04, - message.length, - ...message, - ]; - - const ps = new Array(bytes - 3 - der.length).fill(0xff); - const em = new Uint8Array([0x00, 0x01, ...ps, 0x00, ...der]); - - const msg = os2ip(em); - const c = rsaep(n, d, msg); - return new RawBinary(i2osp(c, bytes)); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1269588bea35e23194ed43f8a7cbe30f6032827e.ts b/crates/swc_bundler/tests/.cache/deno/1269588bea35e23194ed43f8a7cbe30f6032827e.ts deleted file mode 100644 index a1e549bccdc1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1269588bea35e23194ed43f8a7cbe30f6032827e.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/_util/assert.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -export class DenoStdInternalError extends Error { - constructor(message: string) { - super(message); - this.name = "DenoStdInternalError"; - } -} - -/** Make an assertion, if not `true`, then throw. */ -export function assert(expr: unknown, msg = ""): asserts expr { - if (!expr) { - throw new DenoStdInternalError(msg); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/12718a69cb4870a5d8f43e95389215a652e1ff23.ts b/crates/swc_bundler/tests/.cache/deno/12718a69cb4870a5d8f43e95389215a652e1ff23.ts deleted file mode 100644 index c02bc61e869d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/12718a69cb4870a5d8f43e95389215a652e1ff23.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/iobuffer/utf8.ts - - -const decoder = new TextDecoder('utf-8'); - -export function decode(bytes: Uint8Array): string { - return decoder.decode(bytes); -} - -const encoder = new TextEncoder(); - -export function encode(str: string): Uint8Array { - return encoder.encode(str); -} diff --git a/crates/swc_bundler/tests/.cache/deno/12d2f13dbbe89656712da3af759c47452a5c1ba3.ts b/crates/swc_bundler/tests/.cache/deno/12d2f13dbbe89656712da3af759c47452a5c1ba3.ts deleted file mode 100644 index adbe124e0a09..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/12d2f13dbbe89656712da3af759c47452a5c1ba3.ts +++ /dev/null @@ -1,251 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/node/_utils.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { deferred } from "../async/mod.ts"; -import { assert, assertStringIncludes, fail } from "../testing/asserts.ts"; -import { readAll } from "../io/util.ts"; - -export type BinaryEncodings = "binary"; - -export type TextEncodings = - | "ascii" - | "utf8" - | "utf-8" - | "utf16le" - | "ucs2" - | "ucs-2" - | "base64" - | "latin1" - | "hex"; - -export type Encodings = BinaryEncodings | TextEncodings; - -export function notImplemented(msg?: string): never { - const message = msg ? `Not implemented: ${msg}` : "Not implemented"; - throw new Error(message); -} - -export type _TextDecoder = typeof TextDecoder.prototype; -export const _TextDecoder = TextDecoder; - -export type _TextEncoder = typeof TextEncoder.prototype; -export const _TextEncoder = TextEncoder; - -// API helpers - -export type MaybeNull = T | null; -export type MaybeDefined = T | undefined; -export type MaybeEmpty = T | null | undefined; - -export function intoCallbackAPI( - // deno-lint-ignore no-explicit-any - func: (...args: any[]) => Promise, - cb: MaybeEmpty<(err: MaybeNull, value?: MaybeEmpty) => void>, - // deno-lint-ignore no-explicit-any - ...args: any[] -): void { - func(...args).then( - (value) => cb && cb(null, value), - (err) => cb && cb(err), - ); -} - -export function intoCallbackAPIWithIntercept( - // deno-lint-ignore no-explicit-any - func: (...args: any[]) => Promise, - interceptor: (v: T1) => T2, - cb: MaybeEmpty<(err: MaybeNull, value?: MaybeEmpty) => void>, - // deno-lint-ignore no-explicit-any - ...args: any[] -): void { - func(...args).then( - (value) => cb && cb(null, interceptor(value)), - (err) => cb && cb(err), - ); -} - -export function spliceOne(list: string[], index: number): void { - for (; index + 1 < list.length; index++) list[index] = list[index + 1]; - list.pop(); -} - -// Taken from: https://github.com/nodejs/node/blob/ba684805b6c0eded76e5cd89ee00328ac7a59365/lib/internal/util.js#L125 -// Return undefined if there is no match. -// Move the "slow cases" to a separate function to make sure this function gets -// inlined properly. That prioritizes the common case. -export function normalizeEncoding( - enc: string | null, -): TextEncodings | undefined { - if (enc == null || enc === "utf8" || enc === "utf-8") return "utf8"; - return slowCases(enc); -} - -// https://github.com/nodejs/node/blob/ba684805b6c0eded76e5cd89ee00328ac7a59365/lib/internal/util.js#L130 -function slowCases(enc: string): TextEncodings | undefined { - switch (enc.length) { - case 4: - if (enc === "UTF8") return "utf8"; - if (enc === "ucs2" || enc === "UCS2") return "utf16le"; - enc = `${enc}`.toLowerCase(); - if (enc === "utf8") return "utf8"; - if (enc === "ucs2") return "utf16le"; - break; - case 3: - if (enc === "hex" || enc === "HEX" || `${enc}`.toLowerCase() === "hex") { - return "hex"; - } - break; - case 5: - if (enc === "ascii") return "ascii"; - if (enc === "ucs-2") return "utf16le"; - if (enc === "UTF-8") return "utf8"; - if (enc === "ASCII") return "ascii"; - if (enc === "UCS-2") return "utf16le"; - enc = `${enc}`.toLowerCase(); - if (enc === "utf-8") return "utf8"; - if (enc === "ascii") return "ascii"; - if (enc === "ucs-2") return "utf16le"; - break; - case 6: - if (enc === "base64") return "base64"; - if (enc === "latin1" || enc === "binary") return "latin1"; - if (enc === "BASE64") return "base64"; - if (enc === "LATIN1" || enc === "BINARY") return "latin1"; - enc = `${enc}`.toLowerCase(); - if (enc === "base64") return "base64"; - if (enc === "latin1" || enc === "binary") return "latin1"; - break; - case 7: - if ( - enc === "utf16le" || - enc === "UTF16LE" || - `${enc}`.toLowerCase() === "utf16le" - ) { - return "utf16le"; - } - break; - case 8: - if ( - enc === "utf-16le" || - enc === "UTF-16LE" || - `${enc}`.toLowerCase() === "utf-16le" - ) { - return "utf16le"; - } - break; - default: - if (enc === "") return "utf8"; - } -} - -export function validateIntegerRange( - value: number, - name: string, - min = -2147483648, - max = 2147483647, -): void { - // The defaults for min and max correspond to the limits of 32-bit integers. - if (!Number.isInteger(value)) { - throw new Error(`${name} must be 'an integer' but was ${value}`); - } - - if (value < min || value > max) { - throw new Error( - `${name} must be >= ${min} && <= ${max}. Value was ${value}`, - ); - } -} - -type OptionalSpread = T extends undefined ? [] - : [T]; - -export function once( - callback: (...args: OptionalSpread) => void, -) { - let called = false; - return function (this: unknown, ...args: OptionalSpread) { - if (called) return; - called = true; - callback.apply(this, args); - }; -} - -/** - * @param {number} [expectedExecutions = 1] - * @param {number} [timeout = 1000] Milliseconds to wait before the promise is forcefully exited -*/ -export function mustCall( - fn: ((...args: T) => void) = () => {}, - expectedExecutions = 1, - timeout = 1000, -): [Promise, (...args: T) => void] { - if (expectedExecutions < 1) { - throw new Error("Expected executions can't be lower than 1"); - } - let timesExecuted = 0; - const completed = deferred(); - - const abort = setTimeout(() => completed.reject(), timeout); - - function callback(this: unknown, ...args: T) { - timesExecuted++; - if (timesExecuted === expectedExecutions) { - completed.resolve(); - } - fn.apply(this, args); - } - - const result = completed - .then(() => clearTimeout(abort)) - .catch(() => - fail( - `Async operation not completed: Expected ${expectedExecutions}, executed ${timesExecuted}`, - ) - ); - - return [ - result, - callback, - ]; -} -/** Asserts that an error thrown in a callback will not be wrongly caught. */ -export async function assertCallbackErrorUncaught( - { prelude, invocation, cleanup }: { - /** Any code which needs to run before the actual invocation (notably, any import statements). */ - prelude?: string; - /** - * The start of the invocation of the function, e.g. `open("foo.txt", `. - * The callback will be added after it. - */ - invocation: string; - /** Called after the subprocess is finished but before running the assertions, e.g. to clean up created files. */ - cleanup?: () => Promise | void; - }, -) { - // Since the error has to be uncaught, and that will kill the Deno process, - // the only way to test this is to spawn a subprocess. - const p = Deno.run({ - cmd: [ - Deno.execPath(), - "eval", - "--no-check", // Running TSC for every one of these tests would take way too long - "--unstable", - `${prelude ?? ""} - - ${invocation}(err) => { - // If the bug is present and the callback is called again with an error, - // don't throw another error, so if the subprocess fails we know it had the correct behaviour. - if (!err) throw new Error("success"); - });`, - ], - stderr: "piped", - }); - const status = await p.status(); - const stderr = new TextDecoder().decode(await readAll(p.stderr)); - p.close(); - p.stderr.close(); - await cleanup?.(); - assert(!status.success); - assertStringIncludes(stderr, "Error: success"); -} diff --git a/crates/swc_bundler/tests/.cache/deno/12dae7a3ff121d6d76dd029a5e0768673415815f.ts b/crates/swc_bundler/tests/.cache/deno/12dae7a3ff121d6d76dd029a5e0768673415815f.ts deleted file mode 100644 index ebf927b6f278..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/12dae7a3ff121d6d76dd029a5e0768673415815f.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Loaded from https://deno.land/std/async/mod.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -export * from "./deferred.ts"; -export * from "./delay.ts"; -export * from "./mux_async_iterator.ts"; -export * from "./pool.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/12e9060a896dc887aeb65cdc0ea52ce8133476f5.ts b/crates/swc_bundler/tests/.cache/deno/12e9060a896dc887aeb65cdc0ea52ce8133476f5.ts deleted file mode 100644 index 53b4edb3355c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/12e9060a896dc887aeb65cdc0ea52ce8133476f5.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/KnownFragmentNamesRule.js - - -import { GraphQLError } from '../../error/GraphQLError.js'; - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -export function KnownFragmentNamesRule(context) { - return { - FragmentSpread(node) { - const fragmentName = node.name.value; - const fragment = context.getFragment(fragmentName); - - if (!fragment) { - context.reportError(new GraphQLError(`Unknown fragment "${fragmentName}".`, node.name)); - } - } - - }; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/12f22fe84a446f5ac2c6b7eed8621763d67c9717.ts b/crates/swc_bundler/tests/.cache/deno/12f22fe84a446f5ac2c6b7eed8621763d67c9717.ts deleted file mode 100644 index 7ca852e229b9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/12f22fe84a446f5ac2c6b7eed8621763d67c9717.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/channels/channel_overwrite_has_permission.ts - - -import type { DiscordOverwrite } from "../../types/channels/overwrite.ts"; -import { DiscordBitwisePermissionFlags } from "../../types/permissions/bitwise_permission_flags.ts"; -import type { PermissionStrings } from "../../types/permissions/permission_strings.ts"; - -/** Checks if a channel overwrite for a user id or a role id has permission in this channel */ -export function channelOverwriteHasPermission( - guildId: bigint, - id: bigint, - overwrites: (Omit & { - id: bigint; - allow: bigint; - deny: bigint; - })[], - permissions: PermissionStrings[] -) { - const overwrite = overwrites.find((perm) => perm.id === id) || overwrites.find((perm) => perm.id === guildId); - - if (!overwrite) return false; - - return permissions.every((perm) => { - const allowBits = overwrite.allow; - const denyBits = overwrite.deny; - if (BigInt(denyBits) & BigInt(DiscordBitwisePermissionFlags[perm])) { - return false; - } - if (BigInt(allowBits) & BigInt(DiscordBitwisePermissionFlags[perm])) { - return true; - } - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/12f5bc47dce97aab7d2b439371a8325000270cd8.ts b/crates/swc_bundler/tests/.cache/deno/12f5bc47dce97aab7d2b439371a8325000270cd8.ts deleted file mode 100644 index afdaa66c6b79..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/12f5bc47dce97aab7d2b439371a8325000270cd8.ts +++ /dev/null @@ -1,431 +0,0 @@ -// Loaded from https://deno.land/x/oak@v6.3.1/application.ts - - -// Copyright 2018-2020 the oak authors. All rights reserved. MIT license. - -import { Context } from "./context.ts"; -import { - serve as defaultServe, - serveTLS as defaultServeTls, - Status, - STATUS_TEXT, -} from "./deps.ts"; -import { Key, KeyStack } from "./keyStack.ts"; -import { compose, Middleware } from "./middleware.ts"; -import type { - Serve, - Server, - ServerRequest, - ServerResponse, - ServeTls, -} from "./types.d.ts"; - -export interface ListenOptionsBase { - hostname?: string; - port: number; - secure?: false; - signal?: AbortSignal; -} - -export interface ListenOptionsTls { - certFile: string; - hostname?: string; - keyFile: string; - port: number; - secure: true; - signal?: AbortSignal; -} - -export type ListenOptions = ListenOptionsTls | ListenOptionsBase; - -function isOptionsTls(options: ListenOptions): options is ListenOptionsTls { - return options.secure === true; -} - -interface ApplicationErrorEventListener { - (evt: ApplicationErrorEvent): void | Promise; -} - -interface ApplicationErrorEventListenerObject { - handleEvent(evt: ApplicationErrorEvent): void | Promise; -} - -interface ApplicationErrorEventInit extends ErrorEventInit { - context?: Context; -} - -type ApplicationErrorEventListenerOrEventListenerObject = - | ApplicationErrorEventListener - | ApplicationErrorEventListenerObject; - -interface ApplicationListenEventListener { - (evt: ApplicationListenEvent): void | Promise; -} - -interface ApplicationListenEventListenerObject { - handleEvent(evt: ApplicationListenEvent): void | Promise; -} - -interface ApplicationListenEventInit extends EventInit { - hostname?: string; - port: number; - secure: boolean; -} - -type ApplicationListenEventListenerOrEventListenerObject = - | ApplicationListenEventListener - | ApplicationListenEventListenerObject; - -export interface ApplicationOptions { - /** An initial set of keys (or instance of `KeyGrip`) to be used for signing - * cookies produced by the application. */ - keys?: KeyStack | Key[]; - - /** If set to `true`, proxy headers will be trusted when processing requests. - * This defaults to `false`. */ - proxy?: boolean; - - /** The `server()` function to be used to read requests. - * - * _Not used generally, as this is just for mocking for test purposes_ */ - serve?: Serve; - - /** The `server()` function to be used to read requests. - * - * _Not used generally, as this is just for mocking for test purposes_ */ - serveTls?: ServeTls; - - /** The initial state object for the application, of which the type can be - * used to infer the type of the state for both the application and any of the - * application's context. */ - state?: S; -} - -interface RequestState { - handling: Set>; - closing: boolean; - closed: boolean; - server: Server; -} - -// deno-lint-ignore no-explicit-any -export type State = Record; - -const ADDR_REGEXP = /^\[?([^\]]*)\]?:([0-9]{1,5})$/; - -export class ApplicationErrorEvent extends ErrorEvent { - context?: Context; - - constructor(eventInitDict: ApplicationErrorEventInit) { - super("error", eventInitDict); - this.context = eventInitDict.context; - } -} - -export class ApplicationListenEvent extends Event { - hostname?: string; - port: number; - secure: boolean; - - constructor(eventInitDict: ApplicationListenEventInit) { - super("listen", eventInitDict); - this.hostname = eventInitDict.hostname; - this.port = eventInitDict.port; - this.secure = eventInitDict.secure; - } -} - -/** A class which registers middleware (via `.use()`) and then processes - * inbound requests against that middleware (via `.listen()`). - * - * The `context.state` can be typed via passing a generic argument when - * constructing an instance of `Application`. - */ -// deno-lint-ignore no-explicit-any -export class Application> - extends EventTarget { - #composedMiddleware?: (context: Context) => Promise; - #keys?: KeyStack; - #middleware: Middleware>[] = []; - #serve: Serve; - #serveTls: ServeTls; - - /** A set of keys, or an instance of `KeyStack` which will be used to sign - * cookies read and set by the application to avoid tampering with the - * cookies. */ - get keys(): KeyStack | Key[] | undefined { - return this.#keys; - } - - set keys(keys: KeyStack | Key[] | undefined) { - if (!keys) { - this.#keys = undefined; - return; - } else if (Array.isArray(keys)) { - this.#keys = new KeyStack(keys); - } else { - this.#keys = keys; - } - } - - /** If `true`, proxy headers will be trusted when processing requests. This - * defaults to `false`. */ - proxy: boolean; - - /** Generic state of the application, which can be specified by passing the - * generic argument when constructing: - * - * const app = new Application<{ foo: string }>(); - * - * Or can be contextually inferred based on setting an initial state object: - * - * const app = new Application({ state: { foo: "bar" } }); - * - */ - state: AS; - - constructor(options: ApplicationOptions = {}) { - super(); - const { - state, - keys, - proxy, - serve = defaultServe, - serveTls = defaultServeTls, - } = options; - - this.proxy = proxy ?? false; - this.keys = keys; - this.state = state ?? {} as AS; - this.#serve = serve; - this.#serveTls = serveTls; - } - - #getComposed = (): ((context: Context) => Promise) => { - if (!this.#composedMiddleware) { - this.#composedMiddleware = compose(this.#middleware); - } - return this.#composedMiddleware; - }; - - /** Deal with uncaught errors in either the middleware or sending the - * response. */ - // deno-lint-ignore no-explicit-any - #handleError = (context: Context, error: any): void => { - if (!(error instanceof Error)) { - error = new Error(`non-error thrown: ${JSON.stringify(error)}`); - } - const { message } = error; - this.dispatchEvent(new ApplicationErrorEvent({ context, message, error })); - if (!context.response.writable) { - return; - } - for (const key of context.response.headers.keys()) { - context.response.headers.delete(key); - } - if (error.headers && error.headers instanceof Headers) { - for (const [key, value] of error.headers) { - context.response.headers.set(key, value); - } - } - context.response.type = "text"; - const status: Status = context.response.status = - error instanceof Deno.errors.NotFound - ? 404 - : error.status && typeof error.status === "number" - ? error.status - : 500; - context.response.body = error.expose - ? error.message - : STATUS_TEXT.get(status); - }; - - /** Processing registered middleware on each request. */ - #handleRequest = async ( - request: ServerRequest, - secure: boolean, - state: RequestState, - ): Promise => { - const context = new Context(this, request, secure); - let resolve: () => void; - const handlingPromise = new Promise((res) => resolve = res); - state.handling.add(handlingPromise); - if (!state.closing && !state.closed) { - try { - await this.#getComposed()(context); - } catch (err) { - this.#handleError(context, err); - } - } - if (context.respond === false) { - context.response.destroy(); - resolve!(); - state.handling.delete(handlingPromise); - return; - } - try { - await request.respond(await context.response.toServerResponse()); - if (state.closing) { - state.server.close(); - state.closed = true; - } - } catch (err) { - this.#handleError(context, err); - } finally { - context.response.destroy(); - resolve!(); - state.handling.delete(handlingPromise); - } - }; - - /** Add an event listener for an `"error"` event which occurs when an - * un-caught error occurs when processing the middleware or during processing - * of the response. */ - addEventListener( - type: "error", - listener: ApplicationErrorEventListenerOrEventListenerObject | null, - options?: boolean | AddEventListenerOptions, - ): void; - /** Add an event listener for a `"listen"` event which occurs when the server - * has successfully opened but before any requests start being processed. */ - addEventListener( - type: "listen", - listener: ApplicationListenEventListenerOrEventListenerObject | null, - options?: boolean | AddEventListenerOptions, - ): void; - /** Add an event listener for an event. Currently valid event types are - * `"error"` and `"listen"`. */ - addEventListener( - type: "error" | "listen", - listener: EventListenerOrEventListenerObject | null, - options?: boolean | AddEventListenerOptions, - ): void { - super.addEventListener(type, listener, options); - } - - /** Handle an individual server request, returning the server response. This - * is similar to `.listen()`, but opening the connection and retrieving - * requests are not the responsibility of the application. If the generated - * context gets set to not to respond, then the method resolves with - * `undefined`, otherwise it resolves with a request that is compatible with - * `std/http/server`. */ - handle = async ( - request: ServerRequest, - secure = false, - ): Promise => { - if (!this.#middleware.length) { - throw new TypeError("There is no middleware to process requests."); - } - const context = new Context(this, request, secure); - try { - await this.#getComposed()(context); - } catch (err) { - this.#handleError(context, err); - } - if (context.respond === false) { - context.response.destroy(); - return; - } - try { - const response = await context.response.toServerResponse(); - context.response.destroy(); - return response; - } catch (err) { - this.#handleError(context, err); - throw err; - } - }; - - /** Start listening for requests, processing registered middleware on each - * request. If the options `.secure` is undefined or `false`, the listening - * will be over HTTP. If the options `.secure` property is `true`, a - * `.certFile` and a `.keyFile` property need to be supplied and requests - * will be processed over HTTPS. */ - async listen(addr: string): Promise; - /** Start listening for requests, processing registered middleware on each - * request. If the options `.secure` is undefined or `false`, the listening - * will be over HTTP. If the options `.secure` property is `true`, a - * `.certFile` and a `.keyFile` property need to be supplied and requests - * will be processed over HTTPS. */ - async listen(options: ListenOptions): Promise; - async listen(options: string | ListenOptions): Promise { - if (!this.#middleware.length) { - throw new TypeError("There is no middleware to process requests."); - } - if (typeof options === "string") { - const match = ADDR_REGEXP.exec(options); - if (!match) { - throw TypeError(`Invalid address passed: "${options}"`); - } - const [, hostname, portStr] = match; - options = { hostname, port: parseInt(portStr, 10) }; - } - const server = isOptionsTls(options) - ? this.#serveTls(options) - : this.#serve(options); - const { signal } = options; - const state = { - closed: false, - closing: false, - handling: new Set>(), - server, - }; - if (signal) { - signal.addEventListener("abort", () => { - if (!state.handling.size) { - server.close(); - state.closed = true; - } - state.closing = true; - }); - } - const { hostname, port, secure = false } = options; - this.dispatchEvent( - new ApplicationListenEvent({ hostname, port, secure }), - ); - try { - for await (const request of server) { - this.#handleRequest(request, secure, state); - } - await Promise.all(state.handling); - } catch (error) { - const message = error instanceof Error - ? error.message - : "Application Error"; - this.dispatchEvent( - new ApplicationErrorEvent({ message, error }), - ); - } - } - - /** Register middleware to be used with the application. Middleware will - * be processed in the order it is added, but middleware can control the flow - * of execution via the use of the `next()` function that the middleware - * function will be called with. The `context` object provides information - * about the current state of the application. - * - * Basic usage: - * - * ```ts - * const import { Application } from "https://deno.land/x/oak/mod.ts"; - * - * const app = new Application(); - * - * app.use((ctx, next) => { - * ctx.request; // contains request information - * ctx.response; // setups up information to use in the response; - * await next(); // manages the flow control of the middleware execution - * }); - * - * await app.listen({ port: 80 }); - * ``` - */ - use( - ...middleware: Middleware>[] - ): Application { - this.#middleware.push(...middleware); - this.#composedMiddleware = undefined; - // deno-lint-ignore no-explicit-any - return this as Application; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/130b0b16b08e2328afef5d1c788e881e0381f6a8.ts b/crates/swc_bundler/tests/.cache/deno/130b0b16b08e2328afef5d1c788e881e0381f6a8.ts deleted file mode 100644 index ea56f3c499cf..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/130b0b16b08e2328afef5d1c788e881e0381f6a8.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/mongo@v0.20.0/src/error.ts - - -export interface MongoErrorInfo { - ok: 0; - errmsg: string; - code: number; - codeName: string; -} - -export class MongoError extends Error { - constructor(info: MongoErrorInfo) { - super(`MongoError: ${JSON.stringify(info)}`); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/130e950c4e01ea5ca0326f88e3c3d93f093ad45f.ts b/crates/swc_bundler/tests/.cache/deno/130e950c4e01ea5ca0326f88e3c3d93f093ad45f.ts deleted file mode 100644 index d03c9dd4c95a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/130e950c4e01ea5ca0326f88e3c3d93f093ad45f.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/std@0.90.0/_util/assert.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -export class DenoStdInternalError extends Error { - constructor(message: string) { - super(message); - this.name = "DenoStdInternalError"; - } -} - -/** Make an assertion, if not `true`, then throw. */ -export function assert(expr: unknown, msg = ""): asserts expr { - if (!expr) { - throw new DenoStdInternalError(msg); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/131bef49857a0c38175f5a4a39ce9e2666475603.ts b/crates/swc_bundler/tests/.cache/deno/131bef49857a0c38175f5a4a39ce9e2666475603.ts deleted file mode 100644 index f3f01821180b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/131bef49857a0c38175f5a4a39ce9e2666475603.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Loaded from https://deno.land/x/dndb@0.2.4/src/methods/updateOne.js - - -import { mongobj, matches } from '../../deps.ts'; -import { ReadFileStream, WriteFileStream } from '../storage.ts'; - -export default async (filename ,query, operators, projection) => { - const readStream = new ReadFileStream(filename); - const writeStream = new WriteFileStream(filename); - let updated = []; - query = query || {}; - return new Promise((resolve, reject) => { - readStream.on('document', obj => { - if (matches(query, obj) && !updated.length) { - mongobj.update(obj, operators); - updated.push(obj) - } - writeStream.emit("write", obj) - }) - readStream.on("end", () => { - writeStream.emit("end"); - }) - writeStream.on("close", () => { - return resolve(updated[0] || null) - }) - }) -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/13243b0f0284feaf671c22221599e019e19aa9db.ts b/crates/swc_bundler/tests/.cache/deno/13243b0f0284feaf671c22221599e019e19aa9db.ts deleted file mode 100644 index bbdb8926118f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/13243b0f0284feaf671c22221599e019e19aa9db.ts +++ /dev/null @@ -1,182 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/command/_errors.ts - - -import { ValidationError } from "../flags/_errors.ts"; -import { didYouMeanCommand } from "./_utils.ts"; -import type { Command } from "./command.ts"; - -export class CommandError extends Error { - constructor(message: string) { - super(message); - Object.setPrototypeOf(this, CommandError.prototype); - } -} - -export class MissingCommandName extends CommandError { - constructor() { - super("Missing command name."); - Object.setPrototypeOf(this, MissingCommandName.prototype); - } -} - -export class DuplicateCommandName extends CommandError { - constructor(name: string) { - super(`Duplicate command name "${name}".`); - Object.setPrototypeOf(this, DuplicateCommandName.prototype); - } -} - -export class DuplicateCommandAlias extends CommandError { - constructor(alias: string) { - super(`Duplicate command alias "${alias}".`); - Object.setPrototypeOf(this, DuplicateCommandAlias.prototype); - } -} - -export class CommandNotFound extends CommandError { - constructor( - name: string, - commands: Array, - excluded?: Array, - ) { - super( - `Unknown command "${name}".${ - didYouMeanCommand(name, commands, excluded) - }`, - ); - Object.setPrototypeOf(this, UnknownCommand.prototype); - } -} - -export class DuplicateType extends CommandError { - constructor(name: string) { - super(`Type with name "${name}" already exists.`); - Object.setPrototypeOf(this, DuplicateType.prototype); - } -} - -export class DuplicateCompletion extends CommandError { - constructor(name: string) { - super(`Completion with name "${name}" already exists.`); - Object.setPrototypeOf(this, DuplicateCompletion.prototype); - } -} - -export class DuplicateExample extends CommandError { - constructor(name: string) { - super(`Example with name "${name}" already exists.`); - Object.setPrototypeOf(this, DuplicateExample.prototype); - } -} - -export class DuplicateEnvironmentVariable extends CommandError { - constructor(name: string) { - super(`Environment variable with name "${name}" already exists.`); - Object.setPrototypeOf(this, DuplicateEnvironmentVariable.prototype); - } -} - -export class EnvironmentVariableSingleValue extends CommandError { - constructor(name: string) { - super( - `An environment variable can only have one value, but "${name}" has more than one.`, - ); - Object.setPrototypeOf(this, EnvironmentVariableSingleValue.prototype); - } -} - -export class EnvironmentVariableOptionalValue extends CommandError { - constructor(name: string) { - super( - `An environment variable cannot have an optional value, but "${name}" is defined as optional.`, - ); - Object.setPrototypeOf(this, EnvironmentVariableOptionalValue.prototype); - } -} - -export class EnvironmentVariableVariadicValue extends CommandError { - constructor(name: string) { - super( - `An environment variable cannot have an variadic value, but "${name}" is defined as variadic.`, - ); - Object.setPrototypeOf(this, EnvironmentVariableVariadicValue.prototype); - } -} - -export class DefaultCommandNotFound extends CommandError { - constructor(name: string, commands: Array) { - super( - `Default command "${name}" not found.${ - didYouMeanCommand(name, commands) - }`, - ); - Object.setPrototypeOf(this, DefaultCommandNotFound.prototype); - } -} - -export class CommandExecutableNotFound extends CommandError { - constructor(name: string, files: Array) { - super( - `Command executable not found: ${name}:\n - ${ - files.join("\\n - ") - }`, - ); - Object.setPrototypeOf(this, CommandExecutableNotFound.prototype); - } -} - -export class UnknownCompletionCommand extends CommandError { - constructor(name: string, commands: Array) { - super( - `Auto-completion failed. Unknown command "${name}".${ - didYouMeanCommand(name, commands) - }`, - ); - Object.setPrototypeOf(this, UnknownCompletionCommand.prototype); - } -} - -/* Validation errors. */ - -export class UnknownCommand extends ValidationError { - constructor( - name: string, - commands: Array, - excluded?: Array, - ) { - super( - `Unknown command "${name}".${ - didYouMeanCommand(name, commands, excluded) - }`, - ); - Object.setPrototypeOf(this, UnknownCommand.prototype); - } -} - -export class NoArgumentsAllowed extends ValidationError { - constructor(name: string) { - super(`No arguments allowed for command "${name}".`); - Object.setPrototypeOf(this, NoArgumentsAllowed.prototype); - } -} - -export class MissingArguments extends ValidationError { - constructor(args: Array) { - super("Missing argument(s): " + args.join(", ")); - Object.setPrototypeOf(this, MissingArguments.prototype); - } -} - -export class MissingArgument extends ValidationError { - constructor(arg: string) { - super(`Missing argument "${arg}".`); - Object.setPrototypeOf(this, MissingArgument.prototype); - } -} - -export class TooManyArguments extends ValidationError { - constructor(args: Array) { - super(`Too many arguments: ${args.join(" ")}`); - Object.setPrototypeOf(this, TooManyArguments.prototype); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/13302b6e4b7bfb7b8c496b9eb7fb4b383ca294c8.ts b/crates/swc_bundler/tests/.cache/deno/13302b6e4b7bfb7b8c496b9eb7fb4b383ca294c8.ts deleted file mode 100644 index 641f671a9cf6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/13302b6e4b7bfb7b8c496b9eb7fb4b383ca294c8.ts +++ /dev/null @@ -1,77 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/KnownArgumentNamesRule.js - - -import didYouMean from '../../jsutils/didYouMean.js'; -import suggestionList from '../../jsutils/suggestionList.js'; -import { GraphQLError } from '../../error/GraphQLError.js'; -import { Kind } from '../../language/kinds.js'; -import { specifiedDirectives } from '../../type/directives.js'; - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -export function KnownArgumentNamesRule(context) { - return { ...KnownArgumentNamesOnDirectivesRule(context), - - Argument(argNode) { - const argDef = context.getArgument(); - const fieldDef = context.getFieldDef(); - const parentType = context.getParentType(); - - if (!argDef && fieldDef && parentType) { - const argName = argNode.name.value; - const knownArgsNames = fieldDef.args.map(arg => arg.name); - const suggestions = suggestionList(argName, knownArgsNames); - context.reportError(new GraphQLError(`Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + didYouMean(suggestions), argNode)); - } - } - - }; -} -/** - * @internal - */ - -export function KnownArgumentNamesOnDirectivesRule(context) { - const directiveArgs = Object.create(null); - const schema = context.getSchema(); - const definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (const directive of definedDirectives) { - directiveArgs[directive.name] = directive.args.map(arg => arg.name); - } - - const astDefinitions = context.getDocument().definitions; - - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */ - const argsNodes = def.arguments ?? []; - directiveArgs[def.name.value] = argsNodes.map(arg => arg.name.value); - } - } - - return { - Directive(directiveNode) { - const directiveName = directiveNode.name.value; - const knownArgs = directiveArgs[directiveName]; - - if (directiveNode.arguments && knownArgs) { - for (const argNode of directiveNode.arguments) { - const argName = argNode.name.value; - - if (knownArgs.indexOf(argName) === -1) { - const suggestions = suggestionList(argName, knownArgs); - context.reportError(new GraphQLError(`Unknown argument "${argName}" on directive "@${directiveName}".` + didYouMean(suggestions), argNode)); - } - } - } - - return false; - } - - }; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/13343f8c79a422a733df4ade2d5fc58202f0c229.ts b/crates/swc_bundler/tests/.cache/deno/13343f8c79a422a733df4ade2d5fc58202f0c229.ts deleted file mode 100644 index 506255ddf78e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/13343f8c79a422a733df4ade2d5fc58202f0c229.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/table/mod.ts - - -export * from "./cell.ts"; -export * from "./row.ts"; -export * from "./table.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/133905beb7abf9799561d854356358d49f178e33.ts b/crates/swc_bundler/tests/.cache/deno/133905beb7abf9799561d854356358d49f178e33.ts deleted file mode 100644 index 2c507ba086fe..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/133905beb7abf9799561d854356358d49f178e33.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/channels/THREAD_UPDATE.ts - - -import { eventHandlers } from "../../bot.ts"; -import { cacheHandlers } from "../../cache.ts"; -import { structures } from "../../structures/mod.ts"; -import { Channel } from "../../types/channels/channel.ts"; -import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; - -export async function handleThreadUpdate(data: DiscordGatewayPayload) { - const payload = data.d as Channel; - const oldChannel = await cacheHandlers.get("channels", snowflakeToBigint(payload.id)); - if (!oldChannel) return; - - const discordenoChannel = await structures.createDiscordenoChannel(payload); - await cacheHandlers.set("channels", discordenoChannel.id, discordenoChannel); - - eventHandlers.threadUpdate?.(discordenoChannel, oldChannel); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1342fad556c7fa0a167607771800a427e263df6c.ts b/crates/swc_bundler/tests/.cache/deno/1342fad556c7fa0a167607771800a427e263df6c.ts deleted file mode 100644 index 5be77fa65355..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1342fad556c7fa0a167607771800a427e263df6c.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/splitAt.js - - -import _curry2 from './internal/_curry2.js'; -import length from './length.js'; -import slice from './slice.js'; - - -/** - * Splits a given list or string at a given index. - * - * @func - * @memberOf R - * @since v0.19.0 - * @category List - * @sig Number -> [a] -> [[a], [a]] - * @sig Number -> String -> [String, String] - * @param {Number} index The index where the array/string is split. - * @param {Array|String} array The array/string to be split. - * @return {Array} - * @example - * - * R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]] - * R.splitAt(5, 'hello world'); //=> ['hello', ' world'] - * R.splitAt(-1, 'foobar'); //=> ['fooba', 'r'] - */ -var splitAt = _curry2(function splitAt(index, array) { - return [slice(0, index, array), slice(index, length(array), array)]; -}); -export default splitAt; diff --git a/crates/swc_bundler/tests/.cache/deno/13700e6667201f37bc20bba0db87388b49b2ec72.ts b/crates/swc_bundler/tests/.cache/deno/13700e6667201f37bc20bba0db87388b49b2ec72.ts deleted file mode 100644 index fdfd8de9b015..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/13700e6667201f37bc20bba0db87388b49b2ec72.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Loaded from https://deno.land/std/log/levels.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -/** Get log level numeric values through enum constants - */ -export enum LogLevels { - NOTSET = 0, - DEBUG = 10, - INFO = 20, - WARNING = 30, - ERROR = 40, - CRITICAL = 50, -} - -/** Permitted log level names */ -export const LogLevelNames = Object.keys(LogLevels).filter((key) => - isNaN(Number(key)) -); - -/** Union of valid log level strings */ -export type LevelName = keyof typeof LogLevels; - -const byLevel: Record = { - [String(LogLevels.NOTSET)]: "NOTSET", - [String(LogLevels.DEBUG)]: "DEBUG", - [String(LogLevels.INFO)]: "INFO", - [String(LogLevels.WARNING)]: "WARNING", - [String(LogLevels.ERROR)]: "ERROR", - [String(LogLevels.CRITICAL)]: "CRITICAL", -}; - -/** Returns the numeric log level associated with the passed, - * stringy log level name. - */ -export function getLevelByName(name: LevelName): number { - switch (name) { - case "NOTSET": - return LogLevels.NOTSET; - case "DEBUG": - return LogLevels.DEBUG; - case "INFO": - return LogLevels.INFO; - case "WARNING": - return LogLevels.WARNING; - case "ERROR": - return LogLevels.ERROR; - case "CRITICAL": - return LogLevels.CRITICAL; - default: - throw new Error(`no log level found for "${name}"`); - } -} - -/** Returns the stringy log level name provided the numeric log level */ -export function getLevelName(level: number): LevelName { - const levelName = byLevel[level]; - if (levelName) { - return levelName; - } - throw new Error(`no level name found for level: ${level}`); -} diff --git a/crates/swc_bundler/tests/.cache/deno/13aad9ce013f3be95ff24d7ae53b20355b9e0e6f.ts b/crates/swc_bundler/tests/.cache/deno/13aad9ce013f3be95ff24d7ae53b20355b9e0e6f.ts deleted file mode 100644 index 6eb193fb0b95..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/13aad9ce013f3be95ff24d7ae53b20355b9e0e6f.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/modulo.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Divides the first parameter by the second and returns the remainder. Note - * that this function preserves the JavaScript-style behavior for modulo. For - * mathematical modulo see [`mathMod`](#mathMod). - * - * @func - * @memberOf R - * @since v0.1.1 - * @category Math - * @sig Number -> Number -> Number - * @param {Number} a The value to the divide. - * @param {Number} b The pseudo-modulus - * @return {Number} The result of `b % a`. - * @see R.mathMod - * @example - * - * R.modulo(17, 3); //=> 2 - * // JS behavior: - * R.modulo(-17, 3); //=> -2 - * R.modulo(17, -3); //=> 2 - * - * const isOdd = R.modulo(R.__, 2); - * isOdd(42); //=> 0 - * isOdd(21); //=> 1 - */ -var modulo = _curry2(function modulo(a, b) { return a % b; }); -export default modulo; diff --git a/crates/swc_bundler/tests/.cache/deno/1408020c1eb166e22d33bda9e6488190119a70bd.ts b/crates/swc_bundler/tests/.cache/deno/1408020c1eb166e22d33bda9e6488190119a70bd.ts deleted file mode 100644 index d471a6fe3894..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1408020c1eb166e22d33bda9e6488190119a70bd.ts +++ /dev/null @@ -1,721 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/io/bufio.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// Based on https://github.com/golang/go/blob/891682/src/bufio/bufio.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -type Reader = Deno.Reader; -type Writer = Deno.Writer; -type WriterSync = Deno.WriterSync; -import { copy } from "../bytes/mod.ts"; -import { assert } from "../_util/assert.ts"; - -const DEFAULT_BUF_SIZE = 4096; -const MIN_BUF_SIZE = 16; -const MAX_CONSECUTIVE_EMPTY_READS = 100; -const CR = "\r".charCodeAt(0); -const LF = "\n".charCodeAt(0); - -export class BufferFullError extends Error { - name = "BufferFullError"; - constructor(public partial: Uint8Array) { - super("Buffer full"); - } -} - -export class PartialReadError extends Deno.errors.UnexpectedEof { - name = "PartialReadError"; - partial?: Uint8Array; - constructor() { - super("Encountered UnexpectedEof, data only partially read"); - } -} - -/** Result type returned by of BufReader.readLine(). */ -export interface ReadLineResult { - line: Uint8Array; - more: boolean; -} - -/** BufReader implements buffering for a Reader object. */ -export class BufReader implements Reader { - private buf!: Uint8Array; - private rd!: Reader; // Reader provided by caller. - private r = 0; // buf read position. - private w = 0; // buf write position. - private eof = false; - // private lastByte: number; - // private lastCharSize: number; - - /** return new BufReader unless r is BufReader */ - static create(r: Reader, size: number = DEFAULT_BUF_SIZE): BufReader { - return r instanceof BufReader ? r : new BufReader(r, size); - } - - constructor(rd: Reader, size: number = DEFAULT_BUF_SIZE) { - if (size < MIN_BUF_SIZE) { - size = MIN_BUF_SIZE; - } - this._reset(new Uint8Array(size), rd); - } - - /** Returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - buffered(): number { - return this.w - this.r; - } - - // Reads a new chunk into the buffer. - private async _fill(): Promise { - // Slide existing data to beginning. - if (this.r > 0) { - this.buf.copyWithin(0, this.r, this.w); - this.w -= this.r; - this.r = 0; - } - - if (this.w >= this.buf.byteLength) { - throw Error("bufio: tried to fill full buffer"); - } - - // Read new data: try a limited number of times. - for (let i = MAX_CONSECUTIVE_EMPTY_READS; i > 0; i--) { - const rr = await this.rd.read(this.buf.subarray(this.w)); - if (rr === null) { - this.eof = true; - return; - } - assert(rr >= 0, "negative read"); - this.w += rr; - if (rr > 0) { - return; - } - } - - throw new Error( - `No progress after ${MAX_CONSECUTIVE_EMPTY_READS} read() calls`, - ); - } - - /** Discards any buffered data, resets all state, and switches - * the buffered reader to read from r. - */ - reset(r: Reader): void { - this._reset(this.buf, r); - } - - private _reset(buf: Uint8Array, rd: Reader): void { - this.buf = buf; - this.rd = rd; - this.eof = false; - // this.lastByte = -1; - // this.lastCharSize = -1; - } - - /** reads data into p. - * It returns the number of bytes read into p. - * The bytes are taken from at most one Read on the underlying Reader, - * hence n may be less than len(p). - * To read exactly len(p) bytes, use io.ReadFull(b, p). - */ - async read(p: Uint8Array): Promise { - let rr: number | null = p.byteLength; - if (p.byteLength === 0) return rr; - - if (this.r === this.w) { - if (p.byteLength >= this.buf.byteLength) { - // Large read, empty buffer. - // Read directly into p to avoid copy. - const rr = await this.rd.read(p); - const nread = rr ?? 0; - assert(nread >= 0, "negative read"); - // if (rr.nread > 0) { - // this.lastByte = p[rr.nread - 1]; - // this.lastCharSize = -1; - // } - return rr; - } - - // One read. - // Do not use this.fill, which will loop. - this.r = 0; - this.w = 0; - rr = await this.rd.read(this.buf); - if (rr === 0 || rr === null) return rr; - assert(rr >= 0, "negative read"); - this.w += rr; - } - - // copy as much as we can - const copied = copy(this.buf.subarray(this.r, this.w), p, 0); - this.r += copied; - // this.lastByte = this.buf[this.r - 1]; - // this.lastCharSize = -1; - return copied; - } - - /** reads exactly `p.length` bytes into `p`. - * - * If successful, `p` is returned. - * - * If the end of the underlying stream has been reached, and there are no more - * bytes available in the buffer, `readFull()` returns `null` instead. - * - * An error is thrown if some bytes could be read, but not enough to fill `p` - * entirely before the underlying stream reported an error or EOF. Any error - * thrown will have a `partial` property that indicates the slice of the - * buffer that has been successfully filled with data. - * - * Ported from https://golang.org/pkg/io/#ReadFull - */ - async readFull(p: Uint8Array): Promise { - let bytesRead = 0; - while (bytesRead < p.length) { - try { - const rr = await this.read(p.subarray(bytesRead)); - if (rr === null) { - if (bytesRead === 0) { - return null; - } else { - throw new PartialReadError(); - } - } - bytesRead += rr; - } catch (err) { - err.partial = p.subarray(0, bytesRead); - throw err; - } - } - return p; - } - - /** Returns the next byte [0, 255] or `null`. */ - async readByte(): Promise { - while (this.r === this.w) { - if (this.eof) return null; - await this._fill(); // buffer is empty. - } - const c = this.buf[this.r]; - this.r++; - // this.lastByte = c; - return c; - } - - /** readString() reads until the first occurrence of delim in the input, - * returning a string containing the data up to and including the delimiter. - * If ReadString encounters an error before finding a delimiter, - * it returns the data read before the error and the error itself - * (often `null`). - * ReadString returns err != nil if and only if the returned data does not end - * in delim. - * For simple uses, a Scanner may be more convenient. - */ - async readString(delim: string): Promise { - if (delim.length !== 1) { - throw new Error("Delimiter should be a single character"); - } - const buffer = await this.readSlice(delim.charCodeAt(0)); - if (buffer === null) return null; - return new TextDecoder().decode(buffer); - } - - /** `readLine()` is a low-level line-reading primitive. Most callers should - * use `readString('\n')` instead or use a Scanner. - * - * `readLine()` tries to return a single line, not including the end-of-line - * bytes. If the line was too long for the buffer then `more` is set and the - * beginning of the line is returned. The rest of the line will be returned - * from future calls. `more` will be false when returning the last fragment - * of the line. The returned buffer is only valid until the next call to - * `readLine()`. - * - * The text returned from ReadLine does not include the line end ("\r\n" or - * "\n"). - * - * When the end of the underlying stream is reached, the final bytes in the - * stream are returned. No indication or error is given if the input ends - * without a final line end. When there are no more trailing bytes to read, - * `readLine()` returns `null`. - * - * Calling `unreadByte()` after `readLine()` will always unread the last byte - * read (possibly a character belonging to the line end) even if that byte is - * not part of the line returned by `readLine()`. - */ - async readLine(): Promise { - let line: Uint8Array | null; - - try { - line = await this.readSlice(LF); - } catch (err) { - let { partial } = err; - assert( - partial instanceof Uint8Array, - "bufio: caught error from `readSlice()` without `partial` property", - ); - - // Don't throw if `readSlice()` failed with `BufferFullError`, instead we - // just return whatever is available and set the `more` flag. - if (!(err instanceof BufferFullError)) { - throw err; - } - - // Handle the case where "\r\n" straddles the buffer. - if ( - !this.eof && - partial.byteLength > 0 && - partial[partial.byteLength - 1] === CR - ) { - // Put the '\r' back on buf and drop it from line. - // Let the next call to ReadLine check for "\r\n". - assert(this.r > 0, "bufio: tried to rewind past start of buffer"); - this.r--; - partial = partial.subarray(0, partial.byteLength - 1); - } - - return { line: partial, more: !this.eof }; - } - - if (line === null) { - return null; - } - - if (line.byteLength === 0) { - return { line, more: false }; - } - - if (line[line.byteLength - 1] == LF) { - let drop = 1; - if (line.byteLength > 1 && line[line.byteLength - 2] === CR) { - drop = 2; - } - line = line.subarray(0, line.byteLength - drop); - } - return { line, more: false }; - } - - /** `readSlice()` reads until the first occurrence of `delim` in the input, - * returning a slice pointing at the bytes in the buffer. The bytes stop - * being valid at the next read. - * - * If `readSlice()` encounters an error before finding a delimiter, or the - * buffer fills without finding a delimiter, it throws an error with a - * `partial` property that contains the entire buffer. - * - * If `readSlice()` encounters the end of the underlying stream and there are - * any bytes left in the buffer, the rest of the buffer is returned. In other - * words, EOF is always treated as a delimiter. Once the buffer is empty, - * it returns `null`. - * - * Because the data returned from `readSlice()` will be overwritten by the - * next I/O operation, most clients should use `readString()` instead. - */ - async readSlice(delim: number): Promise { - let s = 0; // search start index - let slice: Uint8Array | undefined; - - while (true) { - // Search buffer. - let i = this.buf.subarray(this.r + s, this.w).indexOf(delim); - if (i >= 0) { - i += s; - slice = this.buf.subarray(this.r, this.r + i + 1); - this.r += i + 1; - break; - } - - // EOF? - if (this.eof) { - if (this.r === this.w) { - return null; - } - slice = this.buf.subarray(this.r, this.w); - this.r = this.w; - break; - } - - // Buffer full? - if (this.buffered() >= this.buf.byteLength) { - this.r = this.w; - // #4521 The internal buffer should not be reused across reads because it causes corruption of data. - const oldbuf = this.buf; - const newbuf = this.buf.slice(0); - this.buf = newbuf; - throw new BufferFullError(oldbuf); - } - - s = this.w - this.r; // do not rescan area we scanned before - - // Buffer is not full. - try { - await this._fill(); - } catch (err) { - err.partial = slice; - throw err; - } - } - - // Handle last byte, if any. - // const i = slice.byteLength - 1; - // if (i >= 0) { - // this.lastByte = slice[i]; - // this.lastCharSize = -1 - // } - - return slice; - } - - /** `peek()` returns the next `n` bytes without advancing the reader. The - * bytes stop being valid at the next read call. - * - * When the end of the underlying stream is reached, but there are unread - * bytes left in the buffer, those bytes are returned. If there are no bytes - * left in the buffer, it returns `null`. - * - * If an error is encountered before `n` bytes are available, `peek()` throws - * an error with the `partial` property set to a slice of the buffer that - * contains the bytes that were available before the error occurred. - */ - async peek(n: number): Promise { - if (n < 0) { - throw Error("negative count"); - } - - let avail = this.w - this.r; - while (avail < n && avail < this.buf.byteLength && !this.eof) { - try { - await this._fill(); - } catch (err) { - err.partial = this.buf.subarray(this.r, this.w); - throw err; - } - avail = this.w - this.r; - } - - if (avail === 0 && this.eof) { - return null; - } else if (avail < n && this.eof) { - return this.buf.subarray(this.r, this.r + avail); - } else if (avail < n) { - throw new BufferFullError(this.buf.subarray(this.r, this.w)); - } - - return this.buf.subarray(this.r, this.r + n); - } -} - -abstract class AbstractBufBase { - buf!: Uint8Array; - usedBufferBytes = 0; - err: Error | null = null; - - /** Size returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - /** Returns how many bytes are unused in the buffer. */ - available(): number { - return this.buf.byteLength - this.usedBufferBytes; - } - - /** buffered returns the number of bytes that have been written into the - * current buffer. - */ - buffered(): number { - return this.usedBufferBytes; - } -} - -/** BufWriter implements buffering for an deno.Writer object. - * If an error occurs writing to a Writer, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.Writer. - */ -export class BufWriter extends AbstractBufBase implements Writer { - /** return new BufWriter unless writer is BufWriter */ - static create(writer: Writer, size: number = DEFAULT_BUF_SIZE): BufWriter { - return writer instanceof BufWriter ? writer : new BufWriter(writer, size); - } - - constructor(private writer: Writer, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: Writer): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.Writer. */ - async flush(): Promise { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - await Deno.writeAll( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - async write(data: Uint8Array): Promise { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = await this.writer.write(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - await this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** BufWriterSync implements buffering for a deno.WriterSync object. - * If an error occurs writing to a WriterSync, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.WriterSync. - */ -export class BufWriterSync extends AbstractBufBase implements WriterSync { - /** return new BufWriterSync unless writer is BufWriterSync */ - static create( - writer: WriterSync, - size: number = DEFAULT_BUF_SIZE, - ): BufWriterSync { - return writer instanceof BufWriterSync - ? writer - : new BufWriterSync(writer, size); - } - - constructor(private writer: WriterSync, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: WriterSync): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.WriterSync. */ - flush(): void { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - Deno.writeAllSync( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - writeSync(data: Uint8Array): number { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = this.writer.writeSync(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** Generate longest proper prefix which is also suffix array. */ -function createLPS(pat: Uint8Array): Uint8Array { - const lps = new Uint8Array(pat.length); - lps[0] = 0; - let prefixEnd = 0; - let i = 1; - while (i < lps.length) { - if (pat[i] == pat[prefixEnd]) { - prefixEnd++; - lps[i] = prefixEnd; - i++; - } else if (prefixEnd === 0) { - lps[i] = 0; - i++; - } else { - prefixEnd = pat[prefixEnd - 1]; - } - } - return lps; -} - -/** Read delimited bytes from a Reader. */ -export async function* readDelim( - reader: Reader, - delim: Uint8Array, -): AsyncIterableIterator { - // Avoid unicode problems - const delimLen = delim.length; - const delimLPS = createLPS(delim); - - let inputBuffer = new Deno.Buffer(); - const inspectArr = new Uint8Array(Math.max(1024, delimLen + 1)); - - // Modified KMP - let inspectIndex = 0; - let matchIndex = 0; - while (true) { - const result = await reader.read(inspectArr); - if (result === null) { - // Yield last chunk. - yield inputBuffer.bytes(); - return; - } - if ((result as number) < 0) { - // Discard all remaining and silently fail. - return; - } - const sliceRead = inspectArr.subarray(0, result as number); - await Deno.writeAll(inputBuffer, sliceRead); - - let sliceToProcess = inputBuffer.bytes(); - while (inspectIndex < sliceToProcess.length) { - if (sliceToProcess[inspectIndex] === delim[matchIndex]) { - inspectIndex++; - matchIndex++; - if (matchIndex === delimLen) { - // Full match - const matchEnd = inspectIndex - delimLen; - const readyBytes = sliceToProcess.subarray(0, matchEnd); - // Copy - const pendingBytes = sliceToProcess.slice(inspectIndex); - yield readyBytes; - // Reset match, different from KMP. - sliceToProcess = pendingBytes; - inspectIndex = 0; - matchIndex = 0; - } - } else { - if (matchIndex === 0) { - inspectIndex++; - } else { - matchIndex = delimLPS[matchIndex - 1]; - } - } - } - // Keep inspectIndex and matchIndex. - inputBuffer = new Deno.Buffer(sliceToProcess); - } -} - -/** Read delimited strings from a Reader. */ -export async function* readStringDelim( - reader: Reader, - delim: string, -): AsyncIterableIterator { - const encoder = new TextEncoder(); - const decoder = new TextDecoder(); - for await (const chunk of readDelim(reader, encoder.encode(delim))) { - yield decoder.decode(chunk); - } -} - -/** Read strings line-by-line from a Reader. */ -export async function* readLines( - reader: Reader, -): AsyncIterableIterator { - for await (let chunk of readStringDelim(reader, "\n")) { - // Finding a CR at the end of the line is evidence of a - // "\r\n" at the end of the line. The "\r" part should be - // removed too. - if (chunk.endsWith("\r")) { - chunk = chunk.slice(0, -1); - } - yield chunk; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1410d74af6ea3ae5f49feeb4f250e306a0032c2b.ts b/crates/swc_bundler/tests/.cache/deno/1410d74af6ea3ae5f49feeb4f250e306a0032c2b.ts deleted file mode 100644 index 55c55ffab10e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1410d74af6ea3ae5f49feeb4f250e306a0032c2b.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Loaded from https://deno.land/x/validasaur/src/messages.ts - - -import type { ValidationMessages } from "./interfaces.ts"; - -export const defaultMessages: ValidationMessages = { - "fileExists:pathCheck": "file :value doesn't exists", - "fileExists:stringCheck": "file path must be a string", - isArray: ":attr must be an array", - isBool: ":attr must be a boolean", - isEmail: ":attr is not a valid email address", - isFloat: ":attr must be a float number", - isIn: ":value is not allowed", - isInt: ":attr must be an integer", - isNumber: ":attr must be a number", - isNumeric: ":attr must be numeric", - isString: ":attr must be a string", - lengthBetween: - ":attr characters length must be between :minLength-:maxLength", - match: ":attr format is incorrect", - maxLength: ":attr cannot be higher than :maxValue characters", - maxNumber: ":attr cannot be higher than :maxValue", - minLength: ":attr cannot be lower than :minValue characters", - minNumber: ":attr cannot be lower than :minValue", - notIn: ":value is not allowed", - notNull: ":value cannot be null", - numberBetween: ":value must be between :minValue - :maxValue", - required: ":attr is required", - default: ":attr is invalid", -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1428cf4db6bc088ba76d68090af3bdada70f249f.ts b/crates/swc_bundler/tests/.cache/deno/1428cf4db6bc088ba76d68090af3bdada70f249f.ts deleted file mode 100644 index 7d3244f81218..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1428cf4db6bc088ba76d68090af3bdada70f249f.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isSlug.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * @ignore - */ -const charsetRegex = /^[^\s-_](?!.*?[-_]{2,})([a-z0-9-\\]{1,})[^\s]*[^-_\s]$/; - -export const isSlug = (str: string) => { - assertString(str); - return charsetRegex.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/142afee8f925a0c88faf0193c4c87686a32562ec.ts b/crates/swc_bundler/tests/.cache/deno/142afee8f925a0c88faf0193c4c87686a32562ec.ts deleted file mode 100644 index 207815b0ca3d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/142afee8f925a0c88faf0193c4c87686a32562ec.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/commands/create_global_application_command.ts - - -import { ApplicationCommandOption } from "./application_command_option.ts"; - -/** https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command-json-params */ -export interface CreateGlobalApplicationCommand { - /** 1-31 character name matching lowercase `^[\w-]{1,32}$` */ - name: string; - /** 1-100 character description */ - description: string; - /** The parameters for the command */ - options?: ApplicationCommandOption[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/143995c47cdcea6c5a105c392ad766d23a5eb33f.ts b/crates/swc_bundler/tests/.cache/deno/143995c47cdcea6c5a105c392ad766d23a5eb33f.ts deleted file mode 100644 index aa91ba67ca34..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/143995c47cdcea6c5a105c392ad766d23a5eb33f.ts +++ /dev/null @@ -1,68 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/fs/ensure_file.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import * as path from "../path/mod.ts"; -import { ensureDir, ensureDirSync } from "./ensure_dir.ts"; -import { getFileInfoType } from "./_util.ts"; - -/** - * Ensures that the file exists. - * If the file that is requested to be created is in directories that do not - * exist. - * these directories are created. If the file already exists, - * it is NOTMODIFIED. - * Requires the `--allow-read` and `--allow-write` flag. - */ -export async function ensureFile(filePath: string): Promise { - try { - // if file exists - const stat = await Deno.lstat(filePath); - if (!stat.isFile) { - throw new Error( - `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`, - ); - } - } catch (err) { - // if file not exists - if (err instanceof Deno.errors.NotFound) { - // ensure dir exists - await ensureDir(path.dirname(filePath)); - // create file - await Deno.writeFile(filePath, new Uint8Array()); - return; - } - - throw err; - } -} - -/** - * Ensures that the file exists. - * If the file that is requested to be created is in directories that do not - * exist, - * these directories are created. If the file already exists, - * it is NOT MODIFIED. - * Requires the `--allow-read` and `--allow-write` flag. - */ -export function ensureFileSync(filePath: string): void { - try { - // if file exists - const stat = Deno.lstatSync(filePath); - if (!stat.isFile) { - throw new Error( - `Ensure path exists, expected 'file', got '${getFileInfoType(stat)}'`, - ); - } - } catch (err) { - // if file not exists - if (err instanceof Deno.errors.NotFound) { - // ensure dir exists - ensureDirSync(path.dirname(filePath)); - // create file - Deno.writeFileSync(filePath, new Uint8Array()); - return; - } - throw err; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/144981b6498020d07db7b00d051fa52657ec40a4.ts b/crates/swc_bundler/tests/.cache/deno/144981b6498020d07db7b00d051fa52657ec40a4.ts deleted file mode 100644 index abefb36220c9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/144981b6498020d07db7b00d051fa52657ec40a4.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/deps.ts - - -export { encode as encodeJPG, decode as decodeJPG, Image } from "https://deno.land/x/jpegts@1.1/mod.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/1449d4e751812917c4513df3c9e91cb4e8ed6e20.ts b/crates/swc_bundler/tests/.cache/deno/1449d4e751812917c4513df3c9e91cb4e8ed6e20.ts deleted file mode 100644 index 7e6dfb210273..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1449d4e751812917c4513df3c9e91cb4e8ed6e20.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/zlib/zlib/crc32.ts - - -export function makeTable() { - let c: number; - const table = []; - const m = 0xEDB88320; - - for (let n = 0; n < 256; n++) { - c = n; - for (let k = 0; k < 8; k++) { - c = ((c & 1) ? (m ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; -} - -// Create table on load. Just 255 signed longs. Not a problem. -const crcTable = makeTable(); - -export function crc32(crc: any, buf: any, len: any, pos: any) { - let t = crcTable; - let end = pos + len; - let f = 0xFF; - - crc ^= -1; - - for (let i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & f]; - } - - return (crc ^ (-1)); // >>> 0; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1479eafa0ae9e55770fbed944a0b7d21f23d9fe4.ts b/crates/swc_bundler/tests/.cache/deno/1479eafa0ae9e55770fbed944a0b7d21f23d9fe4.ts deleted file mode 100644 index 177c8fb8a471..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1479eafa0ae9e55770fbed944a0b7d21f23d9fe4.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/std@0.78.0/encoding/_yaml/type/merge.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { Type } from "../type.ts"; - -function resolveYamlMerge(data: string): boolean { - return data === "<<" || data === null; -} - -export const merge = new Type("tag:yaml.org,2002:merge", { - kind: "scalar", - resolve: resolveYamlMerge, -}); diff --git a/crates/swc_bundler/tests/.cache/deno/149ca7cd67e99d4dbdfdb2334423f29f486a3565.ts b/crates/swc_bundler/tests/.cache/deno/149ca7cd67e99d4dbdfdb2334423f29f486a3565.ts deleted file mode 100644 index 0df1770c38a4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/149ca7cd67e99d4dbdfdb2334423f29f486a3565.ts +++ /dev/null @@ -1,383 +0,0 @@ -// Loaded from https://deno.land/std@0.81.0/http/_io.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { BufReader, BufWriter } from "../io/bufio.ts"; -import { TextProtoReader } from "../textproto/mod.ts"; -import { assert } from "../_util/assert.ts"; -import { encoder } from "../encoding/utf8.ts"; -import { Response, ServerRequest } from "./server.ts"; -import { STATUS_TEXT } from "./http_status.ts"; - -export function emptyReader(): Deno.Reader { - return { - read(_: Uint8Array): Promise { - return Promise.resolve(null); - }, - }; -} - -export function bodyReader(contentLength: number, r: BufReader): Deno.Reader { - let totalRead = 0; - let finished = false; - async function read(buf: Uint8Array): Promise { - if (finished) return null; - let result: number | null; - const remaining = contentLength - totalRead; - if (remaining >= buf.byteLength) { - result = await r.read(buf); - } else { - const readBuf = buf.subarray(0, remaining); - result = await r.read(readBuf); - } - if (result !== null) { - totalRead += result; - } - finished = totalRead === contentLength; - return result; - } - return { read }; -} - -export function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader { - // Based on https://tools.ietf.org/html/rfc2616#section-19.4.6 - const tp = new TextProtoReader(r); - let finished = false; - const chunks: Array<{ - offset: number; - data: Uint8Array; - }> = []; - async function read(buf: Uint8Array): Promise { - if (finished) return null; - const [chunk] = chunks; - if (chunk) { - const chunkRemaining = chunk.data.byteLength - chunk.offset; - const readLength = Math.min(chunkRemaining, buf.byteLength); - for (let i = 0; i < readLength; i++) { - buf[i] = chunk.data[chunk.offset + i]; - } - chunk.offset += readLength; - if (chunk.offset === chunk.data.byteLength) { - chunks.shift(); - // Consume \r\n; - if ((await tp.readLine()) === null) { - throw new Deno.errors.UnexpectedEof(); - } - } - return readLength; - } - const line = await tp.readLine(); - if (line === null) throw new Deno.errors.UnexpectedEof(); - // TODO: handle chunk extension - const [chunkSizeString] = line.split(";"); - const chunkSize = parseInt(chunkSizeString, 16); - if (Number.isNaN(chunkSize) || chunkSize < 0) { - throw new Deno.errors.InvalidData("Invalid chunk size"); - } - if (chunkSize > 0) { - if (chunkSize > buf.byteLength) { - let eof = await r.readFull(buf); - if (eof === null) { - throw new Deno.errors.UnexpectedEof(); - } - const restChunk = new Uint8Array(chunkSize - buf.byteLength); - eof = await r.readFull(restChunk); - if (eof === null) { - throw new Deno.errors.UnexpectedEof(); - } else { - chunks.push({ - offset: 0, - data: restChunk, - }); - } - return buf.byteLength; - } else { - const bufToFill = buf.subarray(0, chunkSize); - const eof = await r.readFull(bufToFill); - if (eof === null) { - throw new Deno.errors.UnexpectedEof(); - } - // Consume \r\n - if ((await tp.readLine()) === null) { - throw new Deno.errors.UnexpectedEof(); - } - return chunkSize; - } - } else { - assert(chunkSize === 0); - // Consume \r\n - if ((await r.readLine()) === null) { - throw new Deno.errors.UnexpectedEof(); - } - await readTrailers(h, r); - finished = true; - return null; - } - } - return { read }; -} - -function isProhibidedForTrailer(key: string): boolean { - const s = new Set(["transfer-encoding", "content-length", "trailer"]); - return s.has(key.toLowerCase()); -} - -/** Read trailer headers from reader and append values to headers. "trailer" - * field will be deleted. */ -export async function readTrailers( - headers: Headers, - r: BufReader, -): Promise { - const trailers = parseTrailer(headers.get("trailer")); - if (trailers == null) return; - const trailerNames = [...trailers.keys()]; - const tp = new TextProtoReader(r); - const result = await tp.readMIMEHeader(); - if (result == null) { - throw new Deno.errors.InvalidData("Missing trailer header."); - } - const undeclared = [...result.keys()].filter( - (k) => !trailerNames.includes(k), - ); - if (undeclared.length > 0) { - throw new Deno.errors.InvalidData( - `Undeclared trailers: ${Deno.inspect(undeclared)}.`, - ); - } - for (const [k, v] of result) { - headers.append(k, v); - } - const missingTrailers = trailerNames.filter((k) => !result.has(k)); - if (missingTrailers.length > 0) { - throw new Deno.errors.InvalidData( - `Missing trailers: ${Deno.inspect(missingTrailers)}.`, - ); - } - headers.delete("trailer"); -} - -function parseTrailer(field: string | null): Headers | undefined { - if (field == null) { - return undefined; - } - const trailerNames = field.split(",").map((v) => v.trim().toLowerCase()); - if (trailerNames.length === 0) { - throw new Deno.errors.InvalidData("Empty trailer header."); - } - const prohibited = trailerNames.filter((k) => isProhibidedForTrailer(k)); - if (prohibited.length > 0) { - throw new Deno.errors.InvalidData( - `Prohibited trailer names: ${Deno.inspect(prohibited)}.`, - ); - } - return new Headers(trailerNames.map((key) => [key, ""])); -} - -export async function writeChunkedBody( - w: BufWriter, - r: Deno.Reader, -): Promise { - for await (const chunk of Deno.iter(r)) { - if (chunk.byteLength <= 0) continue; - const start = encoder.encode(`${chunk.byteLength.toString(16)}\r\n`); - const end = encoder.encode("\r\n"); - await w.write(start); - await w.write(chunk); - await w.write(end); - await w.flush(); - } - - const endChunk = encoder.encode("0\r\n\r\n"); - await w.write(endChunk); -} - -/** Write trailer headers to writer. It should mostly should be called after - * `writeResponse()`. */ -export async function writeTrailers( - w: Deno.Writer, - headers: Headers, - trailers: Headers, -): Promise { - const trailer = headers.get("trailer"); - if (trailer === null) { - throw new TypeError("Missing trailer header."); - } - const transferEncoding = headers.get("transfer-encoding"); - if (transferEncoding === null || !transferEncoding.match(/^chunked/)) { - throw new TypeError( - `Trailers are only allowed for "transfer-encoding: chunked", got "transfer-encoding: ${transferEncoding}".`, - ); - } - const writer = BufWriter.create(w); - const trailerNames = trailer.split(",").map((s) => s.trim().toLowerCase()); - const prohibitedTrailers = trailerNames.filter((k) => - isProhibidedForTrailer(k) - ); - if (prohibitedTrailers.length > 0) { - throw new TypeError( - `Prohibited trailer names: ${Deno.inspect(prohibitedTrailers)}.`, - ); - } - const undeclared = [...trailers.keys()].filter( - (k) => !trailerNames.includes(k), - ); - if (undeclared.length > 0) { - throw new TypeError(`Undeclared trailers: ${Deno.inspect(undeclared)}.`); - } - for (const [key, value] of trailers) { - await writer.write(encoder.encode(`${key}: ${value}\r\n`)); - } - await writer.write(encoder.encode("\r\n")); - await writer.flush(); -} - -export async function writeResponse( - w: Deno.Writer, - r: Response, -): Promise { - const protoMajor = 1; - const protoMinor = 1; - const statusCode = r.status || 200; - const statusText = STATUS_TEXT.get(statusCode); - const writer = BufWriter.create(w); - if (!statusText) { - throw new Deno.errors.InvalidData("Bad status code"); - } - if (!r.body) { - r.body = new Uint8Array(); - } - if (typeof r.body === "string") { - r.body = encoder.encode(r.body); - } - - let out = `HTTP/${protoMajor}.${protoMinor} ${statusCode} ${statusText}\r\n`; - - const headers = r.headers ?? new Headers(); - - if (r.body && !headers.get("content-length")) { - if (r.body instanceof Uint8Array) { - out += `content-length: ${r.body.byteLength}\r\n`; - } else if (!headers.get("transfer-encoding")) { - out += "transfer-encoding: chunked\r\n"; - } - } - - for (const [key, value] of headers) { - out += `${key}: ${value}\r\n`; - } - - out += `\r\n`; - - const header = encoder.encode(out); - const n = await writer.write(header); - assert(n === header.byteLength); - - if (r.body instanceof Uint8Array) { - const n = await writer.write(r.body); - assert(n === r.body.byteLength); - } else if (headers.has("content-length")) { - const contentLength = headers.get("content-length"); - assert(contentLength != null); - const bodyLength = parseInt(contentLength); - const n = await Deno.copy(r.body, writer); - assert(n === bodyLength); - } else { - await writeChunkedBody(writer, r.body); - } - if (r.trailers) { - const t = await r.trailers(); - await writeTrailers(writer, headers, t); - } - await writer.flush(); -} - -/** - * ParseHTTPVersion parses a HTTP version string. - * "HTTP/1.0" returns (1, 0). - * Ported from https://github.com/golang/go/blob/f5c43b9/src/net/http/request.go#L766-L792 - */ -export function parseHTTPVersion(vers: string): [number, number] { - switch (vers) { - case "HTTP/1.1": - return [1, 1]; - - case "HTTP/1.0": - return [1, 0]; - - default: { - const Big = 1000000; // arbitrary upper bound - - if (!vers.startsWith("HTTP/")) { - break; - } - - const dot = vers.indexOf("."); - if (dot < 0) { - break; - } - - const majorStr = vers.substring(vers.indexOf("/") + 1, dot); - const major = Number(majorStr); - if (!Number.isInteger(major) || major < 0 || major > Big) { - break; - } - - const minorStr = vers.substring(dot + 1); - const minor = Number(minorStr); - if (!Number.isInteger(minor) || minor < 0 || minor > Big) { - break; - } - - return [major, minor]; - } - } - - throw new Error(`malformed HTTP version ${vers}`); -} - -export async function readRequest( - conn: Deno.Conn, - bufr: BufReader, -): Promise { - const tp = new TextProtoReader(bufr); - const firstLine = await tp.readLine(); // e.g. GET /index.html HTTP/1.0 - if (firstLine === null) return null; - const headers = await tp.readMIMEHeader(); - if (headers === null) throw new Deno.errors.UnexpectedEof(); - - const req = new ServerRequest(); - req.conn = conn; - req.r = bufr; - [req.method, req.url, req.proto] = firstLine.split(" ", 3); - [req.protoMinor, req.protoMajor] = parseHTTPVersion(req.proto); - req.headers = headers; - fixLength(req); - return req; -} - -function fixLength(req: ServerRequest): void { - const contentLength = req.headers.get("Content-Length"); - if (contentLength) { - const arrClen = contentLength.split(","); - if (arrClen.length > 1) { - const distinct = [...new Set(arrClen.map((e): string => e.trim()))]; - if (distinct.length > 1) { - throw Error("cannot contain multiple Content-Length headers"); - } else { - req.headers.set("Content-Length", distinct[0]); - } - } - const c = req.headers.get("Content-Length"); - if (req.method === "HEAD" && c && c !== "0") { - throw Error("http: method cannot contain a Content-Length"); - } - if (c && req.headers.has("transfer-encoding")) { - // A sender MUST NOT send a Content-Length header field in any message - // that contains a Transfer-Encoding header field. - // rfc: https://tools.ietf.org/html/rfc7230#section-3.3.2 - throw new Error( - "http: Transfer-Encoding and Content-Length cannot be send together", - ); - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/14caf10dcb6d28d0c7f647aeb882cc69b928e20c.ts b/crates/swc_bundler/tests/.cache/deno/14caf10dcb6d28d0c7f647aeb882cc69b928e20c.ts deleted file mode 100644 index 22de3d703250..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/14caf10dcb6d28d0c7f647aeb882cc69b928e20c.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/unnest.js - - -import _identity from './internal/_identity.js'; -import chain from './chain.js'; - - -/** - * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from - * any [Chain](https://github.com/fantasyland/fantasy-land#chain). - * - * @func - * @memberOf R - * @since v0.3.0 - * @category List - * @sig Chain c => c (c a) -> c a - * @param {*} list - * @return {*} - * @see R.flatten, R.chain - * @example - * - * R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] - * R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] - */ -var unnest = chain(_identity); -export default unnest; diff --git a/crates/swc_bundler/tests/.cache/deno/14d2cb6efaa975d346dd8d3811810e8c910c4912.ts b/crates/swc_bundler/tests/.cache/deno/14d2cb6efaa975d346dd8d3811810e8c910c4912.ts deleted file mode 100644 index 781a27f8a3eb..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/14d2cb6efaa975d346dd8d3811810e8c910c4912.ts +++ /dev/null @@ -1,1272 +0,0 @@ -// Loaded from https://deno.land/x/jpegts@1.1/lib/encoder.ts - - -/* - Copyright (c) 2008, Adobe Systems Incorporated - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Adobe Systems Incorporated nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -/* -JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 - -Basic GUI blocking jpeg encoder -*/ -import { Image } from "./image.ts"; - -function JPEGEncoder(quality: number) { - const ffloor = Math.floor; - const YTable = new Array(64); - const UVTable = new Array(64); - const fdtbl_Y = new Array(64); - const fdtbl_UV = new Array(64); - // @ts-ignore - let YDC_HT; - // @ts-ignore - let UVDC_HT; - // @ts-ignore - let YAC_HT; - // @ts-ignore - let UVAC_HT; - - const bitcode = new Array(65535); - const category = new Array(65535); - const outputfDCTQuant = new Array(64); - const DU = new Array(64); - let byteout = []; - let bytenew = 0; - let bytepos = 7; - - const YDU = new Array(64); - const UDU = new Array(64); - const VDU = new Array(64); - const clt = new Array(256); - const RGB_YUV_TABLE = new Array(2048); - // @ts-ignore - let currentQuality; - - const ZigZag = [ - 0, - 1, - 5, - 6, - 14, - 15, - 27, - 28, - 2, - 4, - 7, - 13, - 16, - 26, - 29, - 42, - 3, - 8, - 12, - 17, - 25, - 30, - 41, - 43, - 9, - 11, - 18, - 24, - 31, - 40, - 44, - 53, - 10, - 19, - 23, - 32, - 39, - 45, - 52, - 54, - 20, - 22, - 33, - 38, - 46, - 51, - 55, - 60, - 21, - 34, - 37, - 47, - 50, - 56, - 59, - 61, - 35, - 36, - 48, - 49, - 57, - 58, - 62, - 63, - ]; - - const std_dc_luminance_nrcodes = [ - 0, - 0, - 1, - 5, - 1, - 1, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ]; - const std_dc_luminance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; - const std_ac_luminance_nrcodes = [ - 0, - 0, - 2, - 1, - 3, - 3, - 2, - 4, - 3, - 5, - 5, - 4, - 4, - 0, - 0, - 1, - 0x7d, - ]; - const std_ac_luminance_values = [ - 0x01, - 0x02, - 0x03, - 0x00, - 0x04, - 0x11, - 0x05, - 0x12, - 0x21, - 0x31, - 0x41, - 0x06, - 0x13, - 0x51, - 0x61, - 0x07, - 0x22, - 0x71, - 0x14, - 0x32, - 0x81, - 0x91, - 0xa1, - 0x08, - 0x23, - 0x42, - 0xb1, - 0xc1, - 0x15, - 0x52, - 0xd1, - 0xf0, - 0x24, - 0x33, - 0x62, - 0x72, - 0x82, - 0x09, - 0x0a, - 0x16, - 0x17, - 0x18, - 0x19, - 0x1a, - 0x25, - 0x26, - 0x27, - 0x28, - 0x29, - 0x2a, - 0x34, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x3a, - 0x43, - 0x44, - 0x45, - 0x46, - 0x47, - 0x48, - 0x49, - 0x4a, - 0x53, - 0x54, - 0x55, - 0x56, - 0x57, - 0x58, - 0x59, - 0x5a, - 0x63, - 0x64, - 0x65, - 0x66, - 0x67, - 0x68, - 0x69, - 0x6a, - 0x73, - 0x74, - 0x75, - 0x76, - 0x77, - 0x78, - 0x79, - 0x7a, - 0x83, - 0x84, - 0x85, - 0x86, - 0x87, - 0x88, - 0x89, - 0x8a, - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9a, - 0xa2, - 0xa3, - 0xa4, - 0xa5, - 0xa6, - 0xa7, - 0xa8, - 0xa9, - 0xaa, - 0xb2, - 0xb3, - 0xb4, - 0xb5, - 0xb6, - 0xb7, - 0xb8, - 0xb9, - 0xba, - 0xc2, - 0xc3, - 0xc4, - 0xc5, - 0xc6, - 0xc7, - 0xc8, - 0xc9, - 0xca, - 0xd2, - 0xd3, - 0xd4, - 0xd5, - 0xd6, - 0xd7, - 0xd8, - 0xd9, - 0xda, - 0xe1, - 0xe2, - 0xe3, - 0xe4, - 0xe5, - 0xe6, - 0xe7, - 0xe8, - 0xe9, - 0xea, - 0xf1, - 0xf2, - 0xf3, - 0xf4, - 0xf5, - 0xf6, - 0xf7, - 0xf8, - 0xf9, - 0xfa, - ]; - - const std_dc_chrominance_nrcodes = [ - 0, - 0, - 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - ]; - const std_dc_chrominance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; - const std_ac_chrominance_nrcodes = [ - 0, - 0, - 2, - 1, - 2, - 4, - 4, - 3, - 4, - 7, - 5, - 4, - 4, - 0, - 1, - 2, - 0x77, - ]; - const std_ac_chrominance_values = [ - 0x00, - 0x01, - 0x02, - 0x03, - 0x11, - 0x04, - 0x05, - 0x21, - 0x31, - 0x06, - 0x12, - 0x41, - 0x51, - 0x07, - 0x61, - 0x71, - 0x13, - 0x22, - 0x32, - 0x81, - 0x08, - 0x14, - 0x42, - 0x91, - 0xa1, - 0xb1, - 0xc1, - 0x09, - 0x23, - 0x33, - 0x52, - 0xf0, - 0x15, - 0x62, - 0x72, - 0xd1, - 0x0a, - 0x16, - 0x24, - 0x34, - 0xe1, - 0x25, - 0xf1, - 0x17, - 0x18, - 0x19, - 0x1a, - 0x26, - 0x27, - 0x28, - 0x29, - 0x2a, - 0x35, - 0x36, - 0x37, - 0x38, - 0x39, - 0x3a, - 0x43, - 0x44, - 0x45, - 0x46, - 0x47, - 0x48, - 0x49, - 0x4a, - 0x53, - 0x54, - 0x55, - 0x56, - 0x57, - 0x58, - 0x59, - 0x5a, - 0x63, - 0x64, - 0x65, - 0x66, - 0x67, - 0x68, - 0x69, - 0x6a, - 0x73, - 0x74, - 0x75, - 0x76, - 0x77, - 0x78, - 0x79, - 0x7a, - 0x82, - 0x83, - 0x84, - 0x85, - 0x86, - 0x87, - 0x88, - 0x89, - 0x8a, - 0x92, - 0x93, - 0x94, - 0x95, - 0x96, - 0x97, - 0x98, - 0x99, - 0x9a, - 0xa2, - 0xa3, - 0xa4, - 0xa5, - 0xa6, - 0xa7, - 0xa8, - 0xa9, - 0xaa, - 0xb2, - 0xb3, - 0xb4, - 0xb5, - 0xb6, - 0xb7, - 0xb8, - 0xb9, - 0xba, - 0xc2, - 0xc3, - 0xc4, - 0xc5, - 0xc6, - 0xc7, - 0xc8, - 0xc9, - 0xca, - 0xd2, - 0xd3, - 0xd4, - 0xd5, - 0xd6, - 0xd7, - 0xd8, - 0xd9, - 0xda, - 0xe2, - 0xe3, - 0xe4, - 0xe5, - 0xe6, - 0xe7, - 0xe8, - 0xe9, - 0xea, - 0xf2, - 0xf3, - 0xf4, - 0xf5, - 0xf6, - 0xf7, - 0xf8, - 0xf9, - 0xfa, - ]; - // @ts-ignore - function initQuantTables(sf) { - const YQT = [ - 16, - 11, - 10, - 16, - 24, - 40, - 51, - 61, - 12, - 12, - 14, - 19, - 26, - 58, - 60, - 55, - 14, - 13, - 16, - 24, - 40, - 57, - 69, - 56, - 14, - 17, - 22, - 29, - 51, - 87, - 80, - 62, - 18, - 22, - 37, - 56, - 68, - 109, - 103, - 77, - 24, - 35, - 55, - 64, - 81, - 104, - 113, - 92, - 49, - 64, - 78, - 87, - 103, - 121, - 120, - 101, - 72, - 92, - 95, - 98, - 112, - 100, - 103, - 99, - ]; - - for (let i = 0; i < 64; i++) { - let t = ffloor((YQT[i] * sf + 50) / 100); - if (t < 1) { - t = 1; - } else if (t > 255) { - t = 255; - } - YTable[ZigZag[i]] = t; - } - const UVQT = [ - 17, - 18, - 24, - 47, - 99, - 99, - 99, - 99, - 18, - 21, - 26, - 66, - 99, - 99, - 99, - 99, - 24, - 26, - 56, - 99, - 99, - 99, - 99, - 99, - 47, - 66, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - 99, - ]; - for (let j = 0; j < 64; j++) { - let u = ffloor((UVQT[j] * sf + 50) / 100); - if (u < 1) { - u = 1; - } else if (u > 255) { - u = 255; - } - UVTable[ZigZag[j]] = u; - } - const aasf = [ - 1.0, - 1.387039845, - 1.306562965, - 1.175875602, - 1.0, - 0.785694958, - 0.541196100, - 0.275899379, - ]; - let k = 0; - for (let row = 0; row < 8; row++) { - for (let col = 0; col < 8; col++) { - fdtbl_Y[k] = (1.0 / (YTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - fdtbl_UV[k] = - (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - k++; - } - } - } - - // @ts-ignore - function computeHuffmanTbl(nrcodes, std_table) { - let codevalue = 0; - let pos_in_table = 0; - const HT = new Array(); - for (let k = 1; k <= 16; k++) { - for (let j = 1; j <= nrcodes[k]; j++) { - HT[std_table[pos_in_table]] = []; - HT[std_table[pos_in_table]][0] = codevalue; - HT[std_table[pos_in_table]][1] = k; - pos_in_table++; - codevalue++; - } - codevalue *= 2; - } - return HT; - } - - function initHuffmanTbl() { - YDC_HT = computeHuffmanTbl( - std_dc_luminance_nrcodes, - std_dc_luminance_values, - ); - UVDC_HT = computeHuffmanTbl( - std_dc_chrominance_nrcodes, - std_dc_chrominance_values, - ); - YAC_HT = computeHuffmanTbl( - std_ac_luminance_nrcodes, - std_ac_luminance_values, - ); - UVAC_HT = computeHuffmanTbl( - std_ac_chrominance_nrcodes, - std_ac_chrominance_values, - ); - } - - function initCategoryNumber() { - let nrlower = 1; - let nrupper = 2; - for (let cat = 1; cat <= 15; cat++) { - // Positive numbers - for (let nr = nrlower; nr < nrupper; nr++) { - category[32767 + nr] = cat; - bitcode[32767 + nr] = []; - bitcode[32767 + nr][1] = cat; - bitcode[32767 + nr][0] = nr; - } - // Negative numbers - for (let nrneg = -(nrupper - 1); nrneg <= -nrlower; nrneg++) { - category[32767 + nrneg] = cat; - bitcode[32767 + nrneg] = []; - bitcode[32767 + nrneg][1] = cat; - bitcode[32767 + nrneg][0] = nrupper - 1 + nrneg; - } - nrlower <<= 1; - nrupper <<= 1; - } - } - - function initRGBYUVTable() { - for (let i = 0; i < 256; i++) { - RGB_YUV_TABLE[i] = 19595 * i; - RGB_YUV_TABLE[(i + 256) >> 0] = 38470 * i; - RGB_YUV_TABLE[(i + 512) >> 0] = 7471 * i + 0x8000; - RGB_YUV_TABLE[(i + 768) >> 0] = -11059 * i; - RGB_YUV_TABLE[(i + 1024) >> 0] = -21709 * i; - RGB_YUV_TABLE[(i + 1280) >> 0] = 32768 * i + 0x807FFF; - RGB_YUV_TABLE[(i + 1536) >> 0] = -27439 * i; - RGB_YUV_TABLE[(i + 1792) >> 0] = -5329 * i; - } - } - - // IO functions - // @ts-ignore - function writeBits(bs) { - const value = bs[0]; - let posval = bs[1] - 1; - while (posval >= 0) { - if (value & (1 << posval)) { - bytenew |= (1 << bytepos); - } - posval--; - bytepos--; - if (bytepos < 0) { - if (bytenew === 0xFF) { - writeByte(0xFF); - writeByte(0); - } else { - writeByte(bytenew); - } - bytepos = 7; - bytenew = 0; - } - } - } - - // @ts-ignore - function writeByte(value) { - // byteout.push(clt[value]); // write char directly instead of converting later - byteout.push(value); - } - - // @ts-ignore - function writeWord(value) { - writeByte((value >> 8) & 0xFF); - writeByte((value) & 0xFF); - } - - // DCT & quantization core - // @ts-ignore - function fDCTQuant(data, fdtbl) { - let d0, d1, d2, d3, d4, d5, d6, d7; - /* Pass 1: process rows. */ - let dataOff = 0; - let i; - const I8 = 8; - const I64 = 64; - for (i = 0; i < I8; ++i) { - d0 = data[dataOff]; - d1 = data[dataOff + 1]; - d2 = data[dataOff + 2]; - d3 = data[dataOff + 3]; - d4 = data[dataOff + 4]; - d5 = data[dataOff + 5]; - d6 = data[dataOff + 6]; - d7 = data[dataOff + 7]; - - const tmp0 = d0 + d7; - const tmp7 = d0 - d7; - const tmp1 = d1 + d6; - const tmp6 = d1 - d6; - const tmp2 = d2 + d5; - const tmp5 = d2 - d5; - const tmp3 = d3 + d4; - const tmp4 = d3 - d4; - - /* Even part */ - let tmp10 = tmp0 + tmp3; /* phase 2 */ - const tmp13 = tmp0 - tmp3; - let tmp11 = tmp1 + tmp2; - let tmp12 = tmp1 - tmp2; - - data[dataOff] = tmp10 + tmp11; /* phase 3 */ - data[dataOff + 4] = tmp10 - tmp11; - - const z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */ - data[dataOff + 2] = tmp13 + z1; /* phase 5 */ - data[dataOff + 6] = tmp13 - z1; - - /* Odd part */ - tmp10 = tmp4 + tmp5; /* phase 2 */ - tmp11 = tmp5 + tmp6; - tmp12 = tmp6 + tmp7; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - const z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */ - const z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */ - const z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */ - const z3 = tmp11 * 0.707106781; /* c4 */ - - const z11 = tmp7 + z3; /* phase 5 */ - const z13 = tmp7 - z3; - - data[dataOff + 5] = z13 + z2; /* phase 6 */ - data[dataOff + 3] = z13 - z2; - data[dataOff + 1] = z11 + z4; - data[dataOff + 7] = z11 - z4; - - dataOff += 8; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - dataOff = 0; - for (i = 0; i < I8; ++i) { - d0 = data[dataOff]; - d1 = data[dataOff + 8]; - d2 = data[dataOff + 16]; - d3 = data[dataOff + 24]; - d4 = data[dataOff + 32]; - d5 = data[dataOff + 40]; - d6 = data[dataOff + 48]; - d7 = data[dataOff + 56]; - - const tmp0p2 = d0 + d7; - const tmp7p2 = d0 - d7; - const tmp1p2 = d1 + d6; - const tmp6p2 = d1 - d6; - const tmp2p2 = d2 + d5; - const tmp5p2 = d2 - d5; - const tmp3p2 = d3 + d4; - const tmp4p2 = d3 - d4; - - /* Even part */ - let tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */ - const tmp13p2 = tmp0p2 - tmp3p2; - let tmp11p2 = tmp1p2 + tmp2p2; - let tmp12p2 = tmp1p2 - tmp2p2; - - data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */ - data[dataOff + 32] = tmp10p2 - tmp11p2; - - const z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */ - data[dataOff + 16] = tmp13p2 + z1p2; /* phase 5 */ - data[dataOff + 48] = tmp13p2 - z1p2; - - /* Odd part */ - tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */ - tmp11p2 = tmp5p2 + tmp6p2; - tmp12p2 = tmp6p2 + tmp7p2; - - /* The rotator is modified from fig 4-8 to avoid extra negations. */ - const z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */ - const z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */ - const z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */ - const z3p2 = tmp11p2 * 0.707106781; /* c4 */ - - const z11p2 = tmp7p2 + z3p2; /* phase 5 */ - const z13p2 = tmp7p2 - z3p2; - - data[dataOff + 40] = z13p2 + z2p2; /* phase 6 */ - data[dataOff + 24] = z13p2 - z2p2; - data[dataOff + 8] = z11p2 + z4p2; - data[dataOff + 56] = z11p2 - z4p2; - - dataOff++; /* advance pointer to next column */ - } - - // Quantize/descale the coefficients - let fDCTQuant1; - for (i = 0; i < I64; ++i) { - // Apply the quantization and scaling factor & Round to nearest integer - fDCTQuant1 = data[i] * fdtbl[i]; - outputfDCTQuant[i] = (fDCTQuant1 > 0.0) - ? ((fDCTQuant1 + 0.5) | 0) - : ((fDCTQuant1 - 0.5) | 0); - } - return outputfDCTQuant; - } - - function writeAPP0() { - writeWord(0xFFE0); // marker - writeWord(16); // length - writeByte(0x4A); // J - writeByte(0x46); // F - writeByte(0x49); // I - writeByte(0x46); // F - writeByte(0); // = "JFIF",'\0' - writeByte(1); // versionhi - writeByte(1); // versionlo - writeByte(0); // xyunits - writeWord(1); // xdensity - writeWord(1); // ydensity - writeByte(0); // thumbnwidth - writeByte(0); // thumbnheight - } - - // @ts-ignore - function writeSOF0(width, height) { - writeWord(0xFFC0); // marker - writeWord(17); // length, truecolor YUV JPG - writeByte(8); // precision - writeWord(height); - writeWord(width); - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0x11); // HVY - writeByte(0); // QTY - writeByte(2); // IdU - writeByte(0x11); // HVU - writeByte(1); // QTU - writeByte(3); // IdV - writeByte(0x11); // HVV - writeByte(1); // QTV - } - - function writeDQT() { - writeWord(0xFFDB); // marker - writeWord(132); // length - writeByte(0); - for (let i = 0; i < 64; i++) { - writeByte(YTable[i]); - } - writeByte(1); - for (let j = 0; j < 64; j++) { - writeByte(UVTable[j]); - } - } - - function writeDHT() { - writeWord(0xFFC4); // marker - writeWord(0x01A2); // length - - writeByte(0); // HTYDCinfo - for (let i = 0; i < 16; i++) { - writeByte(std_dc_luminance_nrcodes[i + 1]); - } - for (let j = 0; j <= 11; j++) { - writeByte(std_dc_luminance_values[j]); - } - - writeByte(0x10); // HTYACinfo - for (let k = 0; k < 16; k++) { - writeByte(std_ac_luminance_nrcodes[k + 1]); - } - for (let l = 0; l <= 161; l++) { - writeByte(std_ac_luminance_values[l]); - } - - writeByte(1); // HTUDCinfo - for (let m = 0; m < 16; m++) { - writeByte(std_dc_chrominance_nrcodes[m + 1]); - } - for (let n = 0; n <= 11; n++) { - writeByte(std_dc_chrominance_values[n]); - } - - writeByte(0x11); // HTUACinfo - for (let o = 0; o < 16; o++) { - writeByte(std_ac_chrominance_nrcodes[o + 1]); - } - for (let p = 0; p <= 161; p++) { - writeByte(std_ac_chrominance_values[p]); - } - } - - function writeSOS() { - writeWord(0xFFDA); // marker - writeWord(12); // length - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0); // HTY - writeByte(2); // IdU - writeByte(0x11); // HTU - writeByte(3); // IdV - writeByte(0x11); // HTV - writeByte(0); // Ss - writeByte(0x3f); // Se - writeByte(0); // Bf - } - - // @ts-ignore - function processDU(CDU, fdtbl, DC, HTDC, HTAC) { - const EOB = HTAC[0x00]; - const M16zeroes = HTAC[0xF0]; - let pos; - const I16 = 16; - const I63 = 63; - const I64 = 64; - const DU_DCT = fDCTQuant(CDU, fdtbl); - // ZigZag reorder - for (let j = 0; j < I64; ++j) { - DU[ZigZag[j]] = DU_DCT[j]; - } - const Diff = DU[0] - DC; - DC = DU[0]; - // Encode DC - if (Diff === 0) { - writeBits(HTDC[0]); // Diff might be 0 - } else { - pos = 32767 + Diff; - writeBits(HTDC[category[pos]]); - writeBits(bitcode[pos]); - } - // Encode ACs - let end0pos = 63; // was const... which is crazy - for (; (end0pos > 0) && (DU[end0pos] === 0); end0pos--) {} - // end0pos = first element in reverse order !=0 - if (end0pos === 0) { - writeBits(EOB); - return DC; - } - let i = 1; - let lng; - while (i <= end0pos) { - const startpos = i; - for (; (DU[i] === 0) && (i <= end0pos); ++i) {} - let nrzeroes = i - startpos; - if (nrzeroes >= I16) { - lng = nrzeroes >> 4; - for (let nrmarker = 1; nrmarker <= lng; ++nrmarker) { - writeBits(M16zeroes); - } - nrzeroes = nrzeroes & 0xF; - } - pos = 32767 + DU[i]; - writeBits(HTAC[(nrzeroes << 4) + category[pos]]); - writeBits(bitcode[pos]); - i++; - } - if (end0pos !== I63) { - writeBits(EOB); - } - return DC; - } - - function initCharLookupTable() { - const sfcc = String.fromCharCode; - for (let i = 0; i < 256; i++) { ///// ACHTUNG // 255 - clt[i] = sfcc(i); - } - } - // @ts-ignore - this.encode = function (image, q) { - if (q) { setQuality(q); } - - // Initialize bit writer - byteout = new Array(); - bytenew = 0; - bytepos = 7; - - // Add JPEG headers - writeWord(0xFFD8); // SOI - writeAPP0(); - writeDQT(); - writeSOF0(image.width, image.height); - writeDHT(); - writeSOS(); - - // Encode 8x8 macroblocks - let DCY = 0; - let DCU = 0; - let DCV = 0; - - bytenew = 0; - bytepos = 7; - - this.encode.displayName = "_encode_"; - - const imageData = image.data; - const width = image.width; - const height = image.height; - - const quadWidth = width * 4; - - let x, y = 0; - let r, g, b; - let start, p, col, row, pos; - while (y < height) { - x = 0; - while (x < quadWidth) { - start = quadWidth * y + x; - - for (pos = 0; pos < 64; pos++) { - row = pos >> 3; // /8 - col = (pos & 7) * 4; // %8 - p = start + (row * quadWidth) + col; - - if (y + row >= height) { // padding bottom - p -= (quadWidth * (y + 1 + row - height)); - } - - if (x + col >= quadWidth) { // padding right - p -= ((x + col) - quadWidth + 4); - } - - r = imageData[p++]; - g = imageData[p++]; - b = imageData[p]; - - /* // calculate YUV values dynamically - YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 - UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); - VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); - */ - - // use lookup table (slightly faster) - YDU[pos] = - ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256) >> 0] + - RGB_YUV_TABLE[(b + 512) >> 0]) >> 16) - 128; - UDU[pos] = - ((RGB_YUV_TABLE[(r + 768) >> 0] + RGB_YUV_TABLE[(g + 1024) >> 0] + - RGB_YUV_TABLE[(b + 1280) >> 0]) >> 16) - 128; - VDU[pos] = - ((RGB_YUV_TABLE[(r + 1280) >> 0] + RGB_YUV_TABLE[(g + 1536) >> 0] + - RGB_YUV_TABLE[(b + 1792) >> 0]) >> 16) - 128; - } - - // @ts-ignore - DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); - // @ts-ignore - DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); - // @ts-ignore - DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); - x += 32; - } - y += 8; - } - - //////////////////////////////////////////////////////////////// - - // Do the bit alignment of the EOI marker - if (bytepos >= 0) { - const fillbits = []; - fillbits[1] = bytepos + 1; - fillbits[0] = (1 << (bytepos + 1)) - 1; - writeBits(fillbits); - } - - writeWord(0xFFD9); // EOI - - return new Uint8Array(byteout); - }; - - // @ts-ignore - function setQuality(q) { - if (q <= 0) { - q = 1; - } - if (q > 100) { - q = 100; - } - - // @ts-ignore - if (currentQuality === q) { return; } // don't recalc if unchanged - - let sf = 0; - if (q < 50) { - sf = Math.floor(5000 / q); - } else { - sf = Math.floor(200 - q * 2); - } - - initQuantTables(sf); - currentQuality = q; - } - - function init() { - if (!quality) { quality = 50; } - // Create tables - initCharLookupTable(); - initHuffmanTbl(); - initCategoryNumber(); - initRGBYUVTable(); - - setQuality(quality); - } - - init(); -} - -export const encode = function (imgData: Image, qu: number = 50): Image { - // @ts-ignore - const encoder = new JPEGEncoder(qu); - const data = encoder.encode(imgData, qu); - const result = new Image(); - result.data = data; - result.width = imgData.width; - result.height = imgData.height; - - return result; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/14d686bf665411aa7e9a837a8ac56363826d259c.ts b/crates/swc_bundler/tests/.cache/deno/14d686bf665411aa7e9a837a8ac56363826d259c.ts deleted file mode 100644 index c91c76f47c10..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/14d686bf665411aa7e9a837a8ac56363826d259c.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isFullWidth.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -export const fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; - -export const isFullWidth = (str: string) => { - assertString(str); - return fullWidth.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/14db2faaba580d87d8e87a2f10bf8c7883f41f34.ts b/crates/swc_bundler/tests/.cache/deno/14db2faaba580d87d8e87a2f10bf8c7883f41f34.ts deleted file mode 100644 index e9b8257afdae..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/14db2faaba580d87d8e87a2f10bf8c7883f41f34.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/binary.js - - -import _curry1 from './internal/_curry1.js'; -import nAry from './nAry.js'; - - -/** - * Wraps a function of any arity (including nullary) in a function that accepts - * exactly 2 parameters. Any extraneous parameters will not be passed to the - * supplied function. - * - * @func - * @memberOf R - * @since v0.2.0 - * @category Function - * @sig (a -> b -> c -> ... -> z) -> ((a, b) -> z) - * @param {Function} fn The function to wrap. - * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of - * arity 2. - * @see R.nAry, R.unary - * @example - * - * const takesThreeArgs = function(a, b, c) { - * return [a, b, c]; - * }; - * takesThreeArgs.length; //=> 3 - * takesThreeArgs(1, 2, 3); //=> [1, 2, 3] - * - * const takesTwoArgs = R.binary(takesThreeArgs); - * takesTwoArgs.length; //=> 2 - * // Only 2 arguments are passed to the wrapped function - * takesTwoArgs(1, 2, 3); //=> [1, 2, undefined] - * @symb R.binary(f)(a, b, c) = f(a, b) - */ -var binary = _curry1(function binary(fn) { - return nAry(2, fn); -}); -export default binary; diff --git a/crates/swc_bundler/tests/.cache/deno/150dc30d8448198cdeb4cd6e4fafd6396dbf71b7.ts b/crates/swc_bundler/tests/.cache/deno/150dc30d8448198cdeb4cd6e4fafd6396dbf71b7.ts deleted file mode 100644 index c1bc49a657c2..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/150dc30d8448198cdeb4cd6e4fafd6396dbf71b7.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/channels/overwrite_types.ts - - -export enum DiscordOverwriteTypes { - Role, - Member, -} - -export type OverwriteTypes = DiscordOverwriteTypes; -export const OverwriteTypes = DiscordOverwriteTypes; diff --git a/crates/swc_bundler/tests/.cache/deno/152184d716a78f2c569a56e8c0b5ae833890ec78.ts b/crates/swc_bundler/tests/.cache/deno/152184d716a78f2c569a56e8c0b5ae833890ec78.ts deleted file mode 100644 index c371a2909033..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/152184d716a78f2c569a56e8c0b5ae833890ec78.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/table/lib/border.ts - - -export interface IBorder { - top: string; - topMid: string; - topLeft: string; - topRight: string; - bottom: string; - bottomMid: string; - bottomLeft: string; - bottomRight: string; - left: string; - leftMid: string; - mid: string; - midMid: string; - right: string; - rightMid: string; - middle: string; -} - -export const border: IBorder = { - top: '─', - topMid: '┬', - topLeft: '┌', - topRight: '┐', - bottom: '─', - bottomMid: '┴', - bottomLeft: '└', - bottomRight: '┘', - left: '│', - leftMid: '├', - mid: '─', - midMid: '┼', - right: '│', - rightMid: '┤', - middle: '│' -}; diff --git a/crates/swc_bundler/tests/.cache/deno/15222a4c9ba619badd5892d3021ea3dde77fe193.ts b/crates/swc_bundler/tests/.cache/deno/15222a4c9ba619badd5892d3021ea3dde77fe193.ts deleted file mode 100644 index c388a03811ae..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15222a4c9ba619badd5892d3021ea3dde77fe193.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/misc/edit_bot_profile.ts - - -import { rest } from "../../rest/rest.ts"; -import { Errors } from "../../types/discordeno/errors.ts"; -import type { User } from "../../types/users/user.ts"; -import { endpoints } from "../../util/constants.ts"; -import { urlToBase64 } from "../../util/utils.ts"; - -/** Modifies the bot's username or avatar. - * NOTE: username: if changed may cause the bot's discriminator to be randomized. - */ -export async function editBotProfile(username?: string, botAvatarURL?: string) { - // Nothing was edited - if (!username && !botAvatarURL) return; - // Check username requirements if username was provided - if (username) { - if (username.length > 32) { - throw new Error(Errors.USERNAME_MAX_LENGTH); - } - if (username.length < 2) { - throw new Error(Errors.USERNAME_MIN_LENGTH); - } - if (["@", "#", ":", "```"].some((char) => username.includes(char))) { - throw new Error(Errors.USERNAME_INVALID_CHARACTER); - } - if (["discordtag", "everyone", "here"].includes(username)) { - throw new Error(Errors.USERNAME_INVALID_USERNAME); - } - } - - const avatar = botAvatarURL ? await urlToBase64(botAvatarURL) : undefined; - - return await rest.runMethod("patch", endpoints.USER_BOT, { - username: username?.trim(), - avatar, - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/152dd06bac5c9b723829b7b0b10283ae111a0f34.ts b/crates/swc_bundler/tests/.cache/deno/152dd06bac5c9b723829b7b0b10283ae111a0f34.ts deleted file mode 100644 index 2bad31637c95..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/152dd06bac5c9b723829b7b0b10283ae111a0f34.ts +++ /dev/null @@ -1,387 +0,0 @@ -// Loaded from https://deno.land/std@0.101.0/http/_io.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { BufReader, BufWriter } from "../io/bufio.ts"; -import { TextProtoReader } from "../textproto/mod.ts"; -import { assert } from "../_util/assert.ts"; -import { Response, ServerRequest } from "./server.ts"; -import { STATUS_TEXT } from "./http_status.ts"; -import { copy, iter } from "../io/util.ts"; - -const encoder = new TextEncoder(); - -export function emptyReader(): Deno.Reader { - return { - read(_: Uint8Array): Promise { - return Promise.resolve(null); - }, - }; -} - -export function bodyReader(contentLength: number, r: BufReader): Deno.Reader { - let totalRead = 0; - let finished = false; - async function read(buf: Uint8Array): Promise { - if (finished) return null; - let result: number | null; - const remaining = contentLength - totalRead; - if (remaining >= buf.byteLength) { - result = await r.read(buf); - } else { - const readBuf = buf.subarray(0, remaining); - result = await r.read(readBuf); - } - if (result !== null) { - totalRead += result; - } - finished = totalRead === contentLength; - return result; - } - return { read }; -} - -export function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader { - // Based on https://tools.ietf.org/html/rfc2616#section-19.4.6 - const tp = new TextProtoReader(r); - let finished = false; - const chunks: Array<{ - offset: number; - data: Uint8Array; - }> = []; - async function read(buf: Uint8Array): Promise { - if (finished) return null; - const [chunk] = chunks; - if (chunk) { - const chunkRemaining = chunk.data.byteLength - chunk.offset; - const readLength = Math.min(chunkRemaining, buf.byteLength); - for (let i = 0; i < readLength; i++) { - buf[i] = chunk.data[chunk.offset + i]; - } - chunk.offset += readLength; - if (chunk.offset === chunk.data.byteLength) { - chunks.shift(); - // Consume \r\n; - if ((await tp.readLine()) === null) { - throw new Deno.errors.UnexpectedEof(); - } - } - return readLength; - } - const line = await tp.readLine(); - if (line === null) throw new Deno.errors.UnexpectedEof(); - // TODO(bartlomieju): handle chunk extension - const [chunkSizeString] = line.split(";"); - const chunkSize = parseInt(chunkSizeString, 16); - if (Number.isNaN(chunkSize) || chunkSize < 0) { - throw new Deno.errors.InvalidData("Invalid chunk size"); - } - if (chunkSize > 0) { - if (chunkSize > buf.byteLength) { - let eof = await r.readFull(buf); - if (eof === null) { - throw new Deno.errors.UnexpectedEof(); - } - const restChunk = new Uint8Array(chunkSize - buf.byteLength); - eof = await r.readFull(restChunk); - if (eof === null) { - throw new Deno.errors.UnexpectedEof(); - } else { - chunks.push({ - offset: 0, - data: restChunk, - }); - } - return buf.byteLength; - } else { - const bufToFill = buf.subarray(0, chunkSize); - const eof = await r.readFull(bufToFill); - if (eof === null) { - throw new Deno.errors.UnexpectedEof(); - } - // Consume \r\n - if ((await tp.readLine()) === null) { - throw new Deno.errors.UnexpectedEof(); - } - return chunkSize; - } - } else { - assert(chunkSize === 0); - // Consume \r\n - if ((await r.readLine()) === null) { - throw new Deno.errors.UnexpectedEof(); - } - await readTrailers(h, r); - finished = true; - return null; - } - } - return { read }; -} - -function isProhibidedForTrailer(key: string): boolean { - const s = new Set(["transfer-encoding", "content-length", "trailer"]); - return s.has(key.toLowerCase()); -} - -/** Read trailer headers from reader and append values to headers. "trailer" - * field will be deleted. */ -export async function readTrailers( - headers: Headers, - r: BufReader, -) { - const trailers = parseTrailer(headers.get("trailer")); - if (trailers == null) return; - const trailerNames = [...trailers.keys()]; - const tp = new TextProtoReader(r); - const result = await tp.readMIMEHeader(); - if (result == null) { - throw new Deno.errors.InvalidData("Missing trailer header."); - } - const undeclared = [...result.keys()].filter( - (k) => !trailerNames.includes(k), - ); - if (undeclared.length > 0) { - throw new Deno.errors.InvalidData( - `Undeclared trailers: ${Deno.inspect(undeclared)}.`, - ); - } - for (const [k, v] of result) { - headers.append(k, v); - } - const missingTrailers = trailerNames.filter((k) => !result.has(k)); - if (missingTrailers.length > 0) { - throw new Deno.errors.InvalidData( - `Missing trailers: ${Deno.inspect(missingTrailers)}.`, - ); - } - headers.delete("trailer"); -} - -function parseTrailer(field: string | null): Headers | undefined { - if (field == null) { - return undefined; - } - const trailerNames = field.split(",").map((v) => v.trim().toLowerCase()); - if (trailerNames.length === 0) { - throw new Deno.errors.InvalidData("Empty trailer header."); - } - const prohibited = trailerNames.filter((k) => isProhibidedForTrailer(k)); - if (prohibited.length > 0) { - throw new Deno.errors.InvalidData( - `Prohibited trailer names: ${Deno.inspect(prohibited)}.`, - ); - } - return new Headers(trailerNames.map((key) => [key, ""])); -} - -export async function writeChunkedBody( - w: BufWriter, - r: Deno.Reader, -) { - for await (const chunk of iter(r)) { - if (chunk.byteLength <= 0) continue; - const start = encoder.encode(`${chunk.byteLength.toString(16)}\r\n`); - const end = encoder.encode("\r\n"); - await w.write(start); - await w.write(chunk); - await w.write(end); - await w.flush(); - } - - const endChunk = encoder.encode("0\r\n\r\n"); - await w.write(endChunk); -} - -/** Write trailer headers to writer. It should mostly should be called after - * `writeResponse()`. */ -export async function writeTrailers( - w: Deno.Writer, - headers: Headers, - trailers: Headers, -) { - const trailer = headers.get("trailer"); - if (trailer === null) { - throw new TypeError("Missing trailer header."); - } - const transferEncoding = headers.get("transfer-encoding"); - if (transferEncoding === null || !transferEncoding.match(/^chunked/)) { - throw new TypeError( - `Trailers are only allowed for "transfer-encoding: chunked", got "transfer-encoding: ${transferEncoding}".`, - ); - } - const writer = BufWriter.create(w); - const trailerNames = trailer.split(",").map((s) => s.trim().toLowerCase()); - const prohibitedTrailers = trailerNames.filter((k) => - isProhibidedForTrailer(k) - ); - if (prohibitedTrailers.length > 0) { - throw new TypeError( - `Prohibited trailer names: ${Deno.inspect(prohibitedTrailers)}.`, - ); - } - const undeclared = [...trailers.keys()].filter( - (k) => !trailerNames.includes(k), - ); - if (undeclared.length > 0) { - throw new TypeError(`Undeclared trailers: ${Deno.inspect(undeclared)}.`); - } - for (const [key, value] of trailers) { - await writer.write(encoder.encode(`${key}: ${value}\r\n`)); - } - await writer.write(encoder.encode("\r\n")); - await writer.flush(); -} - -export async function writeResponse( - w: Deno.Writer, - r: Response, -) { - const protoMajor = 1; - const protoMinor = 1; - const statusCode = r.status || 200; - const statusText = r.statusText ?? STATUS_TEXT.get(statusCode) ?? null; - const writer = BufWriter.create(w); - if (statusText === null) { - throw new Deno.errors.InvalidData( - "Empty statusText (explicitely pass an empty string if this was intentional)", - ); - } - if (!r.body) { - r.body = new Uint8Array(); - } - if (typeof r.body === "string") { - r.body = encoder.encode(r.body); - } - - let out = `HTTP/${protoMajor}.${protoMinor} ${statusCode} ${statusText}\r\n`; - - const headers = r.headers ?? new Headers(); - - if (r.body && !headers.get("content-length")) { - if (r.body instanceof Uint8Array) { - out += `content-length: ${r.body.byteLength}\r\n`; - } else if (!headers.get("transfer-encoding")) { - out += "transfer-encoding: chunked\r\n"; - } - } - - for (const [key, value] of headers) { - out += `${key}: ${value}\r\n`; - } - - out += `\r\n`; - - const header = encoder.encode(out); - const n = await writer.write(header); - assert(n === header.byteLength); - - if (r.body instanceof Uint8Array) { - const n = await writer.write(r.body); - assert(n === r.body.byteLength); - } else if (headers.has("content-length")) { - const contentLength = headers.get("content-length"); - assert(contentLength != null); - const bodyLength = parseInt(contentLength); - const n = await copy(r.body, writer); - assert(n === bodyLength); - } else { - await writeChunkedBody(writer, r.body); - } - if (r.trailers) { - const t = await r.trailers(); - await writeTrailers(writer, headers, t); - } - await writer.flush(); -} - -/** - * ParseHTTPVersion parses a HTTP version string. - * "HTTP/1.0" returns (1, 0). - * Ported from https://github.com/golang/go/blob/f5c43b9/src/net/http/request.go#L766-L792 - */ -export function parseHTTPVersion(vers: string): [number, number] { - switch (vers) { - case "HTTP/1.1": - return [1, 1]; - - case "HTTP/1.0": - return [1, 0]; - - default: { - const Big = 1000000; // arbitrary upper bound - - if (!vers.startsWith("HTTP/")) { - break; - } - - const dot = vers.indexOf("."); - if (dot < 0) { - break; - } - - const majorStr = vers.substring(vers.indexOf("/") + 1, dot); - const major = Number(majorStr); - if (!Number.isInteger(major) || major < 0 || major > Big) { - break; - } - - const minorStr = vers.substring(dot + 1); - const minor = Number(minorStr); - if (!Number.isInteger(minor) || minor < 0 || minor > Big) { - break; - } - - return [major, minor]; - } - } - - throw new Error(`malformed HTTP version ${vers}`); -} - -export async function readRequest( - conn: Deno.Conn, - bufr: BufReader, -): Promise { - const tp = new TextProtoReader(bufr); - const firstLine = await tp.readLine(); // e.g. GET /index.html HTTP/1.0 - if (firstLine === null) return null; - const headers = await tp.readMIMEHeader(); - if (headers === null) throw new Deno.errors.UnexpectedEof(); - - const req = new ServerRequest(); - req.conn = conn; - req.r = bufr; - [req.method, req.url, req.proto] = firstLine.split(" ", 3); - [req.protoMajor, req.protoMinor] = parseHTTPVersion(req.proto); - req.headers = headers; - fixLength(req); - return req; -} - -function fixLength(req: ServerRequest): void { - const contentLength = req.headers.get("Content-Length"); - if (contentLength) { - const arrClen = contentLength.split(","); - if (arrClen.length > 1) { - const distinct = [...new Set(arrClen.map((e): string => e.trim()))]; - if (distinct.length > 1) { - throw Error("cannot contain multiple Content-Length headers"); - } else { - req.headers.set("Content-Length", distinct[0]); - } - } - const c = req.headers.get("Content-Length"); - if (req.method === "HEAD" && c && c !== "0") { - throw Error("http: method cannot contain a Content-Length"); - } - if (c && req.headers.has("transfer-encoding")) { - // A sender MUST NOT send a Content-Length header field in any message - // that contains a Transfer-Encoding header field. - // rfc: https://tools.ietf.org/html/rfc7230#section-3.3.2 - throw new Error( - "http: Transfer-Encoding and Content-Length cannot be send together", - ); - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1542c900f31b210398965de49f3748a3062fc398.ts b/crates/swc_bundler/tests/.cache/deno/1542c900f31b210398965de49f3748a3062fc398.ts deleted file mode 100644 index 403bc0aa6310..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1542c900f31b210398965de49f3748a3062fc398.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/pair.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`. - * - * @func - * @memberOf R - * @since v0.18.0 - * @category List - * @sig a -> b -> (a,b) - * @param {*} fst - * @param {*} snd - * @return {Array} - * @see R.objOf, R.of - * @example - * - * R.pair('foo', 'bar'); //=> ['foo', 'bar'] - */ -var pair = _curry2(function pair(fst, snd) { return [fst, snd]; }); -export default pair; diff --git a/crates/swc_bundler/tests/.cache/deno/154c6073e975b13f958f5ec193d87807d5ce9747.ts b/crates/swc_bundler/tests/.cache/deno/154c6073e975b13f958f5ec193d87807d5ce9747.ts deleted file mode 100644 index 0210c7d1c3bb..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/154c6073e975b13f958f5ec193d87807d5ce9747.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isLocale.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * @ignore - */ -const localeReg = /^[A-z]{2,4}([_-]([A-z]{4}|[\d]{3}))?([_-]([A-z]{2}|[\d]{3}))?$/; - -export const isLocale = (str: string) => { - assertString(str); - - if (str === 'en_US_POSIX' || str === 'ca_ES_VALENCIA') { - return true; - } - - return localeReg.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/154d820a8da80c6e9c87225b072cf5973db6c1fd.ts b/crates/swc_bundler/tests/.cache/deno/154d820a8da80c6e9c87225b072cf5973db6c1fd.ts deleted file mode 100644 index d55adef560f9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/154d820a8da80c6e9c87225b072cf5973db6c1fd.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/begin_guild_prune.ts - - -/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */ -export interface BeginGuildPrune { - /** Number of days to prune (1 or more), default: 7 */ - days?: number; - /** Whether 'pruned' is returned, discouraged for large guilds, default: true */ - computePruneCount?: boolean; - /** Role(s) ro include, default: none */ - includeRoles?: string[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/15650a0a33ba60fb495e9b783eff58745b9513b1.ts b/crates/swc_bundler/tests/.cache/deno/15650a0a33ba60fb495e9b783eff58745b9513b1.ts deleted file mode 100644 index e21b889303c8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15650a0a33ba60fb495e9b783eff58745b9513b1.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Loaded from https://deno.land/x/bytes_formater@v1.4.0/mod.ts - - -export { format } from "./format.ts"; -export { setColorEnabled } from "./deps.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/156daf9b6ee0b185df5de38f122c6b66bc3e68f9.ts b/crates/swc_bundler/tests/.cache/deno/156daf9b6ee0b185df5de38f122c6b66bc3e68f9.ts deleted file mode 100644 index f978cb853b09..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/156daf9b6ee0b185df5de38f122c6b66bc3e68f9.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/members/edit_bot_nickname.ts - - -import { rest } from "../../rest/rest.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** Edit the nickname of the bot in this guild */ -export async function editBotNickname(guildId: bigint, nickname: string | null) { - await requireBotGuildPermissions(guildId, ["CHANGE_NICKNAME"]); - - const response = await rest.runMethod<{ nick: string }>("patch", endpoints.USER_NICK(guildId), { - nick: nickname, - }); - - return response.nick; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1571bd7549e130f1ab5fee0be392f5d4f3b89169.ts b/crates/swc_bundler/tests/.cache/deno/1571bd7549e130f1ab5fee0be392f5d4f3b89169.ts deleted file mode 100644 index 04fe8ff5ebec..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1571bd7549e130f1ab5fee0be392f5d4f3b89169.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/integrations/integration_application.ts - - -import { User } from "../users/user.ts"; - -/** https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure */ -export interface IntegrationApplication { - /** The id of the app */ - id: string; - /** The name of the app */ - name: string; - /** the icon hash of the app */ - icon: string | null; - /** The description of the app */ - description: string; - /** The summary of the app */ - summary: string; - /** The bot associated with this application */ - bot?: User; -} diff --git a/crates/swc_bundler/tests/.cache/deno/15a347bb7fca9af0a4718d7d35cabc074cf8e7ae.ts b/crates/swc_bundler/tests/.cache/deno/15a347bb7fca9af0a4718d7d35cabc074cf8e7ae.ts deleted file mode 100644 index bb250ca110ae..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15a347bb7fca9af0a4718d7d35cabc074cf8e7ae.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Loaded from https://deno.land/x/accepts@2.1.0/deps.ts - - -import Negotiator from "https://deno.land/x/negotiator@1.0.1/mod.ts"; -export { - Negotiator, -}; - -export { lookup } from "https://deno.land/x/media_types@v2.4.7/mod.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/15ae507ca642346a832c9e45152f145273a69bd9.ts b/crates/swc_bundler/tests/.cache/deno/15ae507ca642346a832c9e45152f145273a69bd9.ts deleted file mode 100644 index 48069bb6d781..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15ae507ca642346a832c9e45152f145273a69bd9.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/commands/application_command_callback_data.ts - - -import { Embed } from "../../embeds/embed.ts"; -import { AllowedMentions } from "../../messages/allowed_mentions.ts"; -import { MessageComponents } from "../../messages/components/message_components.ts"; - -/** https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata */ -export interface InteractionApplicationCommandCallbackData { - /** Is the response TTS */ - tts?: boolean; - /** Message content */ - content?: string; - /** Supports up to 10 embeds */ - embeds?: Embed[]; - /** Allowed Mentions object */ - allowedMentions?: AllowedMentions; - /** Set to `64` to make your response ephemeral */ - flags?: number; - /** The components you would like to have sent in this message */ - components?: MessageComponents; -} diff --git a/crates/swc_bundler/tests/.cache/deno/15ca3aadb89225d3e76fe28fdf4ca49c4f83e4f7.ts b/crates/swc_bundler/tests/.cache/deno/15ca3aadb89225d3e76fe28fdf4ca49c4f83e4f7.ts deleted file mode 100644 index 8e113fac7746..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15ca3aadb89225d3e76fe28fdf4ca49c4f83e4f7.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/findDeprecatedUsages.js - - -import { GraphQLError } from '../error/GraphQLError.js'; -import { visit } from '../language/visitor.js'; -import { getNamedType } from '../type/definition.js'; -import { TypeInfo, visitWithTypeInfo } from './TypeInfo.js'; -/** - * A validation rule which reports deprecated usages. - * - * Returns a list of GraphQLError instances describing each deprecated use. - */ - -export function findDeprecatedUsages(schema, ast) { - const errors = []; - const typeInfo = new TypeInfo(schema); - visit(ast, visitWithTypeInfo(typeInfo, { - Field(node) { - const parentType = typeInfo.getParentType(); - const fieldDef = typeInfo.getFieldDef(); - - if (parentType && fieldDef?.deprecationReason != null) { - errors.push(new GraphQLError(`The field "${parentType.name}.${fieldDef.name}" is deprecated. ` + fieldDef.deprecationReason, node)); - } - }, - - EnumValue(node) { - const type = getNamedType(typeInfo.getInputType()); - const enumVal = typeInfo.getEnumValue(); - - if (type && enumVal?.deprecationReason != null) { - errors.push(new GraphQLError(`The enum value "${type.name}.${enumVal.name}" is deprecated. ` + enumVal.deprecationReason, node)); - } - } - - })); - return errors; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/15cac5f1f1891cdfa29e2c62647fad5a090482c5.ts b/crates/swc_bundler/tests/.cache/deno/15cac5f1f1891cdfa29e2c62647fad5a090482c5.ts deleted file mode 100644 index 6646ff6d66d5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15cac5f1f1891cdfa29e2c62647fad5a090482c5.ts +++ /dev/null @@ -1,187 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/pako/lib/utils/strings.js - - -// String encode/decode helpers -import * as utils from "./common.js"; - - -// Quick check if we can use fast array to bin string conversion -// -// - apply(Array) can fail on Android 2.2 -// - apply(Uint8Array) can fail on iOS 5.1 Safari -// -var STR_APPLY_OK = true; -var STR_APPLY_UIA_OK = true; - -try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } -try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } - - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new utils.Buf8(256); -for (var q = 0; q < 256; q++) { - _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); -} -_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start - - -// convert string to array (typed, when possible) -export function string2buf (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - buf = new utils.Buf8(buf_len); - - // convert - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Helper (used in 2 places) -function _buf2binstring(buf, len) { - // On Chrome, the arguments in a function call that are allowed is `65534`. - // If the length of the buffer is smaller than that, we can use this optimization, - // otherwise we will take a slower path. - if (len < 65534) { - if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { - return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); - } - } - - var result = ''; - for (var i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); - } - return result; -} - - -// Convert byte array to binary string -export function buf2binstring (buf) { - return _buf2binstring(buf, buf.length); -}; - - -// Convert binary string (typed, when possible) -export function binstring2buf (str) { - var buf = new utils.Buf8(str.length); - for (var i = 0, len = buf.length; i < len; i++) { - buf[i] = str.charCodeAt(i); - } - return buf; -}; - - -// convert array to string -export function buf2string (buf, max) { - var i, out, c, c_len; - var len = max || buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len * 2); - - for (out = 0, i = 0; i < len;) { - c = buf[i++]; - // quick process ascii - if (c < 0x80) { utf16buf[out++] = c; continue; } - - c_len = _utf8len[c]; - // skip 5 & 6 byte codes - if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - return _buf2binstring(utf16buf, out); -}; - - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -export function utf8border (buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max - 1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means buffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/15d082aae40f214deb470bba67860d5cf32c96e8.ts b/crates/swc_bundler/tests/.cache/deno/15d082aae40f214deb470bba67860d5cf32c96e8.ts deleted file mode 100644 index 88ac31996d84..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15d082aae40f214deb470bba67860d5cf32c96e8.ts +++ /dev/null @@ -1,131 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/ansi/chain.ts - - -/** Chainable ansi escape sequence's. */ -import type { ImageOptions } from "./ansi_escapes.ts"; - -/** Chainable ansi escape method declarations. */ -export interface Chain> { - /** Add text. */ - text: (text: string) => T; - /** Ring audio bell: `\u0007` */ - bel: T; - /** Get cursor position. */ - cursorPosition: T; - /** - * Move cursor to x, y, counting from the top left corner. - * @param x Position left. - * @param y Position top. - */ - cursorTo: (x: number, y?: number) => T; - /** - * Move cursor by offset. - * @param x Offset left. - * @param y Offset top. - */ - cursorMove: (x: number, y: number) => T; - /** - * Move cursor up by n lines. - * @param count Number of lines. - */ - cursorUp: T & ((count: number) => T); - /** - * Move cursor down by n lines. - * @param count Number of lines. - */ - cursorDown: T & ((count: number) => T); - /** - * Move cursor forward by n lines. - * @param count Number of lines. - */ - cursorForward: T & ((count: number) => T); - /** - * Move cursor backward by n lines. - * @param count Number of lines. - */ - cursorBackward: T & ((count: number) => T); - /** - * Move cursor to the beginning of the line n lines down. - * @param count Number of lines. - */ - cursorNextLine: T & ((count: number) => T); - /** - * Move cursor to the beginning of the line n lines up. - * @param count Number of lines. - */ - cursorPrevLine: T & ((count: number) => T); - /** Move cursor to first column of current row. */ - cursorLeft: T; - /** Hide cursor. */ - cursorHide: T; - /** Show cursor. */ - cursorShow: T; - /** Save cursor. */ - cursorSave: T; - /** Restore cursor. */ - cursorRestore: T; - /** - * Scroll window up by n lines. - * @param count Number of lines. - */ - scrollUp: T & ((count: number) => T); - /** - * Scroll window down by n lines. - * @param count Number of lines. - */ - scrollDown: T & ((count: number) => T); - /** Clear screen. */ - eraseScreen: T; - /** - * Clear screen up by n lines. - * @param count Number of lines. - */ - eraseUp: T & ((count: number) => T); - /** - * Clear screen down by n lines. - * @param count Number of lines. - */ - eraseDown: T & ((count: number) => T); - /** Clear current line. */ - eraseLine: T; - /** Clear to line end. */ - eraseLineEnd: T; - /** Clear to line start. */ - eraseLineStart: T; - /** - * Clear screen and move cursor by n lines up and move cursor to first column. - * @param count Number of lines. - */ - eraseLines: (count: number) => T; - /** Clear the terminal screen. (Viewport) */ - clearScreen: T; - /** - * Clear the whole terminal, including scrollback buffer. - * (Not just the visible part of it). - */ - clearTerminal: T; - /** - * Create link. - * @param text Link text. - * @param url Link url. - * ``` - * console.log( - * ansi.link("Click me.", "https://deno.land"), - * ); - * ``` - */ - link: (text: string, url: string) => T; - /** - * Create image. - * @param buffer Image buffer. - * @param options Image options. - * ``` - * const response = await fetch("https://deno.land/images/hashrock_simple.png"); - * const imageBuffer: ArrayBuffer = await response.arrayBuffer(); - * console.log( - * ansi.image(imageBuffer), - * ); - * ``` - */ - image: (buffer: string | ArrayBuffer, options?: ImageOptions) => T; -} diff --git a/crates/swc_bundler/tests/.cache/deno/15e012f58ce28a8f6da346ff8bfcd6e41d822f0e.ts b/crates/swc_bundler/tests/.cache/deno/15e012f58ce28a8f6da346ff8bfcd6e41d822f0e.ts deleted file mode 100644 index 23c01b09f00c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15e012f58ce28a8f6da346ff8bfcd6e41d822f0e.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/dropRepeatsWith.js - - -import _curry2 from './internal/_curry2.js'; -import _dispatchable from './internal/_dispatchable.js'; -import _xdropRepeatsWith from './internal/_xdropRepeatsWith.js'; -import last from './last.js'; - - -/** - * Returns a new list without any consecutively repeating elements. Equality is - * determined by applying the supplied predicate to each pair of consecutive elements. The - * first element in a series of equal elements will be preserved. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category List - * @sig ((a, a) -> Boolean) -> [a] -> [a] - * @param {Function} pred A predicate used to test whether two items are equal. - * @param {Array} list The array to consider. - * @return {Array} `list` without repeating elements. - * @see R.transduce - * @example - * - * const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; - * R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] - */ -var dropRepeatsWith = _curry2(_dispatchable([], _xdropRepeatsWith, function dropRepeatsWith(pred, list) { - var result = []; - var idx = 1; - var len = list.length; - if (len !== 0) { - result[0] = list[0]; - while (idx < len) { - if (!pred(last(result), list[idx])) { - result[result.length] = list[idx]; - } - idx += 1; - } - } - return result; -})); -export default dropRepeatsWith; diff --git a/crates/swc_bundler/tests/.cache/deno/15fe53182b4738291c2403d64a24e4e2dbb9f0f1.ts b/crates/swc_bundler/tests/.cache/deno/15fe53182b4738291c2403d64a24e4e2dbb9f0f1.ts deleted file mode 100644 index bb682efee794..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15fe53182b4738291c2403d64a24e4e2dbb9f0f1.ts +++ /dev/null @@ -1,211 +0,0 @@ -// Loaded from https://deno.land/x/type_is@1.0.1/mod.ts - - -/*! - * Based on https://github.com/jshttp/type-is/blob/master/index.js - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * Copyright(c) 2020 Henry Zhuang - * MIT Licensed - */ - -import { lookup, parse, test } from "./deps.ts"; - -/** - * Compare a `value` content-type with `types`. - * Each `type` can be an extension like `html`, - * a special shortcut like `multipart` or `urlencoded`, - * or a mime type. - * - * If no types match, `false` is returned. - * Otherwise, the first `type` that matches is returned. - * - * @param {String} mediaType - * @param {Array} types - */ -export function is(mediaType: string, types?: string[]): boolean | string { - let i; - // remove parameters and normalize - const val = tryNormalizeType(mediaType); - - // no type or invalid - if (!val) { - return false; - } - - // no types, return the content type - if (!types || !types.length) { - return val; - } - - let type; - for (i = 0; i < types.length; i++) { - const normalized = normalize(type = types[i]); - if (normalized && mimeMatch(normalized, val)) { - return type[0] === "+" || type.indexOf("*") !== -1 ? val : type; - } - } - - // no matches - return false; -} - -/** - * Check if a request's header has a request body. - * A request with a body __must__ either have `transfer-encoding` - * or `content-length` headers set. - * http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3 - * - * @param {Object} request - * @return {Boolean} - */ -export function hasBody(header: Headers): boolean { - return header.get("transfer-encoding") !== null || - !isNaN(parseInt(header.get("content-length") || "", 10)); -} - -/** - * Check if the incoming request's header contains the "Content-Type" - * header field, and it contains any of the give mime `type`s. - * If there is no request body, `null` is returned. - * If there is no content type, `false` is returned. - * Otherwise, it returns the first `type` that matches. - * - * Examples: - * - * // With Content-Type: text/html; charset=utf-8 - * typeofrequest(header, [ 'html' ]); // => 'html' - * typeofrequest(header, ['text/html' ]); // => 'text/html' - * typeofrequest(header, ['text/*', 'application/json' ]); // => 'text/html' - * - * // When Content-Type is application/json - * typeofrequest(header, [ 'json', 'urlencoded' ]); // => 'json' - * typeofrequest(header, [ 'application/json' ]); // => 'application/json' - * typeofrequest(header, [ 'html', 'application/*' ]); // => 'application/json' - * - * typeofrequest(header, [ 'html' ]); // => false - * - * @param {String|Array} types... - * @return {String|false|null} - */ - -export function typeofrequest( - header: Headers, - types_?: string[], -): null | boolean | string { - const types = types_; - - // no body - if (!hasBody(header)) { - return null; - } - - // request content type - const value = header.get("content-type"); - - if (!value) { - return false; - } - - return is(value, types); -} - -/** - * Normalize a mime type. - * If it's a shorthand, expand it to a valid mime type. - * - * In general, you probably want: - * - * const type = is(req, ['urlencoded', 'json', 'multipart']); - * - * Then use the appropriate body parsers. - * These three are the most common request body types - * and are thus ensured to work. - * - * @param {String} type - */ -export const normalize = function normalize(type: string): string | undefined { - switch (type) { - case "urlencoded": - return "application/x-www-form-urlencoded"; - case "multipart": - return "multipart/*"; - } - - if (type[0] === "+") { - // "+json" -> "*/*+json" expando - return "*/*" + type; - } - - return type.indexOf("/") === -1 ? lookup(type) : type; -}; - -/** - * Check if `expected` mime type - * matches `actual` mime type with - * wildcard and +suffix support. - * - * @param {String} expected - * @param {String} actual - * @return {Boolean} - */ -function mimeMatch(expected: string, actual: string): boolean { - // split types - const actualParts = actual.split("/"); - const expectedParts = expected.split("/"); - - // invalid format - if (actualParts.length !== 2 || expectedParts.length !== 2) { - return false; - } - - // validate type - if (expectedParts[0] !== "*" && expectedParts[0] !== actualParts[0]) { - return false; - } - - // validate suffix wildcard - if (expectedParts[1].substr(0, 2) === "*+") { - return expectedParts[1].length <= actualParts[1].length + 1 && - expectedParts[1].substr(1) === - actualParts[1].substr(1 - expectedParts[1].length); - } - - // validate subtype - if (expectedParts[1] !== "*" && expectedParts[1] !== actualParts[1]) { - return false; - } - - return true; -} - -/** - * Normalize a type - * - * @param {string} value - * @return {string} - */ -function normalizeType(value: string): string | null { - // parse the type - const type = parse(value).type; - - if (!test(type)) { - return null; - } - - return type; -} - -/** - * Try to normalize a type - * - * @param {string} value - * @return {string} - */ -function tryNormalizeType(value: string): string | null { - try { - return normalizeType(value); - } catch (err) { - return null; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/15ff69e5ba79d52cb453376285fe4fd42ba6f193.ts b/crates/swc_bundler/tests/.cache/deno/15ff69e5ba79d52cb453376285fe4fd42ba6f193.ts deleted file mode 100644 index 76ce145fa0db..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/15ff69e5ba79d52cb453376285fe4fd42ba6f193.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/SingleFieldSubscriptionsRule.js - - -import { GraphQLError } from '../../error/GraphQLError.js'; - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -export function SingleFieldSubscriptionsRule(context) { - return { - OperationDefinition(node) { - if (node.operation === 'subscription') { - if (node.selectionSet.selections.length !== 1) { - context.reportError(new GraphQLError(node.name ? `Subscription "${node.name.value}" must select only one top level field.` : 'Anonymous Subscription must select only one top level field.', node.selectionSet.selections.slice(1))); - } - } - } - - }; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/16032fe56976e6f893a2b58aaf95200db3334291.ts b/crates/swc_bundler/tests/.cache/deno/16032fe56976e6f893a2b58aaf95200db3334291.ts deleted file mode 100644 index 2a1d8986afa8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16032fe56976e6f893a2b58aaf95200db3334291.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/emojis/create_emoji.ts - - -import { rest } from "../../rest/rest.ts"; -import { CreateGuildEmoji } from "../../types/emojis/create_guild_emoji.ts"; -import type { Emoji } from "../../types/emojis/emoji.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; -import { urlToBase64 } from "../../util/utils.ts"; - -/** Create an emoji in the server. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */ -export async function createEmoji(guildId: bigint, name: string, image: string, options: CreateGuildEmoji) { - await requireBotGuildPermissions(guildId, ["MANAGE_EMOJIS"]); - - if (image && !image.startsWith("data:image/")) { - image = await urlToBase64(image); - } - - const emoji = await rest.runMethod("post", endpoints.GUILD_EMOJIS(guildId), { - ...options, - name, - image, - }); - - return { - ...emoji, - id: snowflakeToBigint(emoji.id!), - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/161cdbb1659c8dc2529af32f1c9b9343ad2917a6.ts b/crates/swc_bundler/tests/.cache/deno/161cdbb1659c8dc2529af32f1c9b9343ad2917a6.ts deleted file mode 100644 index 49c98881149f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/161cdbb1659c8dc2529af32f1c9b9343ad2917a6.ts +++ /dev/null @@ -1,136 +0,0 @@ -// Loaded from https://deno.land/x/god_crypto@v1.4.3/src/rsa/basic_encoding_rule.ts - - -interface BasicEncodingRule { - type: number; - length: number; - totalLength: number; - value: BasicEncodingRuleValue; -} - -type BasicEncodingRuleValue = - | Uint8Array - | string - | number - | BasicEncodingRule[] - | null - | bigint; -type BasicEncodingSimpleValue = - | Uint8Array - | string - | number - | null - | bigint - | BasicEncodingSimpleValue[]; - -export function ber_decode( - bytes: Uint8Array, - from?: number, - to?: number, -): BasicEncodingRule { - return ber_next(bytes); -} - -function ber_sequence( - bytes: Uint8Array, - from: number, - length: number, -): BasicEncodingRule[] { - const end = from + length; - let res: BasicEncodingRule[] = []; - let ptr = from; - - while (ptr < end) { - const next = ber_next(bytes, ptr); - res.push(next); - ptr += next.totalLength; - } - - return res; -} - -function ber_integer(bytes: Uint8Array, from: number, length: number): bigint { - let n = 0n; - for (const b of bytes.slice(from, from + length)) { - n = (n << 8n) + BigInt(b); - } - return n; -} - -function ber_oid(bytes: Uint8Array, from: number, length: number): string { - const id = [ - (bytes[from] / 40) | 0, - (bytes[from] % 40), - ]; - let value = 0; - - for (const b of bytes.slice(from + 1, from + length)) { - if (b > 128) value += value * 127 + (b - 128); - else { - value = value * 128 + b; - id.push(value); - value = 0; - } - } - - return id.join("."); -} - -function ber_unknown( - bytes: Uint8Array, - from: number, - length: number, -): Uint8Array { - return bytes.slice(from, from + length); -} - -export function ber_simple(n: BasicEncodingRule): BasicEncodingSimpleValue { - if (Array.isArray(n.value)) return n.value.map((x) => ber_simple(x)); - return n.value as BasicEncodingSimpleValue; -} - -function ber_next( - bytes: Uint8Array, - from?: number, - to?: number, -): BasicEncodingRule { - if (!from) from = 0; - if (!to) to = bytes.length; - - let ptr = from; - - const type = bytes[ptr++]; - let size = bytes[ptr++]; - - if ((size & 0x80) > 0) { - let ext = size - 0x80; - size = 0; - - while (--ext >= 0) { - size = (size << 8) + bytes[ptr++]; - } - } - - // Sequence - let value = null; - if (type === 0x30) { - value = ber_sequence(bytes, ptr, size); - } else if (type === 0x2) { - value = ber_integer(bytes, ptr, size); - } else if (type === 0x3) { - value = ber_sequence(bytes, ptr + 1, size - 1); - } else if (type === 0x5) { - value = null; - } else if (type === 0x6) { - value = ber_oid(bytes, ptr, size); - } else { - value = ber_unknown(bytes, ptr, size); - } - - return { - totalLength: (ptr - from) + size, - type, - length: size, - value, - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/16325f6ee1005a7f0be993fca5ba52d8c384c07a.ts b/crates/swc_bundler/tests/.cache/deno/16325f6ee1005a7f0be993fca5ba52d8c384c07a.ts deleted file mode 100644 index cb3815acf7c4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16325f6ee1005a7f0be993fca5ba52d8c384c07a.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/roles/delete_role.ts - - -import { rest } from "../../rest/rest.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** Delete a guild role. Requires the MANAGE_ROLES permission. */ -export async function deleteRole(guildId: bigint, id: bigint) { - await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]); - - return await rest.runMethod("delete", endpoints.GUILD_ROLE(guildId, id)); -} diff --git a/crates/swc_bundler/tests/.cache/deno/164b33e52b6c7ad35bd1f384d1a3ef8d13ff20d2.ts b/crates/swc_bundler/tests/.cache/deno/164b33e52b6c7ad35bd1f384d1a3ef8d13ff20d2.ts deleted file mode 100644 index 190f556f2c63..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/164b33e52b6c7ad35bd1f384d1a3ef8d13ff20d2.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/dnit@dnit-v1.11.0/adl-gen/resolver.ts - - -/* @generated from adl */ -import { declResolver, ScopedDecl } from "./runtime/adl.ts"; -import { _AST_MAP as dnit_manifest } from "./dnit/manifest.ts"; -import { _AST_MAP as sys_types } from "./sys/types.ts"; - -export const ADL: { [key: string]: ScopedDecl } = { - ...dnit_manifest, - ...sys_types, -}; - -export const RESOLVER = declResolver(ADL); diff --git a/crates/swc_bundler/tests/.cache/deno/165c97bcca11ffb39b2a4cb938e798e6f6d4b03a.ts b/crates/swc_bundler/tests/.cache/deno/165c97bcca11ffb39b2a4cb938e798e6f6d4b03a.ts deleted file mode 100644 index 23aa01b6d65d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/165c97bcca11ffb39b2a4cb938e798e6f6d4b03a.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/liftN.js - - -import _curry2 from './internal/_curry2.js'; -import _reduce from './internal/_reduce.js'; -import ap from './ap.js'; -import curryN from './curryN.js'; -import map from './map.js'; - - -/** - * "lifts" a function to be the specified arity, so that it may "map over" that - * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). - * - * @func - * @memberOf R - * @since v0.7.0 - * @category Function - * @sig Number -> (*... -> *) -> ([*]... -> [*]) - * @param {Function} fn The function to lift into higher context - * @return {Function} The lifted function. - * @see R.lift, R.ap - * @example - * - * const madd3 = R.liftN(3, (...args) => R.sum(args)); - * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] - */ -var liftN = _curry2(function liftN(arity, fn) { - var lifted = curryN(arity, fn); - return curryN(arity, function() { - return _reduce(ap, map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1)); - }); -}); -export default liftN; diff --git a/crates/swc_bundler/tests/.cache/deno/16636f1df996bc362111d560f402836346a3aff6.ts b/crates/swc_bundler/tests/.cache/deno/16636f1df996bc362111d560f402836346a3aff6.ts deleted file mode 100644 index 6204ff6dfe1d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16636f1df996bc362111d560f402836346a3aff6.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Loaded from https://deno.land/std@0.78.0/encoding/_yaml/schema/core.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { Schema } from "../schema.ts"; -import { json } from "./json.ts"; - -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -export const core = new Schema({ - include: [json], -}); diff --git a/crates/swc_bundler/tests/.cache/deno/16692c00956cd61edcfd64f0f19f50243e789615.ts b/crates/swc_bundler/tests/.cache/deno/16692c00956cd61edcfd64f0f19f50243e789615.ts deleted file mode 100644 index 607ad4fb45d5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16692c00956cd61edcfd64f0f19f50243e789615.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/oauth2/scopes.ts - - -/** https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes */ -export type DiscordOAuth2Scopes = - | "bot" - | "connections" - | "email" - | "identify" - | "guilds" - | "guilds.join" - | "gdm.join" - | "messages.read" - | "rpc" - | "rpc.api" - | "rpc.activities.write" - | "rpc.notifications.read" - | "rpc.voice.read" - | "rpc.voice.write" - | "webhook.incomming" - | "applications.builds.upload" - | "applications.builds.read" - | "applications.store.update" - | "applications.entitlements" - | "relationships.read" - | "activities.read" - | "activities.write" - | "applications.commands" - | "applications.commands.update"; diff --git a/crates/swc_bundler/tests/.cache/deno/1672b7e2822cbaf4f5934b9c66f2047d44700339.ts b/crates/swc_bundler/tests/.cache/deno/1672b7e2822cbaf4f5934b9c66f2047d44700339.ts deleted file mode 100644 index 3a25d9a2b696..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1672b7e2822cbaf4f5934b9c66f2047d44700339.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/nthArg.js - - -import _curry1 from './internal/_curry1.js'; -import curryN from './curryN.js'; -import nth from './nth.js'; - - -/** - * Returns a function which returns its nth argument. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Function - * @sig Number -> *... -> * - * @param {Number} n - * @return {Function} - * @example - * - * R.nthArg(1)('a', 'b', 'c'); //=> 'b' - * R.nthArg(-1)('a', 'b', 'c'); //=> 'c' - * @symb R.nthArg(-1)(a, b, c) = c - * @symb R.nthArg(0)(a, b, c) = a - * @symb R.nthArg(1)(a, b, c) = b - */ -var nthArg = _curry1(function nthArg(n) { - var arity = n < 0 ? 1 : n + 1; - return curryN(arity, function() { - return nth(n, arguments); - }); -}); -export default nthArg; diff --git a/crates/swc_bundler/tests/.cache/deno/16827ea9b7688ebfbfa4c0d8f05e9c5f4e1b1837.ts b/crates/swc_bundler/tests/.cache/deno/16827ea9b7688ebfbfa4c0d8f05e9c5f4e1b1837.ts deleted file mode 100644 index f4a72a8cc24d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16827ea9b7688ebfbfa4c0d8f05e9c5f4e1b1837.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/create_guild.ts - - -import { Channel } from "../channels/channel.ts"; -import { Role } from "../permissions/role.ts"; -import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts"; -import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts"; -import { DiscordSystemChannelFlags } from "./system_channel_flags.ts"; -import { DiscordVerificationLevels } from "./verification_levels.ts"; - -/** https://discord.com/developers/docs/resources/guild#create-guild */ -export interface CreateGuild { - /** Name of the guild (2-100 characters) */ - name: string; - /** Voice region id */ - region?: string; - /** Base64 128x128 image for the guild icon */ - icon?: string; - /** Verification level */ - verificationLevel?: DiscordVerificationLevels; - /** Default message notification level */ - defaultMessageNotifications?: DiscordDefaultMessageNotificationLevels; - /** Explicit content filter level */ - explicitContentFilter?: DiscordExplicitContentFilterLevels; - /** New guild roles (first role is the everyone role) */ - roles?: Role[]; - /** New guild's channels */ - channels?: Partial[]; - /** Id for afk channel */ - afkChannelId?: string; - /** Afk timeout in seconds */ - afkTimeout?: number; - /** The id of the channel where guild notices such as welcome messages and boost events are posted */ - systemChannelId?: string; - /** System channel flags */ - systemChannelFlags?: DiscordSystemChannelFlags; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1683707d65cfb35904495c1562b51e40c61b97c6.ts b/crates/swc_bundler/tests/.cache/deno/1683707d65cfb35904495c1562b51e40c61b97c6.ts deleted file mode 100644 index 6894a20c36e5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1683707d65cfb35904495c1562b51e40c61b97c6.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/create_guild_role.ts - - -import { PermissionStrings } from "../permissions/permission_strings.ts"; - -export interface CreateGuildRole { - /** Name of the role, default: "new role" */ - name?: string; - /** Bitwise value of the enabled/disabled permissions, default: everyone permissions in guild */ - permissions?: PermissionStrings[]; - /** RGB color value, default: 0 */ - color?: number; - /** Whether the role should be displayed separately in the sidebar, default: false */ - hoist?: boolean; - /** Whether the role should be mentionable, default: false */ - mentionable?: boolean; -} - -/** https://discord.com/developers/docs/resources/guild#create-guild-role */ -export interface DiscordCreateGuildRole extends Omit { - permissions?: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/16848ee55e1ad68eda05bb0a5cef4162d282b1d1.ts b/crates/swc_bundler/tests/.cache/deno/16848ee55e1ad68eda05bb0a5cef4162d282b1d1.ts deleted file mode 100644 index 7560a23d344c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16848ee55e1ad68eda05bb0a5cef4162d282b1d1.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/guilds/guild_banner_url.ts - - -import type { DiscordImageFormat } from "../../types/misc/image_format.ts"; -import type { DiscordImageSize } from "../../types/misc/image_size.ts"; -import { endpoints } from "../../util/constants.ts"; -import { iconBigintToHash } from "../../util/hash.ts"; -import { formatImageURL } from "../../util/utils.ts"; - -/** The full URL of the banner from Discords CDN. Undefined if no banner is set. */ -export function guildBannerURL( - id: bigint, - options: { - banner?: string | bigint; - size?: DiscordImageSize; - format?: DiscordImageFormat; - animated?: boolean; - } -) { - return options.banner - ? formatImageURL( - endpoints.GUILD_BANNER( - id, - typeof options.banner === "string" - ? options.banner - : iconBigintToHash(options.banner, options.animated ?? true) - ), - options.size || 128, - options.format - ) - : undefined; -} diff --git a/crates/swc_bundler/tests/.cache/deno/169622807df1c3fbe893bb2c0dae763724774a86.ts b/crates/swc_bundler/tests/.cache/deno/169622807df1c3fbe893bb2c0dae763724774a86.ts deleted file mode 100644 index c22b66654826..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/169622807df1c3fbe893bb2c0dae763724774a86.ts +++ /dev/null @@ -1,180 +0,0 @@ -// Loaded from https://deno.land/x/negotiator@1.0.1/src/language.ts - - -/** - * Based on https://github.com/jshttp/negotiator/blob/master/lib/language.js - * Copyright(c) 2012 Isaac Z. Schlueter - * Copyright(c) 2014 Federico Romero - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * Copyright(c) 2020 Henry Zhuang - * MIT Licensed - */ - -import type { Priority } from "./types.ts"; - -export { preferredLanguages }; - -const simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/; - -interface Language { - prefix: string; - suffix: string; - full: string; - q: number; - i?: number; -} - -/** - * Parse the Accept-Language header. - */ -function parseAcceptLanguage(accept: string): Language[] { - const accepts = accept.split(","); - const parsedEncodings: Language[] = []; - - for (let i = 0; i < accepts.length; i++) { - const language = parseLanguage(accepts[i].trim(), i); - - if (language) { - parsedEncodings.push(language); - } - } - - return parsedEncodings; -} - -/** - * Parse a language from the Accept-Language header. - */ -function parseLanguage(str: string, i?: number): Language | null { - const match = simpleLanguageRegExp.exec(str); - if (!match) return null; - - const prefix = match[1]; - const suffix = match[2]; - let full = prefix; - - if (suffix) full += "-" + suffix; - - let q = 1; - if (match[3]) { - const params = match[3].split(";"); - for (let j = 0; j < params.length; j++) { - const p = params[j].split("="); - if (p[0] === "q") q = parseFloat(p[1]); - } - } - - return { - prefix, - suffix, - q, - i, - full, - }; -} - -/** - * Get the priority of a language. - */ -function getLanguagePriority( - language: string, - accepted: Language[], - index: number, -): Priority { - let priority = { o: -1, q: 0, s: 0 }; - - for (let i = 0; i < accepted.length; i++) { - const spec = specify(language, accepted[i], index); - - if ( - spec && - (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0 - ) { - priority = spec; - } - } - - return priority; -} - -/** - * Get the specificity of the language. - */ -function specify( - language: string, - spec: Language, - index: number, -): Priority | null { - const p = parseLanguage(language); - if (!p) return null; - let s = 0; - if (spec.full.toLowerCase() === p.full.toLowerCase()) { - s |= 4; - } else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) { - s |= 2; - } else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) { - s |= 1; - } else if (spec.full !== "*") { - return null; - } - - return { - i: index, - o: spec.i!, - q: spec.q, - s, - }; -} - -/** - * Get the preferred languages from an Accept-Language header. - */ -function preferredLanguages( - accept: string | null, - provided?: string[], -): string[] { - // RFC 2616 sec 14.4: no header = * - const accepts = parseAcceptLanguage( - accept === null ? "*" : accept || "", - ); - - if (!provided) { - // sorted list of all languages - return accepts - .filter(isQuality) - .sort(compareSpecs) - .map(getFullLanguage); - } - - const priorities = provided.map(function getPriority(type, index) { - return getLanguagePriority(type, accepts, index); - }); - - // sorted list of accepted languages - return priorities.filter(isQuality).sort(compareSpecs).map( - function getLanguage(priority) { - return provided[priorities.indexOf(priority)]; - }, - ); -} - -/** - * Compare two specs. - */ -function compareSpecs(a: any, b: any): number { - return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; -} - -/** - * Get full language string. - */ -function getFullLanguage(spec: Language): string { - return spec.full; -} - -/** - * Check if a spec has any quality. - */ -function isQuality(spec: Language | Priority): boolean { - return spec.q > 0; -} diff --git a/crates/swc_bundler/tests/.cache/deno/169d6b00fa8f1ea1f037c70677c6fdd83c6e191d.ts b/crates/swc_bundler/tests/.cache/deno/169d6b00fa8f1ea1f037c70677c6fdd83c6e191d.ts deleted file mode 100644 index 3ced23097f92..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/169d6b00fa8f1ea1f037c70677c6fdd83c6e191d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/voice/update_voice_state.ts - - -/** https://discord.com/developers/docs/topics/gateway#update-voice-state */ -export interface UpdateVoiceState { - /** id of the guild */ - guildId: string; - /** id of the voice channel client wants to join (null if disconnecting) */ - channelId: string | null; - /** Is the client muted */ - selfMute: boolean; - /** Is the client deafened */ - selfDeaf: boolean; -} diff --git a/crates/swc_bundler/tests/.cache/deno/16a2d93ba3edc2ac5b527b1b9aa251a8e831becd.ts b/crates/swc_bundler/tests/.cache/deno/16a2d93ba3edc2ac5b527b1b9aa251a8e831becd.ts deleted file mode 100644 index fe6940c8352d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16a2d93ba3edc2ac5b527b1b9aa251a8e831becd.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/misc/READY.ts - - -import { eventHandlers, setApplicationId, setBotId } from "../../bot.ts"; -import { cache } from "../../cache.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { Ready } from "../../types/gateway/ready.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; -import { DiscordenoShard, ws } from "../../ws/ws.ts"; - -export function handleReady(data: DiscordGatewayPayload, shardId: number) { - // Triggered on each shard - eventHandlers.shardReady?.(shardId); - - // The bot has already started, the last shard is resumed, however. - if (cache.isReady) return; - - const shard = ws.shards.get(shardId); - if (!shard) return; - - const payload = data.d as Ready; - setBotId(payload.user.id); - setApplicationId(payload.application.id); - - // Set ready to false just to go sure - shard.ready = false; - // All guilds are unavailable at first - shard.unavailableGuildIds = new Set(payload.guilds.map((g) => snowflakeToBigint(g.id))); - // Set the last available to now - shard.lastAvailable = Date.now(); - - // Start ready check in 2 seconds - setTimeout(() => { - eventHandlers.debug?.("loop", `1. Running setTimeout in READY file.`); - checkReady(payload, shard); - }, 2000); -} - -/** This function checks if the shard is fully loaded */ -function checkReady(payload: Ready, shard: DiscordenoShard) { - // Check if all guilds were loaded - if (!shard.unavailableGuildIds.size) return loaded(shard); - - // If the last GUILD_CREATE has been received before 5 seconds if so most likely the remaining guilds are unavailable - if (shard.lastAvailable + 5000 < Date.now()) { - eventHandlers.shardFailedToLoad?.(shard.id, shard.unavailableGuildIds); - // Force execute the loaded function to prevent infinite loop - return loaded(shard); - } - - // Not all guilds were loaded but 5 seconds haven't passed so check again - setTimeout(() => { - eventHandlers.debug?.("loop", `2. Running setTimeout in READY file.`); - checkReady(payload, shard); - }, 2000); -} - -function loaded(shard: DiscordenoShard) { - shard.ready = true; - - // If it is not the last shard we can't go full ready - if (shard.id !== ws.lastShardId) return; - - // Still some shards are loading so wait another 2 seconds for them - if (ws.shards.some((shard) => !shard.ready)) { - setTimeout(() => { - eventHandlers.debug?.("loop", `3. Running setTimeout in READY file.`); - loaded(shard); - }, 2000); - - return; - } - - cache.isReady = true; - eventHandlers.ready?.(); -} diff --git a/crates/swc_bundler/tests/.cache/deno/16ac259d1b48b671c9d665f2209489e5dce17781.ts b/crates/swc_bundler/tests/.cache/deno/16ac259d1b48b671c9d665f2209489e5dce17781.ts deleted file mode 100644 index 41cae488f8b4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16ac259d1b48b671c9d665f2209489e5dce17781.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/allPass.js - - -import _curry1 from './internal/_curry1.js'; -import curryN from './curryN.js'; -import max from './max.js'; -import pluck from './pluck.js'; -import reduce from './reduce.js'; - - -/** - * Takes a list of predicates and returns a predicate that returns true for a - * given list of arguments if every one of the provided predicates is satisfied - * by those arguments. - * - * The function returned is a curried function whose arity matches that of the - * highest-arity predicate. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Logic - * @sig [(*... -> Boolean)] -> (*... -> Boolean) - * @param {Array} predicates An array of predicates to check - * @return {Function} The combined predicate - * @see R.anyPass - * @example - * - * const isQueen = R.propEq('rank', 'Q'); - * const isSpade = R.propEq('suit', '♠︎'); - * const isQueenOfSpades = R.allPass([isQueen, isSpade]); - * - * isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false - * isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true - */ -var allPass = _curry1(function allPass(preds) { - return curryN(reduce(max, 0, pluck('length', preds)), function() { - var idx = 0; - var len = preds.length; - while (idx < len) { - if (!preds[idx].apply(this, arguments)) { - return false; - } - idx += 1; - } - return true; - }); -}); -export default allPass; diff --git a/crates/swc_bundler/tests/.cache/deno/16c06cb624a7909ac257f16b0bdfc7a564ebe003.ts b/crates/swc_bundler/tests/.cache/deno/16c06cb624a7909ac257f16b0bdfc7a564ebe003.ts deleted file mode 100644 index 123d9b62542e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16c06cb624a7909ac257f16b0bdfc7a564ebe003.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/mod.ts - - -export * from "./commands/application_command_callback_data.ts"; -export * from "./commands/application_command_create_update_delete.ts"; -export * from "./commands/application_command_interaction_data_option.ts"; -export * from "./commands/application_command_interaction_data.ts"; -export * from "./commands/application_command_interaction_data_resolved.ts"; -export * from "./commands/application_command_option_choice.ts"; -export * from "./commands/application_command_option_types.ts"; -export * from "./commands/application_command_option.ts"; -export * from "./commands/application_command_permission_types.ts"; -export * from "./commands/application_command_permissions.ts"; -export * from "./commands/create_global_application_command.ts"; -export * from "./commands/create_guild_application_command.ts"; -export * from "./commands/edit_global_application_command.ts"; -export * from "./commands/edit_guild_application_command.ts"; -export * from "./commands/guild_application_command_permissions.ts"; -export * from "./commands/application_command.ts"; -export * from "./interaction.ts"; -export * from "./interaction_guild_member.ts"; -export * from "./interaction_response.ts"; -export * from "./interaction_response_types.ts"; -export * from "./interaction_types.ts"; -export * from "./message_interaction.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/16c4065cd22a2681274a9b18d81f316f1f7fa9f5.ts b/crates/swc_bundler/tests/.cache/deno/16c4065cd22a2681274a9b18d81f316f1f7fa9f5.ts deleted file mode 100644 index a792ade89b78..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16c4065cd22a2681274a9b18d81f316f1f7fa9f5.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isBase32.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * @ignore - */ -const base32 = /^[A-Z2-7]+=*$/; - -export const isBase32 = (str: string) => { - assertString(str); - - const len = str.length; - if (len > 0 && len % 8 === 0 && base32.test(str)) { - return true; - } - return false; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/16d59db544509c0a9c8afb761eb403181162fa9a.ts b/crates/swc_bundler/tests/.cache/deno/16d59db544509c0a9c8afb761eb403181162fa9a.ts deleted file mode 100644 index c33d9d34db21..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16d59db544509c0a9c8afb761eb403181162fa9a.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/integrations/INTEGRATION_DELETE.ts - - -import { eventHandlers } from "../../bot.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { IntegrationDelete } from "../../types/integrations/integration_delete.ts"; - -export function handleIntegrationDelete(data: DiscordGatewayPayload) { - eventHandlers.integrationDelete?.(data.d as IntegrationDelete); -} diff --git a/crates/swc_bundler/tests/.cache/deno/16dbb5fc0d7ed4138d96e4b4677bd2350f645818.ts b/crates/swc_bundler/tests/.cache/deno/16dbb5fc0d7ed4138d96e4b4677bd2350f645818.ts deleted file mode 100644 index 47b6d77edb46..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16dbb5fc0d7ed4138d96e4b4677bd2350f645818.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/integrations/guild_integrations_update.ts - - -/** https://discord.com/developers/docs/topics/gateway#guild-integrations-update */ -export interface GuildIntegrationsUpdate { - /** id of the guild whose integrations were updated */ - guildId: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/16f800703b66ea01291d3e45b0fd004dd60ed688.ts b/crates/swc_bundler/tests/.cache/deno/16f800703b66ea01291d3e45b0fd004dd60ed688.ts deleted file mode 100644 index 347f26f83e38..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/16f800703b66ea01291d3e45b0fd004dd60ed688.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/commands/APPLICATION_COMMAND_DELETE.ts - - -import { eventHandlers } from "../../bot.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { ApplicationCommandCreateUpdateDelete } from "../../types/interactions/commands/application_command_create_update_delete.ts"; - -export function handleApplicationCommandDelete(data: DiscordGatewayPayload) { - eventHandlers.applicationCommandDelete?.(data.d as ApplicationCommandCreateUpdateDelete); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1702411109bea52e10527b6966cb752526c7d275.ts b/crates/swc_bundler/tests/.cache/deno/1702411109bea52e10527b6966cb752526c7d275.ts deleted file mode 100644 index 2ef1821e425f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1702411109bea52e10527b6966cb752526c7d275.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/dndb@0.2.4/src/methods/mod.js - - -import _find from './find.js'; -import _insert from './insert.js'; -import _findOne from './findOne.js'; -import _update from './update.js'; -import _updateOne from './updateOne.js'; -import _remove from './remove.js'; -import _removeOne from './removeOne.js'; - -export { - _find, - _insert, - _findOne, - _update, - _updateOne, - _remove, - _removeOne -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/171424772f8b3d18b9b5e50b83712d4620f9079e.ts b/crates/swc_bundler/tests/.cache/deno/171424772f8b3d18b9b5e50b83712d4620f9079e.ts deleted file mode 100644 index 27009ba0c84b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/171424772f8b3d18b9b5e50b83712d4620f9079e.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/omit.js - - -import _curry2 from './internal/_curry2.js'; - -/** - * Returns a partial copy of an object omitting the keys specified. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Object - * @sig [String] -> {String: *} -> {String: *} - * @param {Array} names an array of String property names to omit from the new object - * @param {Object} obj The object to copy from - * @return {Object} A new object with properties from `names` not on it. - * @see R.pick - * @example - * - * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3} - */ -var omit = _curry2(function omit(names, obj) { - var result = {}; - var index = {}; - var idx = 0; - var len = names.length; - - while (idx < len) { - index[names[idx]] = 1; - idx += 1; - } - - for (var prop in obj) { - if (!index.hasOwnProperty(prop)) { - result[prop] = obj[prop]; - } - } - return result; -}); -export default omit; diff --git a/crates/swc_bundler/tests/.cache/deno/173dbbf770a1b85799ff97f4ffeed8e29422a496.ts b/crates/swc_bundler/tests/.cache/deno/173dbbf770a1b85799ff97f4ffeed8e29422a496.ts deleted file mode 100644 index ee7946630b88..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/173dbbf770a1b85799ff97f4ffeed8e29422a496.ts +++ /dev/null @@ -1,358 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/flags/mod.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -import { assert } from "../_util/assert.ts"; - -export interface Args { - /** Contains all the arguments that didn't have an option associated with - * them. */ - _: Array; - // deno-lint-ignore no-explicit-any - [key: string]: any; -} - -export interface ArgParsingOptions { - /** When `true`, populate the result `_` with everything before the `--` and - * the result `['--']` with everything after the `--`. Here's an example: - * - * // $ deno run example.ts -- a arg1 - * import { parse } from "https://deno.land/std/flags/mod.ts"; - * console.dir(parse(Deno.args, { "--": false })); - * // output: { _: [ "a", "arg1" ] } - * console.dir(parse(Deno.args, { "--": true })); - * // output: { _: [], --: [ "a", "arg1" ] } - * - * Defaults to `false`. - */ - "--"?: boolean; - - /** An object mapping string names to strings or arrays of string argument - * names to use as aliases */ - alias?: Record; - - /** A boolean, string or array of strings to always treat as booleans. If - * `true` will treat all double hyphenated arguments without equal signs as - * `boolean` (e.g. affects `--foo`, not `-f` or `--foo=bar`) */ - boolean?: boolean | string | string[]; - - /** An object mapping string argument names to default values. */ - default?: Record; - - /** When `true`, populate the result `_` with everything after the first - * non-option. */ - stopEarly?: boolean; - - /** A string or array of strings argument names to always treat as strings. */ - string?: string | string[]; - - /** A function which is invoked with a command line parameter not defined in - * the `options` configuration object. If the function returns `false`, the - * unknown option is not added to `parsedArgs`. */ - unknown?: (arg: string, key?: string, value?: unknown) => unknown; -} - -interface Flags { - bools: Record; - strings: Record; - unknownFn: (arg: string, key?: string, value?: unknown) => unknown; - allBools: boolean; -} - -interface NestedMapping { - [key: string]: NestedMapping | unknown; -} - -function get(obj: Record, key: string): T | undefined { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - return obj[key]; - } -} - -function getForce(obj: Record, key: string): T { - const v = get(obj, key); - assert(v != null); - return v; -} - -function isNumber(x: unknown): boolean { - if (typeof x === "number") return true; - if (/^0x[0-9a-f]+$/i.test(String(x))) return true; - return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(String(x)); -} - -function hasKey(obj: NestedMapping, keys: string[]): boolean { - let o = obj; - keys.slice(0, -1).forEach((key) => { - o = (get(o, key) ?? {}) as NestedMapping; - }); - - const key = keys[keys.length - 1]; - return key in o; -} - -/** Take a set of command line arguments, with an optional set of options, and - * return an object representation of those argument. - * - * const parsedArgs = parse(Deno.args); - */ -export function parse( - args: string[], - { - "--": doubleDash = false, - alias = {}, - boolean = false, - default: defaults = {}, - stopEarly = false, - string = [], - unknown = (i: string): unknown => i, - }: ArgParsingOptions = {}, -): Args { - const flags: Flags = { - bools: {}, - strings: {}, - unknownFn: unknown, - allBools: false, - }; - - if (boolean !== undefined) { - if (typeof boolean === "boolean") { - flags.allBools = !!boolean; - } else { - const booleanArgs = typeof boolean === "string" ? [boolean] : boolean; - - for (const key of booleanArgs.filter(Boolean)) { - flags.bools[key] = true; - } - } - } - - const aliases: Record = {}; - if (alias !== undefined) { - for (const key in alias) { - const val = getForce(alias, key); - if (typeof val === "string") { - aliases[key] = [val]; - } else { - aliases[key] = val; - } - for (const alias of getForce(aliases, key)) { - aliases[alias] = [key].concat(aliases[key].filter((y) => alias !== y)); - } - } - } - - if (string !== undefined) { - const stringArgs = typeof string === "string" ? [string] : string; - - for (const key of stringArgs.filter(Boolean)) { - flags.strings[key] = true; - const alias = get(aliases, key); - if (alias) { - for (const al of alias) { - flags.strings[al] = true; - } - } - } - } - - const argv: Args = { _: [] }; - - function argDefined(key: string, arg: string): boolean { - return ( - (flags.allBools && /^--[^=]+$/.test(arg)) || - get(flags.bools, key) || - !!get(flags.strings, key) || - !!get(aliases, key) - ); - } - - function setKey(obj: NestedMapping, keys: string[], value: unknown): void { - let o = obj; - keys.slice(0, -1).forEach(function (key): void { - if (get(o, key) === undefined) { - o[key] = {}; - } - o = get(o, key) as NestedMapping; - }); - - const key = keys[keys.length - 1]; - if ( - get(o, key) === undefined || - get(flags.bools, key) || - typeof get(o, key) === "boolean" - ) { - o[key] = value; - } else if (Array.isArray(get(o, key))) { - (o[key] as unknown[]).push(value); - } else { - o[key] = [get(o, key), value]; - } - } - - function setArg( - key: string, - val: unknown, - arg: string | undefined = undefined, - ): void { - if (arg && flags.unknownFn && !argDefined(key, arg)) { - if (flags.unknownFn(arg, key, val) === false) return; - } - - const value = !get(flags.strings, key) && isNumber(val) ? Number(val) : val; - setKey(argv, key.split("."), value); - - const alias = get(aliases, key); - if (alias) { - for (const x of alias) { - setKey(argv, x.split("."), value); - } - } - } - - function aliasIsBoolean(key: string): boolean { - return getForce(aliases, key).some( - (x) => typeof get(flags.bools, x) === "boolean", - ); - } - - for (const key of Object.keys(flags.bools)) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - } - - let notFlags: string[] = []; - - // all args after "--" are not parsed - if (args.includes("--")) { - notFlags = args.slice(args.indexOf("--") + 1); - args = args.slice(0, args.indexOf("--")); - } - - for (let i = 0; i < args.length; i++) { - const arg = args[i]; - - if (/^--.+=/.test(arg)) { - const m = arg.match(/^--([^=]+)=(.*)$/s); - assert(m != null); - const [, key, value] = m; - - if (flags.bools[key]) { - const booleanValue = value !== "false"; - setArg(key, booleanValue, arg); - } else { - setArg(key, value, arg); - } - } else if (/^--no-.+/.test(arg)) { - const m = arg.match(/^--no-(.+)/); - assert(m != null); - setArg(m[1], false, arg); - } else if (/^--.+/.test(arg)) { - const m = arg.match(/^--(.+)/); - assert(m != null); - const [, key] = m; - const next = args[i + 1]; - if ( - next !== undefined && - !/^-/.test(next) && - !get(flags.bools, key) && - !flags.allBools && - (get(aliases, key) ? !aliasIsBoolean(key) : true) - ) { - setArg(key, next, arg); - i++; - } else if (/^(true|false)$/.test(next)) { - setArg(key, next === "true", arg); - i++; - } else { - setArg(key, get(flags.strings, key) ? "" : true, arg); - } - } else if (/^-[^-]+/.test(arg)) { - const letters = arg.slice(1, -1).split(""); - - let broken = false; - for (let j = 0; j < letters.length; j++) { - const next = arg.slice(j + 2); - - if (next === "-") { - setArg(letters[j], next, arg); - continue; - } - - if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { - setArg(letters[j], next.split(/=(.+)/)[1], arg); - broken = true; - break; - } - - if ( - /[A-Za-z]/.test(letters[j]) && - /-?\d+(\.\d*)?(e-?\d+)?$/.test(next) - ) { - setArg(letters[j], next, arg); - broken = true; - break; - } - - if (letters[j + 1] && letters[j + 1].match(/\W/)) { - setArg(letters[j], arg.slice(j + 2), arg); - broken = true; - break; - } else { - setArg(letters[j], get(flags.strings, letters[j]) ? "" : true, arg); - } - } - - const [key] = arg.slice(-1); - if (!broken && key !== "-") { - if ( - args[i + 1] && - !/^(-|--)[^-]/.test(args[i + 1]) && - !get(flags.bools, key) && - (get(aliases, key) ? !aliasIsBoolean(key) : true) - ) { - setArg(key, args[i + 1], arg); - i++; - } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) { - setArg(key, args[i + 1] === "true", arg); - i++; - } else { - setArg(key, get(flags.strings, key) ? "" : true, arg); - } - } - } else { - if (!flags.unknownFn || flags.unknownFn(arg) !== false) { - argv._.push(flags.strings["_"] ?? !isNumber(arg) ? arg : Number(arg)); - } - if (stopEarly) { - argv._.push(...args.slice(i + 1)); - break; - } - } - } - - for (const key of Object.keys(defaults)) { - if (!hasKey(argv, key.split("."))) { - setKey(argv, key.split("."), defaults[key]); - - if (aliases[key]) { - for (const x of aliases[key]) { - setKey(argv, x.split("."), defaults[key]); - } - } - } - } - - if (doubleDash) { - argv["--"] = []; - for (const key of notFlags) { - argv["--"].push(key); - } - } else { - for (const key of notFlags) { - argv._.push(key); - } - } - - return argv; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1740f39d7a42300c56c23e098ead3427c76289f5.ts b/crates/swc_bundler/tests/.cache/deno/1740f39d7a42300c56c23e098ead3427c76289f5.ts deleted file mode 100644 index 4ed574d92496..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1740f39d7a42300c56c23e098ead3427c76289f5.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/std@0.84.0/async/delay.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -/* Resolves after the given number of milliseconds. */ -export function delay(ms: number): Promise { - return new Promise((res): number => - setTimeout((): void => { - res(); - }, ms) - ); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1775349c1d11b975768f47e60e70d21aad1b1006.ts b/crates/swc_bundler/tests/.cache/deno/1775349c1d11b975768f47e60e70d21aad1b1006.ts deleted file mode 100644 index 8c4ae7603aa2..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1775349c1d11b975768f47e60e70d21aad1b1006.ts +++ /dev/null @@ -1,120 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/path/_util.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -/** This module is browser compatible. */ - -import type { FormatInputPathObject } from "./_interface.ts"; -import { - CHAR_BACKWARD_SLASH, - CHAR_DOT, - CHAR_FORWARD_SLASH, - CHAR_LOWERCASE_A, - CHAR_LOWERCASE_Z, - CHAR_UPPERCASE_A, - CHAR_UPPERCASE_Z, -} from "./_constants.ts"; - -export function assertPath(path: string): void { - if (typeof path !== "string") { - throw new TypeError( - `Path must be a string. Received ${JSON.stringify(path)}`, - ); - } -} - -export function isPosixPathSeparator(code: number): boolean { - return code === CHAR_FORWARD_SLASH; -} - -export function isPathSeparator(code: number): boolean { - return isPosixPathSeparator(code) || code === CHAR_BACKWARD_SLASH; -} - -export function isWindowsDeviceRoot(code: number): boolean { - return ( - (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z) || - (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) - ); -} - -// Resolves . and .. elements in a path with directory names -export function normalizeString( - path: string, - allowAboveRoot: boolean, - separator: string, - isPathSeparator: (code: number) => boolean, -): string { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let code: number | undefined; - for (let i = 0, len = path.length; i <= len; ++i) { - if (i < len) code = path.charCodeAt(i); - else if (isPathSeparator(code!)) break; - else code = CHAR_FORWARD_SLASH; - - if (isPathSeparator(code!)) { - if (lastSlash === i - 1 || dots === 1) { - // NOOP - } else if (lastSlash !== i - 1 && dots === 2) { - if ( - res.length < 2 || - lastSegmentLength !== 2 || - res.charCodeAt(res.length - 1) !== CHAR_DOT || - res.charCodeAt(res.length - 2) !== CHAR_DOT - ) { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf(separator); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); - } - lastSlash = i; - dots = 0; - continue; - } else if (res.length === 2 || res.length === 1) { - res = ""; - lastSegmentLength = 0; - lastSlash = i; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - if (res.length > 0) res += `${separator}..`; - else res = ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) res += separator + path.slice(lastSlash + 1, i); - else res = path.slice(lastSlash + 1, i); - lastSegmentLength = i - lastSlash - 1; - } - lastSlash = i; - dots = 0; - } else if (code === CHAR_DOT && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} - -export function _format( - sep: string, - pathObject: FormatInputPathObject, -): string { - const dir: string | undefined = pathObject.dir || pathObject.root; - const base: string = pathObject.base || - (pathObject.name || "") + (pathObject.ext || ""); - if (!dir) return base; - if (dir === pathObject.root) return dir + base; - return dir + sep + base; -} diff --git a/crates/swc_bundler/tests/.cache/deno/178b1aa522fff69339fedb6b2e9ec497a42384c3.ts b/crates/swc_bundler/tests/.cache/deno/178b1aa522fff69339fedb6b2e9ec497a42384c3.ts deleted file mode 100644 index 5691b7449b64..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/178b1aa522fff69339fedb6b2e9ec497a42384c3.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/abc@v1.2.4/vendor/https/deno.land/std/fmt/colors.ts - - -export * from "https://deno.land/std@0.81.0/fmt/colors.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/17b7e0e94277d71843128bf99b7f68405b1f5308.ts b/crates/swc_bundler/tests/.cache/deno/17b7e0e94277d71843128bf99b7f68405b1f5308.ts deleted file mode 100644 index 7633d4950678..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/17b7e0e94277d71843128bf99b7f68405b1f5308.ts +++ /dev/null @@ -1,640 +0,0 @@ -// Loaded from https://deno.land/std@0.101.0/node/events.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// Copyright (c) 2019 Denolibs authors. All rights reserved. MIT license. -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -import { assert } from "../_util/assert.ts"; -import { ERR_INVALID_ARG_TYPE, ERR_OUT_OF_RANGE } from "./_errors.ts"; -import { inspect } from "./util.ts"; - -// deno-lint-ignore no-explicit-any -export type GenericFunction = (...args: any[]) => any; - -export interface WrappedFunction extends Function { - listener: GenericFunction; -} - -// deno-lint-ignore no-explicit-any -function createIterResult(value: any, done: boolean): IteratorResult { - return { value, done }; -} - -interface AsyncIterable { - // deno-lint-ignore no-explicit-any - next(): Promise>; - // deno-lint-ignore no-explicit-any - return(): Promise>; - throw(err: Error): void; - // deno-lint-ignore no-explicit-any - [Symbol.asyncIterator](): any; -} - -export let defaultMaxListeners = 10; -function validateMaxListeners(n: number, name: string): void { - if (!Number.isInteger(n) || n < 0) { - throw new ERR_OUT_OF_RANGE(name, "a non-negative number", inspect(n)); - } -} - -/** - * See also https://nodejs.org/api/events.html - */ -export class EventEmitter { - public static captureRejectionSymbol = Symbol.for("nodejs.rejection"); - public static errorMonitor = Symbol("events.errorMonitor"); - public static get defaultMaxListeners() { - return defaultMaxListeners; - } - public static set defaultMaxListeners(value: number) { - validateMaxListeners(value, "defaultMaxListeners"); - defaultMaxListeners = value; - } - - private maxListeners: number | undefined; - private _events: Map< - string | symbol, - Array - >; - - private static _alreadyWarnedEvents?: Set; - - public constructor() { - this._events = new Map(); - } - - private _addListener( - eventName: string | symbol, - listener: GenericFunction | WrappedFunction, - prepend: boolean, - ): this { - this.checkListenerArgument(listener); - this.emit("newListener", eventName, this.unwrapListener(listener)); - if (this._events.has(eventName)) { - const listeners = this._events.get(eventName) as Array< - GenericFunction | WrappedFunction - >; - if (prepend) { - listeners.unshift(listener); - } else { - listeners.push(listener); - } - } else { - this._events.set(eventName, [listener]); - } - const max = this.getMaxListeners(); - if (max > 0 && this.listenerCount(eventName) > max) { - const warning = new MaxListenersExceededWarning(this, eventName); - this.warnIfNeeded(eventName, warning); - } - - return this; - } - - /** Alias for emitter.on(eventName, listener). */ - addListener( - // deno-lint-ignore no-unused-vars - eventName: string | symbol, - // deno-lint-ignore no-unused-vars - listener: GenericFunction | WrappedFunction, - // deno-lint-ignore ban-ts-comment - // @ts-expect-error - ): this { - // The body of this method is empty because it will be overwritten by later code. (`EventEmitter.prototype.addListener = EventEmitter.prototype.on;`) - // The purpose of this dirty hack is to get around the current limitation of TypeScript type checking. - } - - /** - * Synchronously calls each of the listeners registered for the event named - * eventName, in the order they were registered, passing the supplied - * arguments to each. - * @return true if the event had listeners, false otherwise - */ - // deno-lint-ignore no-explicit-any - public emit(eventName: string | symbol, ...args: any[]): boolean { - if (this._events.has(eventName)) { - if ( - eventName === "error" && - this._events.get(EventEmitter.errorMonitor) - ) { - this.emit(EventEmitter.errorMonitor, ...args); - } - const listeners = (this._events.get( - eventName, - ) as GenericFunction[]).slice(); // We copy with slice() so array is not mutated during emit - for (const listener of listeners) { - try { - listener.apply(this, args); - } catch (err) { - this.emit("error", err); - } - } - return true; - } else if (eventName === "error") { - if (this._events.get(EventEmitter.errorMonitor)) { - this.emit(EventEmitter.errorMonitor, ...args); - } - const errMsg = args.length > 0 ? args[0] : Error("Unhandled error."); - throw errMsg; - } - return false; - } - - /** - * Returns an array listing the events for which the emitter has - * registered listeners. - */ - public eventNames(): [string | symbol] { - return Array.from(this._events.keys()) as [string | symbol]; - } - - /** - * Returns the current max listener value for the EventEmitter which is - * either set by emitter.setMaxListeners(n) or defaults to - * EventEmitter.defaultMaxListeners. - */ - public getMaxListeners(): number { - return this.maxListeners == null - ? EventEmitter.defaultMaxListeners - : this.maxListeners; - } - - /** - * Returns the number of listeners listening to the event named - * eventName. - */ - public listenerCount(eventName: string | symbol): number { - if (this._events.has(eventName)) { - return (this._events.get(eventName) as GenericFunction[]).length; - } else { - return 0; - } - } - - static listenerCount( - emitter: EventEmitter, - eventName: string | symbol, - ): number { - return emitter.listenerCount(eventName); - } - - private _listeners( - target: EventEmitter, - eventName: string | symbol, - unwrap: boolean, - ): GenericFunction[] { - if (!target._events?.has(eventName)) { - return []; - } - const eventListeners = target._events.get(eventName) as GenericFunction[]; - - return unwrap - ? this.unwrapListeners(eventListeners) - : eventListeners.slice(0); - } - - private unwrapListeners( - arr: (GenericFunction | WrappedFunction)[], - ): GenericFunction[] { - const unwrappedListeners = new Array(arr.length) as GenericFunction[]; - for (let i = 0; i < arr.length; i++) { - unwrappedListeners[i] = this.unwrapListener(arr[i]); - } - return unwrappedListeners; - } - - private unwrapListener( - listener: GenericFunction | WrappedFunction, - ): GenericFunction { - return (listener as WrappedFunction)["listener"] ?? listener; - } - - /** Returns a copy of the array of listeners for the event named eventName.*/ - public listeners(eventName: string | symbol): GenericFunction[] { - return this._listeners(this, eventName, true); - } - - /** - * Returns a copy of the array of listeners for the event named eventName, - * including any wrappers (such as those created by .once()). - */ - public rawListeners( - eventName: string | symbol, - ): Array { - return this._listeners(this, eventName, false); - } - - /** Alias for emitter.removeListener(). */ - public off(eventName: string | symbol, listener: GenericFunction): this { - return this.removeListener(eventName, listener); - } - - /** - * Adds the listener function to the end of the listeners array for the event - * named eventName. No checks are made to see if the listener has already - * been added. Multiple calls passing the same combination of eventName and - * listener will result in the listener being added, and called, multiple - * times. - */ - public on( - eventName: string | symbol, - listener: GenericFunction | WrappedFunction, - ): this { - return this._addListener(eventName, listener, false); - } - - /** - * Adds a one-time listener function for the event named eventName. The next - * time eventName is triggered, this listener is removed and then invoked. - */ - public once(eventName: string | symbol, listener: GenericFunction): this { - const wrapped: WrappedFunction = this.onceWrap(eventName, listener); - this.on(eventName, wrapped); - return this; - } - - // Wrapped function that calls EventEmitter.removeListener(eventName, self) on execution. - private onceWrap( - eventName: string | symbol, - listener: GenericFunction, - ): WrappedFunction { - this.checkListenerArgument(listener); - const wrapper = function ( - this: { - eventName: string | symbol; - listener: GenericFunction; - rawListener: GenericFunction | WrappedFunction; - context: EventEmitter; - isCalled?: boolean; - }, - // deno-lint-ignore no-explicit-any - ...args: any[] - ): void { - // If `emit` is called in listeners, the same listener can be called multiple times. - // To prevent that, check the flag here. - if (this.isCalled) { - return; - } - this.context.removeListener( - this.eventName, - this.rawListener as GenericFunction, - ); - this.isCalled = true; - return this.listener.apply(this.context, args); - }; - const wrapperContext = { - eventName: eventName, - listener: listener, - rawListener: (wrapper as unknown) as WrappedFunction, - context: this, - }; - const wrapped = (wrapper.bind( - wrapperContext, - ) as unknown) as WrappedFunction; - wrapperContext.rawListener = wrapped; - wrapped.listener = listener; - return wrapped as WrappedFunction; - } - - /** - * Adds the listener function to the beginning of the listeners array for the - * event named eventName. No checks are made to see if the listener has - * already been added. Multiple calls passing the same combination of - * eventName and listener will result in the listener being added, and - * called, multiple times. - */ - public prependListener( - eventName: string | symbol, - listener: GenericFunction | WrappedFunction, - ): this { - return this._addListener(eventName, listener, true); - } - - /** - * Adds a one-time listener function for the event named eventName to the - * beginning of the listeners array. The next time eventName is triggered, - * this listener is removed, and then invoked. - */ - public prependOnceListener( - eventName: string | symbol, - listener: GenericFunction, - ): this { - const wrapped: WrappedFunction = this.onceWrap(eventName, listener); - this.prependListener(eventName, wrapped); - return this; - } - - /** Removes all listeners, or those of the specified eventName. */ - public removeAllListeners(eventName?: string | symbol): this { - if (this._events === undefined) { - return this; - } - - if (eventName) { - if (this._events.has(eventName)) { - const listeners = this._events.get(eventName)!.slice().reverse(); - for (const listener of listeners) { - this.removeListener( - eventName, - this.unwrapListener(listener), - ); - } - } - } else { - const eventList = this.eventNames(); - eventList.forEach((value: string | symbol) => { - this.removeAllListeners(value); - }); - } - - return this; - } - - /** - * Removes the specified listener from the listener array for the event - * named eventName. - */ - public removeListener( - eventName: string | symbol, - listener: GenericFunction, - ): this { - this.checkListenerArgument(listener); - if (this._events.has(eventName)) { - const arr: - | Array - | undefined = this._events.get(eventName); - - assert(arr); - - let listenerIndex = -1; - for (let i = arr.length - 1; i >= 0; i--) { - // arr[i]["listener"] is the reference to the listener inside a bound 'once' wrapper - if ( - arr[i] == listener || - (arr[i] && (arr[i] as WrappedFunction)["listener"] == listener) - ) { - listenerIndex = i; - break; - } - } - - if (listenerIndex >= 0) { - arr.splice(listenerIndex, 1); - this.emit("removeListener", eventName, listener); - if (arr.length === 0) { - this._events.delete(eventName); - } - } - } - return this; - } - - /** - * By default EventEmitters will print a warning if more than 10 listeners - * are added for a particular event. This is a useful default that helps - * finding memory leaks. Obviously, not all events should be limited to just - * 10 listeners. The emitter.setMaxListeners() method allows the limit to be - * modified for this specific EventEmitter instance. The value can be set to - * Infinity (or 0) to indicate an unlimited number of listeners. - */ - public setMaxListeners(n: number): this { - if (n !== Infinity) { - validateMaxListeners(n, "n"); - } - - this.maxListeners = n; - return this; - } - - /** - * Creates a Promise that is fulfilled when the EventEmitter emits the given - * event or that is rejected when the EventEmitter emits 'error'. The Promise - * will resolve with an array of all the arguments emitted to the given event. - */ - public static once( - emitter: EventEmitter | EventTarget, - name: string, - // deno-lint-ignore no-explicit-any - ): Promise { - return new Promise((resolve, reject) => { - if (emitter instanceof EventTarget) { - // EventTarget does not have `error` event semantics like Node - // EventEmitters, we do not listen to `error` events here. - emitter.addEventListener( - name, - (...args) => { - resolve(args); - }, - { once: true, passive: false, capture: false }, - ); - return; - } else if (emitter instanceof EventEmitter) { - // deno-lint-ignore no-explicit-any - const eventListener = (...args: any[]): void => { - if (errorListener !== undefined) { - emitter.removeListener("error", errorListener); - } - resolve(args); - }; - let errorListener: GenericFunction; - - // Adding an error listener is not optional because - // if an error is thrown on an event emitter we cannot - // guarantee that the actual event we are waiting will - // be fired. The result could be a silent way to create - // memory or file descriptor leaks, which is something - // we should avoid. - if (name !== "error") { - // deno-lint-ignore no-explicit-any - errorListener = (err: any): void => { - emitter.removeListener(name, eventListener); - reject(err); - }; - - emitter.once("error", errorListener); - } - - emitter.once(name, eventListener); - return; - } - }); - } - - /** - * Returns an AsyncIterator that iterates eventName events. It will throw if - * the EventEmitter emits 'error'. It removes all listeners when exiting the - * loop. The value returned by each iteration is an array composed of the - * emitted event arguments. - */ - public static on( - emitter: EventEmitter, - event: string | symbol, - ): AsyncIterable { - // deno-lint-ignore no-explicit-any - const unconsumedEventValues: any[] = []; - // deno-lint-ignore no-explicit-any - const unconsumedPromises: any[] = []; - let error: Error | null = null; - let finished = false; - - const iterator = { - // deno-lint-ignore no-explicit-any - next(): Promise> { - // First, we consume all unread events - // deno-lint-ignore no-explicit-any - const value: any = unconsumedEventValues.shift(); - if (value) { - return Promise.resolve(createIterResult(value, false)); - } - - // Then we error, if an error happened - // This happens one time if at all, because after 'error' - // we stop listening - if (error) { - const p: Promise = Promise.reject(error); - // Only the first element errors - error = null; - return p; - } - - // If the iterator is finished, resolve to done - if (finished) { - return Promise.resolve(createIterResult(undefined, true)); - } - - // Wait until an event happens - return new Promise(function (resolve, reject) { - unconsumedPromises.push({ resolve, reject }); - }); - }, - - // deno-lint-ignore no-explicit-any - return(): Promise> { - emitter.removeListener(event, eventHandler); - emitter.removeListener("error", errorHandler); - finished = true; - - for (const promise of unconsumedPromises) { - promise.resolve(createIterResult(undefined, true)); - } - - return Promise.resolve(createIterResult(undefined, true)); - }, - - throw(err: Error): void { - error = err; - emitter.removeListener(event, eventHandler); - emitter.removeListener("error", errorHandler); - }, - - // deno-lint-ignore no-explicit-any - [Symbol.asyncIterator](): any { - return this; - }, - }; - - emitter.on(event, eventHandler); - emitter.on("error", errorHandler); - - return iterator; - - // deno-lint-ignore no-explicit-any - function eventHandler(...args: any[]): void { - const promise = unconsumedPromises.shift(); - if (promise) { - promise.resolve(createIterResult(args, false)); - } else { - unconsumedEventValues.push(args); - } - } - - // deno-lint-ignore no-explicit-any - function errorHandler(err: any): void { - finished = true; - - const toError = unconsumedPromises.shift(); - if (toError) { - toError.reject(err); - } else { - // The next time we call next() - error = err; - } - - iterator.return(); - } - } - - private checkListenerArgument(listener: unknown): void { - if (typeof listener !== "function") { - throw new ERR_INVALID_ARG_TYPE("listener", "function", listener); - } - } - - private warnIfNeeded(eventName: string | symbol, warning: Error): void { - EventEmitter._alreadyWarnedEvents ||= new Set(); - if (EventEmitter._alreadyWarnedEvents.has(eventName)) { - return; - } - EventEmitter._alreadyWarnedEvents.add(eventName); - console.warn(warning); - - // TODO(uki00a): Here are two problems: - // * If `global.ts` is not imported, then `globalThis.process` will be undefined. - // * Importing `process.ts` from this file will result in circurlar reference. - // As a workaround, explicitly check for the existence of `globalThis.process`. - // deno-lint-ignore no-explicit-any - const maybeProcess = (globalThis as any).process; - if (maybeProcess instanceof EventEmitter) { - maybeProcess.emit("warning", warning); - } - } -} - -// EventEmitter#addListener should point to the same function as EventEmitter#on. -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -class MaxListenersExceededWarning extends Error { - readonly count: number; - constructor( - readonly emitter: EventEmitter, - readonly type: string | symbol, - ) { - const listenerCount = emitter.listenerCount(type); - const message = "Possible EventEmitter memory leak detected. " + - `${listenerCount} ${ - type == null ? "null" : type.toString() - } listeners added to [${emitter.constructor.name}]. ` + - " Use emitter.setMaxListeners() to increase limit"; - super(message); - this.count = listenerCount; - this.name = "MaxListenersExceededWarning"; - } -} - -export default Object.assign(EventEmitter, { EventEmitter }); - -export const captureRejectionSymbol = EventEmitter.captureRejectionSymbol; -export const errorMonitor = EventEmitter.errorMonitor; -export const listenerCount = EventEmitter.listenerCount; -export const on = EventEmitter.on; -export const once = EventEmitter.once; diff --git a/crates/swc_bundler/tests/.cache/deno/17e969504f75c0a60cb0dbb8f915b07533dc4068.ts b/crates/swc_bundler/tests/.cache/deno/17e969504f75c0a60cb0dbb8f915b07533dc4068.ts deleted file mode 100644 index fad1576e1c56..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/17e969504f75c0a60cb0dbb8f915b07533dc4068.ts +++ /dev/null @@ -1,166 +0,0 @@ -// Loaded from https://deno.land/std@0.74.0/textproto/mod.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// Based on https://github.com/golang/go/tree/master/src/net/textproto -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -import type { BufReader } from "../io/bufio.ts"; -import { concat } from "../bytes/mod.ts"; -import { decode } from "../encoding/utf8.ts"; - -// FROM https://github.com/denoland/deno/blob/b34628a26ab0187a827aa4ebe256e23178e25d39/cli/js/web/headers.ts#L9 -const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/g; - -function str(buf: Uint8Array | null | undefined): string { - if (buf == null) { - return ""; - } else { - return decode(buf); - } -} - -function charCode(s: string): number { - return s.charCodeAt(0); -} - -export class TextProtoReader { - constructor(readonly r: BufReader) {} - - /** readLine() reads a single line from the TextProtoReader, - * eliding the final \n or \r\n from the returned string. - */ - async readLine(): Promise { - const s = await this.readLineSlice(); - if (s === null) return null; - return str(s); - } - - /** ReadMIMEHeader reads a MIME-style header from r. - * The header is a sequence of possibly continued Key: Value lines - * ending in a blank line. - * The returned map m maps CanonicalMIMEHeaderKey(key) to a - * sequence of values in the same order encountered in the input. - * - * For example, consider this input: - * - * My-Key: Value 1 - * Long-Key: Even - * Longer Value - * My-Key: Value 2 - * - * Given that input, ReadMIMEHeader returns the map: - * - * map[string][]string{ - * "My-Key": {"Value 1", "Value 2"}, - * "Long-Key": {"Even Longer Value"}, - * } - */ - async readMIMEHeader(): Promise { - const m = new Headers(); - let line: Uint8Array | undefined; - - // The first line cannot start with a leading space. - let buf = await this.r.peek(1); - if (buf === null) { - return null; - } else if (buf[0] == charCode(" ") || buf[0] == charCode("\t")) { - line = (await this.readLineSlice()) as Uint8Array; - } - - buf = await this.r.peek(1); - if (buf === null) { - throw new Deno.errors.UnexpectedEof(); - } else if (buf[0] == charCode(" ") || buf[0] == charCode("\t")) { - throw new Deno.errors.InvalidData( - `malformed MIME header initial line: ${str(line)}`, - ); - } - - while (true) { - const kv = await this.readLineSlice(); // readContinuedLineSlice - if (kv === null) throw new Deno.errors.UnexpectedEof(); - if (kv.byteLength === 0) return m; - - // Key ends at first colon - let i = kv.indexOf(charCode(":")); - if (i < 0) { - throw new Deno.errors.InvalidData( - `malformed MIME header line: ${str(kv)}`, - ); - } - - //let key = canonicalMIMEHeaderKey(kv.subarray(0, endKey)); - const key = str(kv.subarray(0, i)); - - // As per RFC 7230 field-name is a token, - // tokens consist of one or more chars. - // We could throw `Deno.errors.InvalidData` here, - // but better to be liberal in what we - // accept, so if we get an empty key, skip it. - if (key == "") { - continue; - } - - // Skip initial spaces in value. - i++; // skip colon - while ( - i < kv.byteLength && - (kv[i] == charCode(" ") || kv[i] == charCode("\t")) - ) { - i++; - } - const value = str(kv.subarray(i)).replace( - invalidHeaderCharRegex, - encodeURI, - ); - - // In case of invalid header we swallow the error - // example: "Audio Mode" => invalid due to space in the key - try { - m.append(key, value); - } catch { - // Pass - } - } - } - - async readLineSlice(): Promise { - // this.closeDot(); - let line: Uint8Array | undefined; - while (true) { - const r = await this.r.readLine(); - if (r === null) return null; - const { line: l, more } = r; - - // Avoid the copy if the first call produced a full line. - if (!line && !more) { - // TODO(ry): - // This skipSpace() is definitely misplaced, but I don't know where it - // comes from nor how to fix it. - if (this.skipSpace(l) === 0) { - return new Uint8Array(0); - } - return l; - } - line = line ? concat(line, l) : l; - if (!more) { - break; - } - } - return line; - } - - skipSpace(l: Uint8Array): number { - let n = 0; - for (let i = 0; i < l.length; i++) { - if (l[i] === charCode(" ") || l[i] === charCode("\t")) { - continue; - } - n++; - } - return n; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/17f62108acbdf7d22c0f6257be7f525374df7aa3.ts b/crates/swc_bundler/tests/.cache/deno/17f62108acbdf7d22c0f6257be7f525374df7aa3.ts deleted file mode 100644 index ecc8aef21757..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/17f62108acbdf7d22c0f6257be7f525374df7aa3.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/roles/remove_role.ts - - -import { botId } from "../../bot.ts"; -import { rest } from "../../rest/rest.ts"; -import { Errors } from "../../types/discordeno/errors.ts"; -import { endpoints } from "../../util/constants.ts"; -import { isHigherPosition, requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** Remove a role from the member */ -export async function removeRole(guildId: bigint, memberId: bigint, roleId: bigint, reason?: string) { - const isHigherRolePosition = await isHigherPosition(guildId, botId, roleId); - if (!isHigherRolePosition) { - throw new Error(Errors.BOTS_HIGHEST_ROLE_TOO_LOW); - } - - await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]); - - return await rest.runMethod("delete", endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId), { reason }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1823506ab54fa73305dc9a7c9db63be3a0d1c021.ts b/crates/swc_bundler/tests/.cache/deno/1823506ab54fa73305dc9a7c9db63be3a0d1c021.ts deleted file mode 100644 index 486a5cf880f5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1823506ab54fa73305dc9a7c9db63be3a0d1c021.ts +++ /dev/null @@ -1,358 +0,0 @@ -// Loaded from https://deno.land/std@0.89.0/flags/mod.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -import { assert } from "../_util/assert.ts"; - -export interface Args { - /** Contains all the arguments that didn't have an option associated with - * them. */ - _: Array; - // deno-lint-ignore no-explicit-any - [key: string]: any; -} - -export interface ArgParsingOptions { - /** When `true`, populate the result `_` with everything before the `--` and - * the result `['--']` with everything after the `--`. Here's an example: - * - * // $ deno run example.ts -- a arg1 - * import { parse } from "https://deno.land/std/flags/mod.ts"; - * console.dir(parse(Deno.args, { "--": false })); - * // output: { _: [ "a", "arg1" ] } - * console.dir(parse(Deno.args, { "--": true })); - * // output: { _: [], --: [ "a", "arg1" ] } - * - * Defaults to `false`. - */ - "--"?: boolean; - - /** An object mapping string names to strings or arrays of string argument - * names to use as aliases */ - alias?: Record; - - /** A boolean, string or array of strings to always treat as booleans. If - * `true` will treat all double hyphenated arguments without equal signs as - * `boolean` (e.g. affects `--foo`, not `-f` or `--foo=bar`) */ - boolean?: boolean | string | string[]; - - /** An object mapping string argument names to default values. */ - default?: Record; - - /** When `true`, populate the result `_` with everything after the first - * non-option. */ - stopEarly?: boolean; - - /** A string or array of strings argument names to always treat as strings. */ - string?: string | string[]; - - /** A function which is invoked with a command line parameter not defined in - * the `options` configuration object. If the function returns `false`, the - * unknown option is not added to `parsedArgs`. */ - unknown?: (arg: string, key?: string, value?: unknown) => unknown; -} - -interface Flags { - bools: Record; - strings: Record; - unknownFn: (arg: string, key?: string, value?: unknown) => unknown; - allBools: boolean; -} - -interface NestedMapping { - [key: string]: NestedMapping | unknown; -} - -function get(obj: Record, key: string): T | undefined { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - return obj[key]; - } -} - -function getForce(obj: Record, key: string): T { - const v = get(obj, key); - assert(v != null); - return v; -} - -function isNumber(x: unknown): boolean { - if (typeof x === "number") return true; - if (/^0x[0-9a-f]+$/i.test(String(x))) return true; - return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(String(x)); -} - -function hasKey(obj: NestedMapping, keys: string[]): boolean { - let o = obj; - keys.slice(0, -1).forEach((key) => { - o = (get(o, key) ?? {}) as NestedMapping; - }); - - const key = keys[keys.length - 1]; - return key in o; -} - -/** Take a set of command line arguments, with an optional set of options, and - * return an object representation of those argument. - * - * const parsedArgs = parse(Deno.args); - */ -export function parse( - args: string[], - { - "--": doubleDash = false, - alias = {}, - boolean = false, - default: defaults = {}, - stopEarly = false, - string = [], - unknown = (i: string): unknown => i, - }: ArgParsingOptions = {}, -): Args { - const flags: Flags = { - bools: {}, - strings: {}, - unknownFn: unknown, - allBools: false, - }; - - if (boolean !== undefined) { - if (typeof boolean === "boolean") { - flags.allBools = !!boolean; - } else { - const booleanArgs = typeof boolean === "string" ? [boolean] : boolean; - - for (const key of booleanArgs.filter(Boolean)) { - flags.bools[key] = true; - } - } - } - - const aliases: Record = {}; - if (alias !== undefined) { - for (const key in alias) { - const val = getForce(alias, key); - if (typeof val === "string") { - aliases[key] = [val]; - } else { - aliases[key] = val; - } - for (const alias of getForce(aliases, key)) { - aliases[alias] = [key].concat(aliases[key].filter((y) => alias !== y)); - } - } - } - - if (string !== undefined) { - const stringArgs = typeof string === "string" ? [string] : string; - - for (const key of stringArgs.filter(Boolean)) { - flags.strings[key] = true; - const alias = get(aliases, key); - if (alias) { - for (const al of alias) { - flags.strings[al] = true; - } - } - } - } - - const argv: Args = { _: [] }; - - function argDefined(key: string, arg: string): boolean { - return ( - (flags.allBools && /^--[^=]+$/.test(arg)) || - get(flags.bools, key) || - !!get(flags.strings, key) || - !!get(aliases, key) - ); - } - - function setKey(obj: NestedMapping, keys: string[], value: unknown): void { - let o = obj; - keys.slice(0, -1).forEach(function (key): void { - if (get(o, key) === undefined) { - o[key] = {}; - } - o = get(o, key) as NestedMapping; - }); - - const key = keys[keys.length - 1]; - if ( - get(o, key) === undefined || - get(flags.bools, key) || - typeof get(o, key) === "boolean" - ) { - o[key] = value; - } else if (Array.isArray(get(o, key))) { - (o[key] as unknown[]).push(value); - } else { - o[key] = [get(o, key), value]; - } - } - - function setArg( - key: string, - val: unknown, - arg: string | undefined = undefined, - ): void { - if (arg && flags.unknownFn && !argDefined(key, arg)) { - if (flags.unknownFn(arg, key, val) === false) return; - } - - const value = !get(flags.strings, key) && isNumber(val) ? Number(val) : val; - setKey(argv, key.split("."), value); - - const alias = get(aliases, key); - if (alias) { - for (const x of alias) { - setKey(argv, x.split("."), value); - } - } - } - - function aliasIsBoolean(key: string): boolean { - return getForce(aliases, key).some( - (x) => typeof get(flags.bools, x) === "boolean", - ); - } - - for (const key of Object.keys(flags.bools)) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - } - - let notFlags: string[] = []; - - // all args after "--" are not parsed - if (args.includes("--")) { - notFlags = args.slice(args.indexOf("--") + 1); - args = args.slice(0, args.indexOf("--")); - } - - for (let i = 0; i < args.length; i++) { - const arg = args[i]; - - if (/^--.+=/.test(arg)) { - const m = arg.match(/^--([^=]+)=(.*)$/s); - assert(m != null); - const [, key, value] = m; - - if (flags.bools[key]) { - const booleanValue = value !== "false"; - setArg(key, booleanValue, arg); - } else { - setArg(key, value, arg); - } - } else if (/^--no-.+/.test(arg)) { - const m = arg.match(/^--no-(.+)/); - assert(m != null); - setArg(m[1], false, arg); - } else if (/^--.+/.test(arg)) { - const m = arg.match(/^--(.+)/); - assert(m != null); - const [, key] = m; - const next = args[i + 1]; - if ( - next !== undefined && - !/^-/.test(next) && - !get(flags.bools, key) && - !flags.allBools && - (get(aliases, key) ? !aliasIsBoolean(key) : true) - ) { - setArg(key, next, arg); - i++; - } else if (/^(true|false)$/.test(next)) { - setArg(key, next === "true", arg); - i++; - } else { - setArg(key, get(flags.strings, key) ? "" : true, arg); - } - } else if (/^-[^-]+/.test(arg)) { - const letters = arg.slice(1, -1).split(""); - - let broken = false; - for (let j = 0; j < letters.length; j++) { - const next = arg.slice(j + 2); - - if (next === "-") { - setArg(letters[j], next, arg); - continue; - } - - if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { - setArg(letters[j], next.split(/=(.+)/)[1], arg); - broken = true; - break; - } - - if ( - /[A-Za-z]/.test(letters[j]) && - /-?\d+(\.\d*)?(e-?\d+)?$/.test(next) - ) { - setArg(letters[j], next, arg); - broken = true; - break; - } - - if (letters[j + 1] && letters[j + 1].match(/\W/)) { - setArg(letters[j], arg.slice(j + 2), arg); - broken = true; - break; - } else { - setArg(letters[j], get(flags.strings, letters[j]) ? "" : true, arg); - } - } - - const [key] = arg.slice(-1); - if (!broken && key !== "-") { - if ( - args[i + 1] && - !/^(-|--)[^-]/.test(args[i + 1]) && - !get(flags.bools, key) && - (get(aliases, key) ? !aliasIsBoolean(key) : true) - ) { - setArg(key, args[i + 1], arg); - i++; - } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) { - setArg(key, args[i + 1] === "true", arg); - i++; - } else { - setArg(key, get(flags.strings, key) ? "" : true, arg); - } - } - } else { - if (!flags.unknownFn || flags.unknownFn(arg) !== false) { - argv._.push(flags.strings["_"] ?? !isNumber(arg) ? arg : Number(arg)); - } - if (stopEarly) { - argv._.push(...args.slice(i + 1)); - break; - } - } - } - - for (const key of Object.keys(defaults)) { - if (!hasKey(argv, key.split("."))) { - setKey(argv, key.split("."), defaults[key]); - - if (aliases[key]) { - for (const x of aliases[key]) { - setKey(argv, x.split("."), defaults[key]); - } - } - } - } - - if (doubleDash) { - argv["--"] = []; - for (const key of notFlags) { - argv["--"].push(key); - } - } else { - for (const key of notFlags) { - argv._.push(key); - } - } - - return argv; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1830fc4231d7949065108ba406eea9cfe33d4ef0.ts b/crates/swc_bundler/tests/.cache/deno/1830fc4231d7949065108ba406eea9cfe33d4ef0.ts deleted file mode 100644 index 56b1c16e899a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1830fc4231d7949065108ba406eea9cfe33d4ef0.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/std@0.74.0/encoding/utf8.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -/** A default TextEncoder instance */ -export const encoder = new TextEncoder(); - -/** Shorthand for new TextEncoder().encode() */ -export function encode(input?: string): Uint8Array { - return encoder.encode(input); -} - -/** A default TextDecoder instance */ -export const decoder = new TextDecoder(); - -/** Shorthand for new TextDecoder().decode() */ -export function decode(input?: Uint8Array): string { - return decoder.decode(input); -} diff --git a/crates/swc_bundler/tests/.cache/deno/185373cd877407f0d49b9157e0ea4c689775dc60.ts b/crates/swc_bundler/tests/.cache/deno/185373cd877407f0d49b9157e0ea4c689775dc60.ts deleted file mode 100644 index d2358cca60c3..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/185373cd877407f0d49b9157e0ea4c689775dc60.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Loaded from https://deno.land/x/sqlite@v2.3.1/src/error.ts - - -import { Status } from "./constants.ts"; - -export default class SqliteError extends Error { - /** - * SqliteError - * - * Extension over the standard JS Error object - * to also contain class members for error code - * and error code name. - * - * This class is not exported by the module and - * should only be obtained from exceptions raised - * in this module. - */ - constructor(message: string, code?: number) { - super(message); - this.name = "SqliteError"; - this.code = typeof code === "number" ? code : Status.Unknown; - } - - /** - * SqliteError.code - * - * The SQLite result status code, - * see the SQLite docs for more - * information about each code. - * - * https://www.sqlite.org/rescode.html - * - * Beyond the SQLite status codes, this member - * can also contain custom status codes specific - * to this library (starting from 1000). - * - * Errors that originate in the JavaScript part of - * the library will not have an associated status - * code. For these errors, the code will be - * `Status.Unknown`. - * - * | JS name | code | JS name (cont.) | code | - * |------------------|------|------------------|------| - * | SqliteOk | 0 | SqliteEmpty | 16 | - * | SqliteError | 1 | SqliteSchema | 17 | - * | SqliteInternal | 2 | SqliteTooBig | 18 | - * | SqlitePerm | 3 | SqliteConstraint | 19 | - * | SqliteAbort | 4 | SqliteMismatch | 20 | - * | SqliteBusy | 5 | SqliteMisuse | 21 | - * | SqliteLocked | 6 | SqliteNoLFS | 22 | - * | SqliteNoMem | 7 | SqliteAuth | 23 | - * | SqliteReadOnly | 8 | SqliteFormat | 24 | - * | SqliteInterrupt | 9 | SqliteRange | 25 | - * | SqliteIOErr | 10 | SqliteNotADB | 26 | - * | SqliteCorrupt | 11 | SqliteNotice | 27 | - * | SqliteNotFound | 12 | SqliteWarning | 28 | - * | SqliteFull | 13 | SqliteRow | 100 | - * | SqliteCantOpen | 14 | SqliteDone | 101 | - * | SqliteProtocol | 15 | Unknown | -1 | - * - * These codes are accessible via - * the exported `Status` object. - */ - code: number; - - /** - * SqliteError.codeName - * - * Key of code in exported `status` - * object. - * - * E.g. if `code` is `19`, - * `codeName` would be `SqliteConstraint`. - */ - get codeName(): keyof typeof Status { - return Status[this.code] as keyof typeof Status; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1883a3d58b753cc5f249c4a88aa65dfa9f311b68.ts b/crates/swc_bundler/tests/.cache/deno/1883a3d58b753cc5f249c4a88aa65dfa9f311b68.ts deleted file mode 100644 index d644a72bb040..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1883a3d58b753cc5f249c4a88aa65dfa9f311b68.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/media_types@v2.5.1/deps.ts - - -// Copyright 2020 the oak authors. All rights reserved. MIT license. - -export { extname } from "https://deno.land/std@0.73.0/path/mod.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/188998fe8bd8ae01bbc6e2ec7935e16a377a2f42.ts b/crates/swc_bundler/tests/.cache/deno/188998fe8bd8ae01bbc6e2ec7935e16a377a2f42.ts deleted file mode 100644 index d7d426596c71..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/188998fe8bd8ae01bbc6e2ec7935e16a377a2f42.ts +++ /dev/null @@ -1,239 +0,0 @@ -// Loaded from https://deno.land/std/log/handlers.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { getLevelByName, LevelName, LogLevels } from "./levels.ts"; -import type { LogRecord } from "./logger.ts"; -import { blue, bold, red, yellow } from "../fmt/colors.ts"; -import { exists, existsSync } from "../fs/exists.ts"; -import { BufWriterSync } from "../io/bufio.ts"; - -const DEFAULT_FORMATTER = "{levelName} {msg}"; -type FormatterFunction = (logRecord: LogRecord) => string; -type LogMode = "a" | "w" | "x"; - -interface HandlerOptions { - formatter?: string | FormatterFunction; -} - -export class BaseHandler { - level: number; - levelName: LevelName; - formatter: string | FormatterFunction; - - constructor(levelName: LevelName, options: HandlerOptions = {}) { - this.level = getLevelByName(levelName); - this.levelName = levelName; - - this.formatter = options.formatter || DEFAULT_FORMATTER; - } - - handle(logRecord: LogRecord): void { - if (this.level > logRecord.level) return; - - const msg = this.format(logRecord); - return this.log(msg); - } - - format(logRecord: LogRecord): string { - if (this.formatter instanceof Function) { - return this.formatter(logRecord); - } - - return this.formatter.replace(/{(\S+)}/g, (match, p1): string => { - const value = logRecord[p1 as keyof LogRecord]; - - // do not interpolate missing values - if (value == null) { - return match; - } - - return String(value); - }); - } - - log(_msg: string): void {} - async setup(): Promise {} - async destroy(): Promise {} -} - -export class ConsoleHandler extends BaseHandler { - format(logRecord: LogRecord): string { - let msg = super.format(logRecord); - - switch (logRecord.level) { - case LogLevels.INFO: - msg = blue(msg); - break; - case LogLevels.WARNING: - msg = yellow(msg); - break; - case LogLevels.ERROR: - msg = red(msg); - break; - case LogLevels.CRITICAL: - msg = bold(red(msg)); - break; - default: - break; - } - - return msg; - } - - log(msg: string): void { - console.log(msg); - } -} - -export abstract class WriterHandler extends BaseHandler { - protected _writer!: Deno.Writer; - #encoder = new TextEncoder(); - - abstract log(msg: string): void; -} - -interface FileHandlerOptions extends HandlerOptions { - filename: string; - mode?: LogMode; -} - -export class FileHandler extends WriterHandler { - protected _file: Deno.File | undefined; - protected _buf!: BufWriterSync; - protected _filename: string; - protected _mode: LogMode; - protected _openOptions: Deno.OpenOptions; - protected _encoder = new TextEncoder(); - #unloadCallback = (): Promise => this.destroy(); - - constructor(levelName: LevelName, options: FileHandlerOptions) { - super(levelName, options); - this._filename = options.filename; - // default to append mode, write only - this._mode = options.mode ? options.mode : "a"; - this._openOptions = { - createNew: this._mode === "x", - create: this._mode !== "x", - append: this._mode === "a", - truncate: this._mode !== "a", - write: true, - }; - } - - async setup(): Promise { - this._file = await Deno.open(this._filename, this._openOptions); - this._writer = this._file; - this._buf = new BufWriterSync(this._file); - - addEventListener("unload", this.#unloadCallback); - } - - handle(logRecord: LogRecord): void { - super.handle(logRecord); - - // Immediately flush if log level is higher than ERROR - if (logRecord.level > LogLevels.ERROR) { - this.flush(); - } - } - - log(msg: string): void { - this._buf.writeSync(this._encoder.encode(msg + "\n")); - } - - flush(): void { - if (this._buf?.buffered() > 0) { - this._buf.flush(); - } - } - - destroy(): Promise { - this.flush(); - this._file?.close(); - this._file = undefined; - removeEventListener("unload", this.#unloadCallback); - return Promise.resolve(); - } -} - -interface RotatingFileHandlerOptions extends FileHandlerOptions { - maxBytes: number; - maxBackupCount: number; -} - -export class RotatingFileHandler extends FileHandler { - #maxBytes: number; - #maxBackupCount: number; - #currentFileSize = 0; - - constructor(levelName: LevelName, options: RotatingFileHandlerOptions) { - super(levelName, options); - this.#maxBytes = options.maxBytes; - this.#maxBackupCount = options.maxBackupCount; - } - - async setup(): Promise { - if (this.#maxBytes < 1) { - this.destroy(); - throw new Error("maxBytes cannot be less than 1"); - } - if (this.#maxBackupCount < 1) { - this.destroy(); - throw new Error("maxBackupCount cannot be less than 1"); - } - await super.setup(); - - if (this._mode === "w") { - // Remove old backups too as it doesn't make sense to start with a clean - // log file, but old backups - for (let i = 1; i <= this.#maxBackupCount; i++) { - if (await exists(this._filename + "." + i)) { - await Deno.remove(this._filename + "." + i); - } - } - } else if (this._mode === "x") { - // Throw if any backups also exist - for (let i = 1; i <= this.#maxBackupCount; i++) { - if (await exists(this._filename + "." + i)) { - this.destroy(); - throw new Deno.errors.AlreadyExists( - "Backup log file " + this._filename + "." + i + " already exists", - ); - } - } - } else { - this.#currentFileSize = (await Deno.stat(this._filename)).size; - } - } - - log(msg: string): void { - const msgByteLength = this._encoder.encode(msg).byteLength + 1; - - if (this.#currentFileSize + msgByteLength > this.#maxBytes) { - this.rotateLogFiles(); - this.#currentFileSize = 0; - } - - this._buf.writeSync(this._encoder.encode(msg + "\n")); - this.#currentFileSize += msgByteLength; - } - - rotateLogFiles(): void { - this._buf.flush(); - Deno.close(this._file!.rid); - - for (let i = this.#maxBackupCount - 1; i >= 0; i--) { - const source = this._filename + (i === 0 ? "" : "." + i); - const dest = this._filename + "." + (i + 1); - - if (existsSync(source)) { - Deno.renameSync(source, dest); - } - } - - this._file = Deno.openSync(this._filename, this._openOptions); - this._writer = this._file; - this._buf = new BufWriterSync(this._file); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/188a854bf2fcf891f3add27ab83bb40a0153d5ae.ts b/crates/swc_bundler/tests/.cache/deno/188a854bf2fcf891f3add27ab83bb40a0153d5ae.ts deleted file mode 100644 index 821cd1087f7e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/188a854bf2fcf891f3add27ab83bb40a0153d5ae.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/trim.js - - -import _curry1 from './internal/_curry1.js'; - - -var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + - '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + - '\u2029\uFEFF'; -var zeroWidth = '\u200b'; -var hasProtoTrim = (typeof String.prototype.trim === 'function'); -/** - * Removes (strips) whitespace from both ends of the string. - * - * @func - * @memberOf R - * @since v0.6.0 - * @category String - * @sig String -> String - * @param {String} str The string to trim. - * @return {String} Trimmed version of `str`. - * @example - * - * R.trim(' xyz '); //=> 'xyz' - * R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] - */ -var trim = !hasProtoTrim || (ws.trim() || !zeroWidth.trim()) ? - _curry1(function trim(str) { - var beginRx = new RegExp('^[' + ws + '][' + ws + ']*'); - var endRx = new RegExp('[' + ws + '][' + ws + ']*$'); - return str.replace(beginRx, '').replace(endRx, ''); - }) : - _curry1(function trim(str) { - return str.trim(); - }); -export default trim; diff --git a/crates/swc_bundler/tests/.cache/deno/18c31ad6227f598945da9d3bae0cf9301715c209.ts b/crates/swc_bundler/tests/.cache/deno/18c31ad6227f598945da9d3bae0cf9301715c209.ts deleted file mode 100644 index a0ae1827c78c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/18c31ad6227f598945da9d3bae0cf9301715c209.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/async/deferred.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// TODO(ry) It'd be better to make Deferred a class that inherits from -// Promise, rather than an interface. This is possible in ES2016, however -// typescript produces broken code when targeting ES5 code. -// See https://github.com/Microsoft/TypeScript/issues/15202 -// At the time of writing, the github issue is closed but the problem remains. -export interface Deferred extends Promise { - resolve: (value?: T | PromiseLike) => void; - // deno-lint-ignore no-explicit-any - reject: (reason?: any) => void; -} - -/** Creates a Promise with the `reject` and `resolve` functions - * placed as methods on the promise object itself. It allows you to do: - * - * const p = deferred(); - * // ... - * p.resolve(42); - */ -export function deferred(): Deferred { - let methods; - const promise = new Promise((resolve, reject): void => { - methods = { resolve, reject }; - }); - return Object.assign(promise, methods) as Deferred; -} diff --git a/crates/swc_bundler/tests/.cache/deno/18c64b58700d8fb706632e781cb0ed077aa00a64.ts b/crates/swc_bundler/tests/.cache/deno/18c64b58700d8fb706632e781cb0ed077aa00a64.ts deleted file mode 100644 index 07428c44061f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/18c64b58700d8fb706632e781cb0ed077aa00a64.ts +++ /dev/null @@ -1,177 +0,0 @@ -// Loaded from https://deno.land/x/oak@v6.3.1/send.ts - - -/*! - * Adapted from koa-send at https://github.com/koajs/send and which is licensed - * with the MIT license. - */ - -import type { Context } from "./context.ts"; -import { createHttpError } from "./httpError.ts"; -import { basename, extname, parse, sep } from "./deps.ts"; -import { decodeComponent, resolvePath } from "./util.ts"; - -export interface SendOptions { - /** Try to serve the brotli version of a file automatically when brotli is - * supported by a client and if the requested file with `.br` extension - * exists. (defaults to `true`) */ - brotli?: boolean; - - /** Try to match extensions from passed array to search for file when no - * extension is sufficed in URL. First found is served. (defaults to - * `undefined`) */ - extensions?: string[]; - - /** If `true`, format the path to serve static file servers and not require a - * trailing slash for directories, so that you can do both `/directory` and - * `/directory/`. (defaults to `true`) */ - format?: boolean; - - /** Try to serve the gzipped version of a file automatically when gzip is - * supported by a client and if the requested file with `.gz` extension - * exists. (defaults to `true`). */ - gzip?: boolean; - - /** Allow transfer of hidden files. (defaults to `false`) */ - hidden?: boolean; - - /** Tell the browser the resource is immutable and can be cached - * indefinitely. (defaults to `false`) */ - immutable?: boolean; - - /** Name of the index file to serve automatically when visiting the root - * location. (defaults to none) */ - index?: string; - - /** Browser cache max-age in milliseconds. (defaults to `0`) */ - maxage?: number; - - /** Root directory to restrict file access. */ - root: string; -} - -function isHidden(path: string) { - const pathArr = path.split("/"); - for (const segment of pathArr) { - if (segment[0] === "." && segment !== "." && segment !== "..") { - return true; - } - return false; - } -} - -async function exists(path: string): Promise { - try { - return (await Deno.stat(path)).isFile; - } catch { - return false; - } -} - -/** Asynchronously fulfill a response with a file from the local file - * system. - * - * Requires Deno read permission for the `root` directory. */ -export async function send( - // deno-lint-ignore no-explicit-any - { request, response }: Context, - path: string, - options: SendOptions = { root: "" }, -): Promise { - const { - brotli = true, - extensions, - format = true, - gzip = true, - hidden = false, - immutable = false, - index, - maxage = 0, - root, - } = options; - const trailingSlash = path[path.length - 1] === "/"; - path = decodeComponent(path.substr(parse(path).root.length)); - if (index && trailingSlash) { - path += index; - } - - if (!hidden && isHidden(path)) { - throw createHttpError(403); - } - - path = resolvePath(root, path); - - let encodingExt = ""; - if ( - brotli && - request.acceptsEncodings("br", "identity") === "br" && - (await exists(`${path}.br`)) - ) { - path = `${path}.br`; - response.headers.set("Content-Encoding", "br"); - response.headers.delete("Content-Length"); - encodingExt = ".br"; - } else if ( - gzip && - request.acceptsEncodings("gzip", "identity") === "gzip" && - (await exists(`${path}.gz`)) - ) { - path = `${path}.gz`; - response.headers.set("Content-Encoding", "gzip"); - response.headers.delete("Content-Length"); - encodingExt = ".gz"; - } - - if (extensions && !/\.[^/]*$/.exec(path)) { - for (let ext of extensions) { - if (!/^\./.exec(ext)) { - ext = `.${ext}`; - } - if (await exists(`${path}${ext}`)) { - path += ext; - break; - } - } - } - - let stats: Deno.FileInfo; - try { - stats = await Deno.stat(path); - - if (stats.isDirectory) { - if (format && index) { - path += `/${index}`; - stats = await Deno.stat(path); - } else { - return; - } - } - } catch (err) { - if (err instanceof Deno.errors.NotFound) { - throw createHttpError(404, err.message); - } - throw createHttpError(500, err.message); - } - - response.headers.set("Content-Length", String(stats.size)); - if (!response.headers.has("Last-Modified") && stats.mtime) { - response.headers.set("Last-Modified", stats.mtime.toUTCString()); - } - if (!response.headers.has("Cache-Control")) { - const directives = [`max-age=${(maxage / 1000) | 0}`]; - if (immutable) { - directives.push("immutable"); - } - response.headers.set("Cache-Control", directives.join(",")); - } - if (!response.type) { - response.type = encodingExt !== "" - ? extname(basename(path, encodingExt)) - : extname(path); - } - const file = await Deno.open(path, { read: true }); - response.addResource(file.rid); - response.body = file; - - return path; -} diff --git a/crates/swc_bundler/tests/.cache/deno/18f9b2005cbb455af48eb310c3ea2f787cfd071c.ts b/crates/swc_bundler/tests/.cache/deno/18f9b2005cbb455af48eb310c3ea2f787cfd071c.ts deleted file mode 100644 index 465821e2391f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/18f9b2005cbb455af48eb310c3ea2f787cfd071c.ts +++ /dev/null @@ -1,2167 +0,0 @@ -// Loaded from https://deno.land/x/dso@v1.0.0/src/Reflect.ts - - -// @ts-nocheck -/*! ***************************************************************************** -Copyright (C) Microsoft. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -namespace Reflect { - // Metadata Proposal - // https://rbuckton.github.io/reflect-metadata/ - - type HashMap = Record; - - interface BufferLike { - [offset: number]: number; - length: number; - } - - type IteratorResult = - | { value: T; done: false } - | { value: never; done: true }; - - interface Iterator { - next(value?: any): IteratorResult; - throw?(value: any): IteratorResult; - return?(value?: T): IteratorResult; - } - - interface Iterable { - "@@iterator"(): Iterator; - } - - interface IterableIterator extends Iterator { - "@@iterator"(): IterableIterator; - } - - interface Map extends Iterable<[K, V]> { - size: number; - has(key: K): boolean; - get(key: K): V; - set(key: K, value?: V): this; - delete(key: K): boolean; - clear(): void; - keys(): IterableIterator; - values(): IterableIterator; - entries(): IterableIterator<[K, V]>; - } - - interface MapConstructor { - new (): Map; - new (): Map; - prototype: Map; - } - - interface Set extends Iterable { - size: number; - has(value: T): boolean; - add(value: T): this; - delete(value: T): boolean; - clear(): void; - keys(): IterableIterator; - values(): IterableIterator; - entries(): IterableIterator<[T, T]>; - } - - interface SetConstructor { - new (): Set; - new (): Set; - prototype: Set; - } - - interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - } - - interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - prototype: WeakMap; - } - - type MemberDecorator = ( - target: Object, - propertyKey: string | symbol, - descriptor?: TypedPropertyDescriptor, - ) => TypedPropertyDescriptor | void; - declare const Symbol: { iterator: symbol; toPrimitive: symbol }; - declare const Set: SetConstructor; - declare const WeakMap: WeakMapConstructor; - declare const Map: MapConstructor; - declare const global: any; - - // @ts-ignore - declare const crypto: Crypto; - - // @ts-ignore - declare const msCrypto: Crypto; - declare const process: any; - - /** - * Applies a set of decorators to a target object. - * @param decorators An array of decorators. - * @param target The target object. - * @returns The result of applying the provided decorators. - * @remarks Decorators are applied in reverse order of their positions in the array. - * @example - * - * class Example { } - * - * // constructor - * Example = Reflect.decorate(decoratorsArray, Example); - * - */ - export declare function decorate( - decorators: ClassDecorator[], - target: Function, - ): Function; - - /** - * Applies a set of decorators to a property of a target object. - * @param decorators An array of decorators. - * @param target The target object. - * @param propertyKey The property key to decorate. - * @param attributes A property descriptor. - * @remarks Decorators are applied in reverse order. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod() { } - * method() { } - * } - * - * // property (on constructor) - * Reflect.decorate(decoratorsArray, Example, "staticProperty"); - * - * // property (on prototype) - * Reflect.decorate(decoratorsArray, Example.prototype, "property"); - * - * // method (on constructor) - * Object.defineProperty(Example, "staticMethod", - * Reflect.decorate(decoratorsArray, Example, "staticMethod", - * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); - * - * // method (on prototype) - * Object.defineProperty(Example.prototype, "method", - * Reflect.decorate(decoratorsArray, Example.prototype, "method", - * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); - * - */ - export declare function decorate( - decorators: (PropertyDecorator | MethodDecorator)[], - target: any, - propertyKey: string | symbol, - attributes?: PropertyDescriptor | null, - ): PropertyDescriptor | undefined; - - /** - * Applies a set of decorators to a property of a target object. - * @param decorators An array of decorators. - * @param target The target object. - * @param propertyKey The property key to decorate. - * @param attributes A property descriptor. - * @remarks Decorators are applied in reverse order. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod() { } - * method() { } - * } - * - * // property (on constructor) - * Reflect.decorate(decoratorsArray, Example, "staticProperty"); - * - * // property (on prototype) - * Reflect.decorate(decoratorsArray, Example.prototype, "property"); - * - * // method (on constructor) - * Object.defineProperty(Example, "staticMethod", - * Reflect.decorate(decoratorsArray, Example, "staticMethod", - * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); - * - * // method (on prototype) - * Object.defineProperty(Example.prototype, "method", - * Reflect.decorate(decoratorsArray, Example.prototype, "method", - * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); - * - */ - export declare function decorate( - decorators: (PropertyDecorator | MethodDecorator)[], - target: any, - propertyKey: string | symbol, - attributes: PropertyDescriptor, - ): PropertyDescriptor; - - /** - * A default metadata decorator factory that can be used on a class, class member, or parameter. - * @param metadataKey The key for the metadata entry. - * @param metadataValue The value for the metadata entry. - * @returns A decorator function. - * @remarks - * If `metadataKey` is already defined for the target and target key, the - * metadataValue for that key will be overwritten. - * @example - * - * // constructor - * @Reflect.metadata(key, value) - * class Example { - * } - * - * // property (on constructor, TypeScript only) - * class Example { - * @Reflect.metadata(key, value) - * static staticProperty; - * } - * - * // property (on prototype, TypeScript only) - * class Example { - * @Reflect.metadata(key, value) - * property; - * } - * - * // method (on constructor) - * class Example { - * @Reflect.metadata(key, value) - * static staticMethod() { } - * } - * - * // method (on prototype) - * class Example { - * @Reflect.metadata(key, value) - * method() { } - * } - * - */ - export declare function metadata( - metadataKey: any, - metadataValue: any, - ): { - (target: Function): void; - (target: any, propertyKey: string | symbol): void; - }; - - /** - * Define a unique metadata entry on the target. - * @param metadataKey A key used to store and retrieve metadata. - * @param metadataValue A value that contains attached metadata. - * @param target The target object on which to define metadata. - * @example - * - * class Example { - * } - * - * // constructor - * Reflect.defineMetadata("custom:annotation", options, Example); - * - * // decorator factory as metadata-producing annotation. - * function MyAnnotation(options): ClassDecorator { - * return target => Reflect.defineMetadata("custom:annotation", options, target); - * } - * - */ - export declare function defineMetadata( - metadataKey: any, - metadataValue: any, - target: any, - ): void; - - /** - * Define a unique metadata entry on the target. - * @param metadataKey A key used to store and retrieve metadata. - * @param metadataValue A value that contains attached metadata. - * @param target The target object on which to define metadata. - * @param propertyKey The property key for the target. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty"); - * - * // property (on prototype) - * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property"); - * - * // method (on constructor) - * Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod"); - * - * // method (on prototype) - * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method"); - * - * // decorator factory as metadata-producing annotation. - * function MyAnnotation(options): PropertyDecorator { - * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key); - * } - * - */ - export declare function defineMetadata( - metadataKey: any, - metadataValue: any, - target: any, - propertyKey: string | symbol, - ): void; - - /** - * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. - * @example - * - * class Example { - * } - * - * // constructor - * result = Reflect.hasMetadata("custom:annotation", Example); - * - */ - export declare function hasMetadata(metadataKey: any, target: any): boolean; - - /** - * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey The property key for the target. - * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); - * - */ - export declare function hasMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): boolean; - - /** - * Gets a value indicating whether the target object has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. - * @example - * - * class Example { - * } - * - * // constructor - * result = Reflect.hasOwnMetadata("custom:annotation", Example); - * - */ - export declare function hasOwnMetadata( - metadataKey: any, - target: any, - ): boolean; - - /** - * Gets a value indicating whether the target object has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey The property key for the target. - * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); - * - */ - export declare function hasOwnMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): boolean; - - /** - * Gets the metadata value for the provided metadata key on the target object or its prototype chain. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * } - * - * // constructor - * result = Reflect.getMetadata("custom:annotation", Example); - * - */ - export declare function getMetadata(metadataKey: any, target: any): any; - - /** - * Gets the metadata value for the provided metadata key on the target object or its prototype chain. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); - * - */ - export declare function getMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): any; - - /** - * Gets the metadata value for the provided metadata key on the target object. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * } - * - * // constructor - * result = Reflect.getOwnMetadata("custom:annotation", Example); - * - */ - export declare function getOwnMetadata(metadataKey: any, target: any): any; - - /** - * Gets the metadata value for the provided metadata key on the target object. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); - * - */ - export declare function getOwnMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): any; - - /** - * Gets the metadata keys defined on the target object or its prototype chain. - * @param target The target object on which the metadata is defined. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * } - * - * // constructor - * result = Reflect.getMetadataKeys(Example); - * - */ - export declare function getMetadataKeys(target: any): any[]; - - /** - * Gets the metadata keys defined on the target object or its prototype chain. - * @param target The target object on which the metadata is defined. - * @param propertyKey The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getMetadataKeys(Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadataKeys(Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadataKeys(Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadataKeys(Example.prototype, "method"); - * - */ - export declare function getMetadataKeys( - target: any, - propertyKey: string | symbol, - ): any[]; - - /** - * Gets the unique metadata keys defined on the target object. - * @param target The target object on which the metadata is defined. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * } - * - * // constructor - * result = Reflect.getOwnMetadataKeys(Example); - * - */ - export declare function getOwnMetadataKeys(target: any): any[]; - - /** - * Gets the unique metadata keys defined on the target object. - * @param target The target object on which the metadata is defined. - * @param propertyKey The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); - * - */ - export declare function getOwnMetadataKeys( - target: any, - propertyKey: string | symbol, - ): any[]; - - /** - * Deletes the metadata entry from the target object with the provided key. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @returns `true` if the metadata entry was found and deleted; otherwise, false. - * @example - * - * class Example { - * } - * - * // constructor - * result = Reflect.deleteMetadata("custom:annotation", Example); - * - */ - export declare function deleteMetadata( - metadataKey: any, - target: any, - ): boolean; - - /** - * Deletes the metadata entry from the target object with the provided key. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey The property key for the target. - * @returns `true` if the metadata entry was found and deleted; otherwise, false. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * static staticMethod(p) { } - * method(p) { } - * } - * - * // property (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); - * - */ - export declare function deleteMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): boolean; - - (function ( - this: any, - factory: ( - exporter: ( - key: K, - value: typeof Reflect[K], - ) => void, - ) => void, - ) { - var self; - const root = typeof global === "object" - ? global - : typeof self === "object" - ? self - : typeof this === "object" - ? this - : Function("return this;")(); - - let exporter = makeExporter(Reflect); - if (typeof root.Reflect === "undefined") { - root.Reflect = Reflect; - } else { - exporter = makeExporter(root.Reflect, exporter); - } - - factory(exporter); - - function makeExporter( - target: typeof Reflect, - previous?: ( - key: K, - value: typeof Reflect[K], - ) => void, - ) { - return ( - key: K, - value: typeof Reflect[K], - ) => { - if (typeof target[key] !== "function") { - Object.defineProperty(target, key, { - configurable: true, - writable: true, - value, - }); - } - if (previous) previous(key, value); - }; - } - })(function (exporter) { - const hasOwn = Object.prototype.hasOwnProperty; - - // feature test for Symbol support - const supportsSymbol = typeof Symbol === "function"; - const toPrimitiveSymbol = - supportsSymbol && typeof Symbol.toPrimitive !== "undefined" - ? Symbol.toPrimitive - : "@@toPrimitive"; - const iteratorSymbol = - supportsSymbol && typeof Symbol.iterator !== "undefined" - ? Symbol.iterator - : "@@iterator"; - const supportsCreate = typeof Object.create === "function"; // feature test for Object.create support - const supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support - const downLevel = !supportsCreate && !supportsProto; - - const HashMap = { - // create an object in dictionary mode (a.k.a. "slow" mode in v8) - create: supportsCreate - ? () => MakeDictionary(Object.create(null) as HashMap) - : supportsProto - ? () => MakeDictionary({ __proto__: null as any } as HashMap) - : () => MakeDictionary({} as HashMap), - - has: downLevel - ? (map: HashMap, key: string | number | symbol) => - hasOwn.call(map, key) - : (map: HashMap, key: string | number | symbol) => key in map, - - get: downLevel - ? (map: HashMap, key: string | number | symbol): V | undefined => - hasOwn.call(map, key) ? map[key as string | number] : undefined - : (map: HashMap, key: string | number | symbol): V | undefined => - map[key as string | number], - }; - - // Load global or shim versions of Map, Set, and WeakMap - const functionPrototype = Object.getPrototypeOf(Function); - const usePolyfill = typeof process === "object" && - process.env && - process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; - const _Map: typeof Map = !usePolyfill && - typeof Map === "function" && - typeof Map.prototype.entries === "function" - ? Map - : CreateMapPolyfill(); - const _Set: typeof Set = !usePolyfill && - typeof Set === "function" && - typeof Set.prototype.entries === "function" - ? Set - : CreateSetPolyfill(); - const _WeakMap: typeof WeakMap = - !usePolyfill && typeof WeakMap === "function" - ? WeakMap - : CreateWeakMapPolyfill(); - - // [[Metadata]] internal slot - // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots - const Metadata = new _WeakMap< - any, - Map> - >(); - - function decorate(decorators: ClassDecorator[], target: Function): Function; - function decorate( - decorators: (PropertyDecorator | MethodDecorator)[], - target: any, - propertyKey: string | symbol, - attributes?: PropertyDescriptor | null, - ): PropertyDescriptor | undefined; - function decorate( - decorators: (PropertyDecorator | MethodDecorator)[], - target: any, - propertyKey: string | symbol, - attributes: PropertyDescriptor, - ): PropertyDescriptor; - - /** - * Applies a set of decorators to a property of a target object. - * @param decorators An array of decorators. - * @param target The target object. - * @param propertyKey (Optional) The property key to decorate. - * @param attributes (Optional) The property descriptor for the target key. - * @remarks Decorators are applied in reverse order. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * Example = Reflect.decorate(decoratorsArray, Example); - * - * // property (on constructor) - * Reflect.decorate(decoratorsArray, Example, "staticProperty"); - * - * // property (on prototype) - * Reflect.decorate(decoratorsArray, Example.prototype, "property"); - * - * // method (on constructor) - * Object.defineProperty(Example, "staticMethod", - * Reflect.decorate(decoratorsArray, Example, "staticMethod", - * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); - * - * // method (on prototype) - * Object.defineProperty(Example.prototype, "method", - * Reflect.decorate(decoratorsArray, Example.prototype, "method", - * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); - * - */ - function decorate( - decorators: (ClassDecorator | MemberDecorator)[], - target: any, - propertyKey?: string | symbol, - attributes?: PropertyDescriptor | null, - ): PropertyDescriptor | Function | undefined { - if (!IsUndefined(propertyKey)) { - if (!IsArray(decorators)) throw new TypeError(); - if (!IsObject(target)) throw new TypeError(); - if ( - !IsObject(attributes) && - !IsUndefined(attributes) && - !IsNull(attributes) - ) { - throw new TypeError(); - } - if (IsNull(attributes)) attributes = undefined; - propertyKey = ToPropertyKey(propertyKey); - return DecorateProperty( - decorators, - target, - propertyKey, - attributes, - ); - } else { - if (!IsArray(decorators)) throw new TypeError(); - if (!IsConstructor(target)) throw new TypeError(); - return DecorateConstructor( - decorators, - target, - ); - } - } - - exporter("decorate", decorate); - - // 4.1.2 Reflect.metadata(metadataKey, metadataValue) - // https://rbuckton.github.io/reflect-metadata/#reflect.metadata - - /** - * A default metadata decorator factory that can be used on a class, class member, or parameter. - * @param metadataKey The key for the metadata entry. - * @param metadataValue The value for the metadata entry. - * @returns A decorator function. - * @remarks - * If `metadataKey` is already defined for the target and target key, the - * metadataValue for that key will be overwritten. - * @example - * - * // constructor - * @Reflect.metadata(key, value) - * class Example { - * } - * - * // property (on constructor, TypeScript only) - * class Example { - * @Reflect.metadata(key, value) - * static staticProperty; - * } - * - * // property (on prototype, TypeScript only) - * class Example { - * @Reflect.metadata(key, value) - * property; - * } - * - * // method (on constructor) - * class Example { - * @Reflect.metadata(key, value) - * static staticMethod() { } - * } - * - * // method (on prototype) - * class Example { - * @Reflect.metadata(key, value) - * method() { } - * } - * - */ - function metadata(metadataKey: any, metadataValue: any) { - function decorator(target: Function): void; - function decorator(target: any, propertyKey: string | symbol): void; - function decorator(target: any, propertyKey?: string | symbol): void { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) { - throw new TypeError(); - } - OrdinaryDefineOwnMetadata( - metadataKey, - metadataValue, - target, - propertyKey, - ); - } - return decorator; - } - - exporter("metadata", metadata); - - // 4.1.3 Reflect.defineMetadata(metadataKey, metadataValue, target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect.definemetadata - - function defineMetadata( - metadataKey: any, - metadataValue: any, - target: any, - ): void; - function defineMetadata( - metadataKey: any, - metadataValue: any, - target: any, - propertyKey: string | symbol, - ): void; - - /** - * Define a unique metadata entry on the target. - * @param metadataKey A key used to store and retrieve metadata. - * @param metadataValue A value that contains attached metadata. - * @param target The target object on which to define metadata. - * @param propertyKey (Optional) The property key for the target. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * Reflect.defineMetadata("custom:annotation", options, Example); - * - * // property (on constructor) - * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); - * - * // property (on prototype) - * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); - * - * // method (on constructor) - * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); - * - * // method (on prototype) - * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); - * - * // decorator factory as metadata-producing annotation. - * function MyAnnotation(options): Decorator { - * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); - * } - * - */ - function defineMetadata( - metadataKey: any, - metadataValue: any, - target: any, - propertyKey?: string | symbol, - ): void { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - return OrdinaryDefineOwnMetadata( - metadataKey, - metadataValue, - target, - propertyKey, - ); - } - - exporter("defineMetadata", defineMetadata); - - // 4.1.4 Reflect.hasMetadata(metadataKey, target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect.hasmetadata - - function hasMetadata(metadataKey: any, target: any): boolean; - function hasMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): boolean; - - /** - * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.hasMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function hasMetadata( - metadataKey: any, - target: any, - propertyKey?: string | symbol, - ): boolean { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - return OrdinaryHasMetadata(metadataKey, target, propertyKey); - } - - exporter("hasMetadata", hasMetadata); - - // 4.1.5 Reflect.hasOwnMetadata(metadataKey, target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect-hasownmetadata - - function hasOwnMetadata(metadataKey: any, target: any): boolean; - function hasOwnMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): boolean; - - /** - * Gets a value indicating whether the target object has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.hasOwnMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function hasOwnMetadata( - metadataKey: any, - target: any, - propertyKey?: string | symbol, - ): boolean { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); - } - - exporter("hasOwnMetadata", hasOwnMetadata); - - // 4.1.6 Reflect.getMetadata(metadataKey, target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect-getmetadata - - function getMetadata(metadataKey: any, target: any): any; - function getMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): any; - - /** - * Gets the metadata value for the provided metadata key on the target object or its prototype chain. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function getMetadata( - metadataKey: any, - target: any, - propertyKey?: string | symbol, - ): any { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - return OrdinaryGetMetadata(metadataKey, target, propertyKey); - } - - exporter("getMetadata", getMetadata); - - // 4.1.7 Reflect.getOwnMetadata(metadataKey, target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect-getownmetadata - - function getOwnMetadata(metadataKey: any, target: any): any; - function getOwnMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): any; - - /** - * Gets the metadata value for the provided metadata key on the target object. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getOwnMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function getOwnMetadata( - metadataKey: any, - target: any, - propertyKey?: string | symbol, - ): any { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); - } - - exporter("getOwnMetadata", getOwnMetadata); - - // 4.1.8 Reflect.getMetadataKeys(target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect-getmetadatakeys - - function getMetadataKeys(target: any): any[]; - function getMetadataKeys(target: any, propertyKey: string | symbol): any[]; - - /** - * Gets the metadata keys defined on the target object or its prototype chain. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getMetadataKeys(Example); - * - * // property (on constructor) - * result = Reflect.getMetadataKeys(Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadataKeys(Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadataKeys(Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadataKeys(Example.prototype, "method"); - * - */ - function getMetadataKeys( - target: any, - propertyKey?: string | symbol, - ): any[] { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - return OrdinaryMetadataKeys(target, propertyKey); - } - - exporter("getMetadataKeys", getMetadataKeys); - - // 4.1.9 Reflect.getOwnMetadataKeys(target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect-getownmetadata - - function getOwnMetadataKeys(target: any): any[]; - function getOwnMetadataKeys( - target: any, - propertyKey: string | symbol, - ): any[]; - - /** - * Gets the unique metadata keys defined on the target object. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getOwnMetadataKeys(Example); - * - * // property (on constructor) - * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); - * - */ - function getOwnMetadataKeys( - target: any, - propertyKey?: string | symbol, - ): any[] { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - return OrdinaryOwnMetadataKeys(target, propertyKey); - } - - exporter("getOwnMetadataKeys", getOwnMetadataKeys); - - // 4.1.10 Reflect.deleteMetadata(metadataKey, target [, propertyKey]) - // https://rbuckton.github.io/reflect-metadata/#reflect-deletemetadata - - function deleteMetadata(metadataKey: any, target: any): boolean; - function deleteMetadata( - metadataKey: any, - target: any, - propertyKey: string | symbol, - ): boolean; - - /** - * Deletes the metadata entry from the target object with the provided key. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns `true` if the metadata entry was found and deleted; otherwise, false. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.deleteMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function deleteMetadata( - metadataKey: any, - target: any, - propertyKey?: string | symbol, - ): boolean { - if (!IsObject(target)) throw new TypeError(); - if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey); - const metadataMap = GetOrCreateMetadataMap( - target, - propertyKey, - /*Create*/ false, - ); - if (IsUndefined(metadataMap)) return false; - if (!metadataMap.delete(metadataKey)) return false; - if (metadataMap.size > 0) return true; - const targetMetadata = Metadata.get(target); - targetMetadata.delete(propertyKey); - if (targetMetadata.size > 0) return true; - Metadata.delete(target); - return true; - } - - exporter("deleteMetadata", deleteMetadata); - - function DecorateConstructor( - decorators: ClassDecorator[], - target: Function, - ): Function { - for (let i = decorators.length - 1; i >= 0; --i) { - const decorator = decorators[i]; - const decorated = decorator(target); - if (!IsUndefined(decorated) && !IsNull(decorated)) { - if (!IsConstructor(decorated)) throw new TypeError(); - target = decorated; - } - } - return target; - } - - function DecorateProperty( - decorators: MemberDecorator[], - target: any, - propertyKey: string | symbol, - descriptor: PropertyDescriptor | undefined, - ): PropertyDescriptor | undefined { - for (let i = decorators.length - 1; i >= 0; --i) { - const decorator = decorators[i]; - const decorated = decorator(target, propertyKey, descriptor); - if (!IsUndefined(decorated) && !IsNull(decorated)) { - if (!IsObject(decorated)) throw new TypeError(); - descriptor = decorated; - } - } - return descriptor; - } - - // 2.1.1 GetOrCreateMetadataMap(O, P, Create) - // https://rbuckton.github.io/reflect-metadata/#getorcreatemetadatamap - function GetOrCreateMetadataMap( - O: any, - P: string | symbol | undefined, - Create: true, - ): Map; - function GetOrCreateMetadataMap( - O: any, - P: string | symbol | undefined, - Create: false, - ): Map | undefined; - function GetOrCreateMetadataMap( - O: any, - P: string | symbol | undefined, - Create: boolean, - ): Map | undefined { - let targetMetadata = Metadata.get(O); - if (IsUndefined(targetMetadata)) { - if (!Create) return undefined; - targetMetadata = new _Map>(); - Metadata.set(O, targetMetadata); - } - let metadataMap = targetMetadata.get(P); - if (IsUndefined(metadataMap)) { - if (!Create) return undefined; - metadataMap = new _Map(); - targetMetadata.set(P, metadataMap); - } - return metadataMap; - } - - // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata - function OrdinaryHasMetadata( - MetadataKey: any, - O: any, - P: string | symbol | undefined, - ): boolean { - const hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); - if (hasOwn) return true; - const parent = OrdinaryGetPrototypeOf(O); - if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P); - return false; - } - - // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata - function OrdinaryHasOwnMetadata( - MetadataKey: any, - O: any, - P: string | symbol | undefined, - ): boolean { - const metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); - if (IsUndefined(metadataMap)) return false; - return ToBoolean(metadataMap.has(MetadataKey)); - } - - // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata - function OrdinaryGetMetadata( - MetadataKey: any, - O: any, - P: string | symbol | undefined, - ): any { - const hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); - if (hasOwn) return OrdinaryGetOwnMetadata(MetadataKey, O, P); - const parent = OrdinaryGetPrototypeOf(O); - if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P); - return undefined; - } - - // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata - function OrdinaryGetOwnMetadata( - MetadataKey: any, - O: any, - P: string | symbol | undefined, - ): any { - const metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); - if (IsUndefined(metadataMap)) return undefined; - return metadataMap.get(MetadataKey); - } - - // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata - function OrdinaryDefineOwnMetadata( - MetadataKey: any, - MetadataValue: any, - O: any, - P: string | symbol | undefined, - ): void { - const metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); - metadataMap.set(MetadataKey, MetadataValue); - } - - // 3.1.6.1 OrdinaryMetadataKeys(O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys - function OrdinaryMetadataKeys( - O: any, - P: string | symbol | undefined, - ): any[] { - const ownKeys = OrdinaryOwnMetadataKeys(O, P); - const parent = OrdinaryGetPrototypeOf(O); - if (parent === null) return ownKeys; - const parentKeys = OrdinaryMetadataKeys(parent, P); - if (parentKeys.length <= 0) return ownKeys; - if (ownKeys.length <= 0) return parentKeys; - const set = new _Set(); - const keys: any[] = []; - for (const key of ownKeys) { - const hasKey = set.has(key); - if (!hasKey) { - set.add(key); - keys.push(key); - } - } - for (const key of parentKeys) { - const hasKey = set.has(key); - if (!hasKey) { - set.add(key); - keys.push(key); - } - } - return keys; - } - - // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys - function OrdinaryOwnMetadataKeys( - O: any, - P: string | symbol | undefined, - ): any[] { - const keys: any[] = []; - const metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); - if (IsUndefined(metadataMap)) return keys; - const keysObj = metadataMap.keys(); - const iterator = GetIterator(keysObj); - let k = 0; - while (true) { - const next = IteratorStep(iterator); - if (!next) { - keys.length = k; - return keys; - } - const nextValue = IteratorValue(next); - try { - keys[k] = nextValue; - } catch (e) { - try { - IteratorClose(iterator); - } finally { - throw e; - } - } - k++; - } - } - - // 6 ECMAScript Data Typ0es and Values - // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values - function Type(x: any): Tag { - if (x === null) return Tag.Null; - switch (typeof x) { - case "undefined": - return Tag.Undefined; - case "boolean": - return Tag.Boolean; - case "string": - return Tag.String; - case "symbol": - return Tag.Symbol; - case "number": - return Tag.Number; - case "object": - return x === null ? Tag.Null : Tag.Object; - default: - return Tag.Object; - } - } - - // 6.1 ECMAScript Language Types - // https://tc39.github.io/ecma262/#sec-ecmascript-language-types - const enum Tag { - Undefined, - Null, - Boolean, - String, - Symbol, - Number, - Object, - } - - // 6.1.1 The Undefined Type - // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type - function IsUndefined(x: any): x is undefined { - return x === undefined; - } - - // 6.1.2 The Null Type - // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type - function IsNull(x: any): x is null { - return x === null; - } - - // 6.1.5 The Symbol Type - // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type - function IsSymbol(x: any): x is symbol { - return typeof x === "symbol"; - } - - // 6.1.7 The Object Type - // https://tc39.github.io/ecma262/#sec-object-type - function IsObject< - T, - >(x: T | undefined | null | boolean | string | symbol | number): x is T { - return typeof x === "object" ? x !== null : typeof x === "function"; - } - - // 7.1 Type Conversion - // https://tc39.github.io/ecma262/#sec-type-conversion - - // 7.1.1 ToPrimitive(input [, PreferredType]) - // https://tc39.github.io/ecma262/#sec-toprimitive - function ToPrimitive( - input: any, - PreferredType?: Tag, - ): undefined | null | boolean | string | symbol | number { - switch (Type(input)) { - case Tag.Undefined: - return input; - case Tag.Null: - return input; - case Tag.Boolean: - return input; - case Tag.String: - return input; - case Tag.Symbol: - return input; - case Tag.Number: - return input; - } - const hint: "string" | "number" | "default" = PreferredType === Tag.String - ? "string" - : PreferredType === Tag.Number - ? "number" - : "default"; - const exoticToPrim = GetMethod(input, toPrimitiveSymbol); - if (exoticToPrim !== undefined) { - const result = exoticToPrim.call(input, hint); - if (IsObject(result)) throw new TypeError(); - return result; - } - return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); - } - - // 7.1.1.1 OrdinaryToPrimitive(O, hint) - // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive - function OrdinaryToPrimitive( - O: any, - hint: "string" | "number", - ): undefined | null | boolean | string | symbol | number { - if (hint === "string") { - const toString = O.toString; - if (IsCallable(toString)) { - const result = toString.call(O); - if (!IsObject(result)) return result; - } - const valueOf = O.valueOf; - if (IsCallable(valueOf)) { - const result = valueOf.call(O); - if (!IsObject(result)) return result; - } - } else { - const valueOf = O.valueOf; - if (IsCallable(valueOf)) { - const result = valueOf.call(O); - if (!IsObject(result)) return result; - } - const toString = O.toString; - if (IsCallable(toString)) { - const result = toString.call(O); - if (!IsObject(result)) return result; - } - } - throw new TypeError(); - } - - // 7.1.2 ToBoolean(argument) - // https://tc39.github.io/ecma262/2016/#sec-toboolean - function ToBoolean(argument: any): boolean { - return !!argument; - } - - // 7.1.12 ToString(argument) - // https://tc39.github.io/ecma262/#sec-tostring - function ToString(argument: any): string { - return "" + argument; - } - - // 7.1.14 ToPropertyKey(argument) - // https://tc39.github.io/ecma262/#sec-topropertykey - function ToPropertyKey(argument: any): string | symbol { - const key = ToPrimitive(argument, Tag.String); - if (IsSymbol(key)) return key; - return ToString(key); - } - - // 7.2 Testing and Comparison Operations - // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations - - // 7.2.2 IsArray(argument) - // https://tc39.github.io/ecma262/#sec-isarray - function IsArray(argument: any): argument is any[] { - return Array.isArray - ? Array.isArray(argument) - : argument instanceof Object - ? argument instanceof Array - : Object.prototype.toString.call(argument) === "[object Array]"; - } - - // 7.2.3 IsCallable(argument) - // https://tc39.github.io/ecma262/#sec-iscallable - function IsCallable(argument: any): argument is Function { - // NOTE: This is an approximation as we cannot check for [[Call]] internal method. - return typeof argument === "function"; - } - - // 7.2.4 IsConstructor(argument) - // https://tc39.github.io/ecma262/#sec-isconstructor - function IsConstructor(argument: any): argument is Function { - // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. - return typeof argument === "function"; - } - - // 7.2.7 IsPropertyKey(argument) - // https://tc39.github.io/ecma262/#sec-ispropertykey - function IsPropertyKey(argument: any): argument is string | symbol { - switch (Type(argument)) { - case Tag.String: - return true; - case Tag.Symbol: - return true; - default: - return false; - } - } - - // 7.3 Operations on Objects - // https://tc39.github.io/ecma262/#sec-operations-on-objects - - // 7.3.9 GetMethod(V, P) - // https://tc39.github.io/ecma262/#sec-getmethod - function GetMethod(V: any, P: any): Function | undefined { - const func = V[P]; - if (func === undefined || func === null) return undefined; - if (!IsCallable(func)) throw new TypeError(); - return func; - } - - // 7.4 Operations on Iterator Objects - // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects - - function GetIterator(obj: Iterable): Iterator { - const method = GetMethod(obj, iteratorSymbol); - if (!IsCallable(method)) throw new TypeError(); // from Call - const iterator = method.call(obj); - if (!IsObject(iterator)) throw new TypeError(); - return iterator; - } - - // 7.4.4 IteratorValue(iterResult) - // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue - function IteratorValue(iterResult: IteratorResult): T { - return iterResult.value; - } - - // 7.4.5 IteratorStep(iterator) - // https://tc39.github.io/ecma262/#sec-iteratorstep - function IteratorStep(iterator: Iterator): IteratorResult | false { - const result = iterator.next(); - return result.done ? false : result; - } - - // 7.4.6 IteratorClose(iterator, completion) - // https://tc39.github.io/ecma262/#sec-iteratorclose - function IteratorClose(iterator: Iterator) { - const f = iterator["return"]; - if (f) f.call(iterator); - } - - // 9.1 Ordinary Object Internal Methods and Internal Slots - // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots - - // 9.1.1.1 OrdinaryGetPrototypeOf(O) - // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof - function OrdinaryGetPrototypeOf(O: any): any { - const proto = Object.getPrototypeOf(O); - if (typeof O !== "function" || O === functionPrototype) return proto; - - // TypeScript doesn't set __proto__ in ES5, as it's non-standard. - // Try to determine the superclass constructor. Compatible implementations - // must either set __proto__ on a subclass constructor to the superclass constructor, - // or ensure each class has a valid `constructor` property on its prototype that - // points back to the constructor. - - // If this is not the same as Function.[[Prototype]], then this is definately inherited. - // This is the case when in ES6 or when using __proto__ in a compatible browser. - if (proto !== functionPrototype) return proto; - - // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. - const prototype = O.prototype; - const prototypeProto = prototype && Object.getPrototypeOf(prototype); - if (prototypeProto == null || prototypeProto === Object.prototype) { - return proto; - } - - // If the constructor was not a function, then we cannot determine the heritage. - const constructor = prototypeProto.constructor; - if (typeof constructor !== "function") return proto; - - // If we have some kind of self-reference, then we cannot determine the heritage. - if (constructor === O) return proto; - - // we have a pretty good guess at the heritage. - return constructor; - } - - // naive Map shim - function CreateMapPolyfill(): MapConstructor { - const cacheSentinel = {}; - const arraySentinel: any[] = []; - - class MapIterator< - K, - V, - R extends K | V | [K, V], - > implements IterableIterator { - private _keys: K[]; - private _values: V[]; - private _index = 0; - private _selector: (key: K, value: V) => R; - constructor(keys: K[], values: V[], selector: (key: K, value: V) => R) { - this._keys = keys; - this._values = values; - this._selector = selector; - } - "@@iterator"() { - return this; - } - [iteratorSymbol]() { - return this; - } - next(): IteratorResult { - const index = this._index; - if (index >= 0 && index < this._keys.length) { - const result = this._selector( - this._keys[index], - this._values[index], - ); - if (index + 1 >= this._keys.length) { - this._index = -1; - this._keys = arraySentinel; - this._values = arraySentinel; - } else { - this._index++; - } - return { value: result, done: false }; - } - return { value: undefined, done: true }; - } - throw(error: any): IteratorResult { - if (this._index >= 0) { - this._index = -1; - this._keys = arraySentinel; - this._values = arraySentinel; - } - throw error; - } - return(value?: R): IteratorResult { - if (this._index >= 0) { - this._index = -1; - this._keys = arraySentinel; - this._values = arraySentinel; - } - return { value: value, done: true }; - } - } - - return class Map { - private _keys: K[] = []; - private _values: (V | undefined)[] = []; - private _cacheKey = cacheSentinel; - private _cacheIndex = -2; - get size() { - return this._keys.length; - } - has(key: K): boolean { - return this._find(key, /*insert*/ false) >= 0; - } - get(key: K): V | undefined { - const index = this._find(key, /*insert*/ false); - return index >= 0 ? this._values[index] : undefined; - } - set(key: K, value: V): this { - const index = this._find(key, /*insert*/ true); - this._values[index] = value; - return this; - } - delete(key: K): boolean { - const index = this._find(key, /*insert*/ false); - if (index >= 0) { - const size = this._keys.length; - for (let i = index + 1; i < size; i++) { - this._keys[i - 1] = this._keys[i]; - this._values[i - 1] = this._values[i]; - } - this._keys.length--; - this._values.length--; - if (key === this._cacheKey) { - this._cacheKey = cacheSentinel; - this._cacheIndex = -2; - } - return true; - } - return false; - } - clear(): void { - this._keys.length = 0; - this._values.length = 0; - this._cacheKey = cacheSentinel; - this._cacheIndex = -2; - } - keys() { - return new MapIterator(this._keys, this._values, getKey); - } - values() { - return new MapIterator(this._keys, this._values, getValue); - } - entries() { - return new MapIterator(this._keys, this._values, getEntry); - } - "@@iterator"() { - return this.entries(); - } - [iteratorSymbol]() { - return this.entries(); - } - private _find(key: K, insert?: boolean): number { - if (this._cacheKey !== key) { - this._cacheIndex = this._keys.indexOf((this._cacheKey = key)); - } - if (this._cacheIndex < 0 && insert) { - this._cacheIndex = this._keys.length; - this._keys.push(key); - this._values.push(undefined); - } - return this._cacheIndex; - } - }; - - function getKey(key: K, _: V) { - return key; - } - - function getValue(_: K, value: V) { - return value; - } - - function getEntry(key: K, value: V) { - return [key, value] as [K, V]; - } - } - - // naive Set shim - function CreateSetPolyfill(): SetConstructor { - return class Set { - private _map = new _Map(); - get size() { - return this._map.size; - } - has(value: T): boolean { - return this._map.has(value); - } - add(value: T): Set { - return this._map.set(value, value), this; - } - delete(value: T): boolean { - return this._map.delete(value); - } - clear(): void { - this._map.clear(); - } - keys() { - return this._map.keys(); - } - values() { - return this._map.values(); - } - entries() { - return this._map.entries(); - } - "@@iterator"() { - return this.keys(); - } - [iteratorSymbol]() { - return this.keys(); - } - }; - } - - // naive WeakMap shim - function CreateWeakMapPolyfill(): WeakMapConstructor { - const UUID_SIZE = 16; - const keys = HashMap.create(); - const rootKey = CreateUniqueKey(); - return class WeakMap { - private _key = CreateUniqueKey(); - has(target: K): boolean { - const table = GetOrCreateWeakMapTable(target, /*create*/ false); - return table !== undefined ? HashMap.has(table, this._key) : false; - } - get(target: K): V { - const table = GetOrCreateWeakMapTable(target, /*create*/ false); - return table !== undefined - ? HashMap.get(table, this._key) - : undefined; - } - set(target: K, value: V): WeakMap { - const table = GetOrCreateWeakMapTable(target, /*create*/ true); - table[this._key] = value; - return this; - } - delete(target: K): boolean { - const table = GetOrCreateWeakMapTable(target, /*create*/ false); - return table !== undefined ? delete table[this._key] : false; - } - clear(): void { - // NOTE: not a real clear, just makes the previous data unreachable - this._key = CreateUniqueKey(); - } - }; - - function CreateUniqueKey(): string { - let key: string; - do key = "@@WeakMap@@" + CreateUUID(); while (HashMap.has(keys, key)); - keys[key] = true; - return key; - } - - function GetOrCreateWeakMapTable< - K, - >(target: K, create: true): HashMap; - function GetOrCreateWeakMapTable< - K, - >(target: K, create: false): HashMap | undefined; - function GetOrCreateWeakMapTable< - K, - >(target: K, create: boolean): HashMap | undefined { - if (!hasOwn.call(target, rootKey)) { - if (!create) return undefined; - Object.defineProperty(target, rootKey, { - value: HashMap.create(), - }); - } - return ( target)[rootKey]; - } - - function FillRandomBytes(buffer: BufferLike, size: number): BufferLike { - for (let i = 0; i < size; ++i) buffer[i] = (Math.random() * 0xff) | 0; - return buffer; - } - - function GenRandomBytes(size: number): BufferLike { - if (typeof Uint8Array === "function") { - if (typeof crypto !== "undefined") { - return crypto.getRandomValues(new Uint8Array(size)) as Uint8Array; - } - if (typeof msCrypto !== "undefined") { - return msCrypto.getRandomValues(new Uint8Array(size)) as Uint8Array; - } - return FillRandomBytes(new Uint8Array(size), size); - } - return FillRandomBytes(new Array(size), size); - } - - function CreateUUID() { - const data = GenRandomBytes(UUID_SIZE); - // mark as random - RFC 4122 § 4.4 - data[6] = (data[6] & 0x4f) | 0x40; - data[8] = (data[8] & 0xbf) | 0x80; - let result = ""; - for (let offset = 0; offset < UUID_SIZE; ++offset) { - const byte = data[offset]; - if (offset === 4 || offset === 6 || offset === 8) result += "-"; - if (byte < 16) result += "0"; - result += byte.toString(16).toLowerCase(); - } - return result; - } - } - - // uses a heuristic used by v8 and chakra to force an object into dictionary mode. - function MakeDictionary(obj: T): T { - ( obj).__ = undefined; - delete ( obj).__; - return obj; - } - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/18ff653ba0ac6b88cd88d5d70d343792704a10d1.ts b/crates/swc_bundler/tests/.cache/deno/18ff653ba0ac6b88cd88d5d70d343792704a10d1.ts deleted file mode 100644 index 4d200306b020..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/18ff653ba0ac6b88cd88d5d70d343792704a10d1.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_xfBase.js - - -export default { - init: function() { - return this.xf['@@transducer/init'](); - }, - result: function(result) { - return this.xf['@@transducer/result'](result); - } -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1916719c6dbd64f6dba5c8f871f8d0a314b02f78.ts b/crates/swc_bundler/tests/.cache/deno/1916719c6dbd64f6dba5c8f871f8d0a314b02f78.ts deleted file mode 100644 index 73ef50af3fb5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1916719c6dbd64f6dba5c8f871f8d0a314b02f78.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Loaded from https://deno.land/x/oak/negotiation/common.ts - - -/*! - * Adapted directly from negotiator at https://github.com/jshttp/negotiator/ - * which is licensed as follows: - * - * (The MIT License) - * - * Copyright (c) 2012-2014 Federico Romero - * Copyright (c) 2012-2014 Isaac Z. Schlueter - * Copyright (c) 2014-2015 Douglas Christopher Wilson - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * 'Software'), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -export interface Specificity { - i: number; - o?: number; - q: number; - s?: number; -} - -export function compareSpecs(a: Specificity, b: Specificity): number { - return ( - b.q - a.q || - (b.s ?? 0) - (a.s ?? 0) || - (a.o ?? 0) - (b.o ?? 0) || - a.i - b.i || - 0 - ); -} - -export function isQuality(spec: Specificity): boolean { - return spec.q > 0; -} diff --git a/crates/swc_bundler/tests/.cache/deno/191cb7caa77b14c55b007dcaf9296bc5b4b0f414.ts b/crates/swc_bundler/tests/.cache/deno/191cb7caa77b14c55b007dcaf9296bc5b4b0f414.ts deleted file mode 100644 index ee076589d0b8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/191cb7caa77b14c55b007dcaf9296bc5b4b0f414.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/ws/start_gateway.ts - - -import { DiscordGatewayIntents } from "../types/gateway/gateway_intents.ts"; -import type { GetGatewayBot } from "../types/gateway/get_gateway_bot.ts"; -import { camelize } from "../util/utils.ts"; -import { StartGatewayOptions } from "./start_gateway_options.ts"; -import { ws } from "./ws.ts"; - -/** ADVANCED DEVS ONLY!!!!!! - * Starts the standalone gateway. - * This will require starting the bot separately. - */ -export async function startGateway(options: StartGatewayOptions) { - ws.identifyPayload.token = `Bot ${options.token}`; - ws.secretKey = options.secretKey; - ws.firstShardId = options.firstShardId; - ws.url = options.url; - if (options.shardsPerCluster) ws.shardsPerCluster = options.shardsPerCluster; - if (options.maxClusters) ws.maxClusters = options.maxClusters; - - if (options.compress) { - ws.identifyPayload.compress = options.compress; - } - if (options.reshard) ws.reshard = options.reshard; - // Once an hour check if resharding is necessary - setInterval(ws.resharder, 1000 * 60 * 60); - - ws.identifyPayload.intents = options.intents.reduce( - (bits, next) => (bits |= typeof next === "string" ? DiscordGatewayIntents[next] : next), - 0 - ); - - ws.botGatewayData = camelize( - await fetch(`https://discord.com/api/gateway/bot`, { - headers: { Authorization: ws.identifyPayload.token }, - }).then((res) => res.json()) - ) as GetGatewayBot; - - ws.maxShards = options.maxShards || ws.botGatewayData.shards; - ws.lastShardId = options.lastShardId || ws.botGatewayData.shards - 1; - - ws.spawnShards(ws.firstShardId); - await ws.cleanupLoadingShards(); -} diff --git a/crates/swc_bundler/tests/.cache/deno/192c5b519e340a39c42e9ba7cc5cdbf2196278e6.ts b/crates/swc_bundler/tests/.cache/deno/192c5b519e340a39c42e9ba7cc5cdbf2196278e6.ts deleted file mode 100644 index 9c74c1ddf902..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/192c5b519e340a39c42e9ba7cc5cdbf2196278e6.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Loaded from https://deno.land/x/validasaur/src/rules/date_after.ts - - -import type { Validity, Rule } from "../types.ts"; -import { clearTimes, dateChecks } from "../utils.ts"; - -export function dateAfter(date: Date): Rule { - return function dateAfterRule(value: any): Validity { - return dateChecks(value, "dateAfter", { date }, (input: Date): boolean => { - return clearTimes(input).getTime() > clearTimes(date).getTime(); - }); - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1947e42aaa95bc1bb5765186b1ca87d18a859e4c.ts b/crates/swc_bundler/tests/.cache/deno/1947e42aaa95bc1bb5765186b1ca87d18a859e4c.ts deleted file mode 100644 index e41d7e51c4d1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1947e42aaa95bc1bb5765186b1ca87d18a859e4c.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/case/lowerFirstCase.ts - - -import lowerCase from "./lowerCase.ts"; - -export default function (str: string, locale?: string): string { - if (str == null) { - return ""; - } - - str = String(str); - - return lowerCase(str.charAt(0), locale) + str.substr(1); -} diff --git a/crates/swc_bundler/tests/.cache/deno/197458d0a975f158097ae5c3f29fb1a5bdd76ff1.ts b/crates/swc_bundler/tests/.cache/deno/197458d0a975f158097ae5c3f29fb1a5bdd76ff1.ts deleted file mode 100644 index 9f9ea0574a86..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/197458d0a975f158097ae5c3f29fb1a5bdd76ff1.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/head.js - - -import nth from './nth.js'; - - -/** - * Returns the first element of the given list or string. In some libraries - * this function is named `first`. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig [a] -> a | Undefined - * @sig String -> String - * @param {Array|String} list - * @return {*} - * @see R.tail, R.init, R.last - * @example - * - * R.head(['fi', 'fo', 'fum']); //=> 'fi' - * R.head([]); //=> undefined - * - * R.head('abc'); //=> 'a' - * R.head(''); //=> '' - */ -var head = nth(0); -export default head; diff --git a/crates/swc_bundler/tests/.cache/deno/198351dccca6a94f567522a91e138fc20de08034.ts b/crates/swc_bundler/tests/.cache/deno/198351dccca6a94f567522a91e138fc20de08034.ts deleted file mode 100644 index 5234002d1750..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/198351dccca6a94f567522a91e138fc20de08034.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/x/sqlite@v2.3.1/mod.ts - - -export { DB } from "./src/db.ts"; -export { Empty } from "./src/rows.ts"; -export { Status } from "./src/constants.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/19a74b46907399a12d5e04a3088c26f2671f5272.ts b/crates/swc_bundler/tests/.cache/deno/19a74b46907399a12d5e04a3088c26f2671f5272.ts deleted file mode 100644 index 13cc1204e09c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/19a74b46907399a12d5e04a3088c26f2671f5272.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/propIs.js - - -import _curry3 from './internal/_curry3.js'; -import prop from './prop.js'; -import is from './is.js'; - - -/** - * Returns `true` if the specified object property is of the given type; - * `false` otherwise. - * - * @func - * @memberOf R - * @since v0.16.0 - * @category Type - * @sig Type -> String -> Object -> Boolean - * @param {Function} type - * @param {String} name - * @param {*} obj - * @return {Boolean} - * @see R.is, R.propSatisfies - * @example - * - * R.propIs(Number, 'x', {x: 1, y: 2}); //=> true - * R.propIs(Number, 'x', {x: 'foo'}); //=> false - * R.propIs(Number, 'x', {}); //=> false - */ -var propIs = _curry3(function propIs(type, name, obj) { - return is(type, prop(name, obj)); -}); -export default propIs; diff --git a/crates/swc_bundler/tests/.cache/deno/19f113629702d39e47def952114549a15a93cd55.ts b/crates/swc_bundler/tests/.cache/deno/19f113629702d39e47def952114549a15a93cd55.ts deleted file mode 100644 index c670614a5a9c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/19f113629702d39e47def952114549a15a93cd55.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/chain.js - - -import _curry2 from './internal/_curry2.js'; -import _dispatchable from './internal/_dispatchable.js'; -import _makeFlat from './internal/_makeFlat.js'; -import _xchain from './internal/_xchain.js'; -import map from './map.js'; - - -/** - * `chain` maps a function over a list and concatenates the results. `chain` - * is also known as `flatMap` in some libraries. - * - * Dispatches to the `chain` method of the second argument, if present, - * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain). - * - * If second argument is a function, `chain(f, g)(x)` is equivalent to `f(g(x), x)`. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.3.0 - * @category List - * @sig Chain m => (a -> m b) -> m a -> m b - * @param {Function} fn The function to map with - * @param {Array} list The list to map over - * @return {Array} The result of flat-mapping `list` with `fn` - * @example - * - * const duplicate = n => [n, n]; - * R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] - * - * R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] - */ -var chain = _curry2(_dispatchable(['fantasy-land/chain', 'chain'], _xchain, function chain(fn, monad) { - if (typeof monad === 'function') { - return function(x) { return fn(monad(x))(x); }; - } - return _makeFlat(false)(map(fn, monad)); -})); -export default chain; diff --git a/crates/swc_bundler/tests/.cache/deno/1a02906df54de8682a94e81ec030c5e1748c9c8e.ts b/crates/swc_bundler/tests/.cache/deno/1a02906df54de8682a94e81ec030c5e1748c9c8e.ts deleted file mode 100644 index 4e263b48c1cf..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a02906df54de8682a94e81ec030c5e1748c9c8e.ts +++ /dev/null @@ -1,507 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/path/posix.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. - -import type { FormatInputPathObject, ParsedPath } from "./_interface.ts"; -import { CHAR_DOT, CHAR_FORWARD_SLASH } from "./_constants.ts"; - -import { - _format, - assertPath, - isPosixPathSeparator, - normalizeString, -} from "./_util.ts"; - -export const sep = "/"; -export const delimiter = ":"; - -// path.resolve([from ...], to) -/** - * Resolves `pathSegments` into an absolute path. - * @param pathSegments an array of path segments - */ -export function resolve(...pathSegments: string[]): string { - let resolvedPath = ""; - let resolvedAbsolute = false; - - for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - let path: string; - - if (i >= 0) path = pathSegments[i]; - else { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a relative path without a CWD."); - } - path = Deno.cwd(); - } - - assertPath(path); - - // Skip empty entries - if (path.length === 0) { - continue; - } - - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeString( - resolvedPath, - !resolvedAbsolute, - "/", - isPosixPathSeparator, - ); - - if (resolvedAbsolute) { - if (resolvedPath.length > 0) return `/${resolvedPath}`; - else return "/"; - } else if (resolvedPath.length > 0) return resolvedPath; - else return "."; -} - -/** - * Normalize the `path`, resolving `'..'` and `'.'` segments. - * @param path to be normalized - */ -export function normalize(path: string): string { - assertPath(path); - - if (path.length === 0) return "."; - - const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - const trailingSeparator = - path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH; - - // Normalize the path - path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator); - - if (path.length === 0 && !isAbsolute) path = "."; - if (path.length > 0 && trailingSeparator) path += "/"; - - if (isAbsolute) return `/${path}`; - return path; -} - -/** - * Verifies whether provided path is absolute - * @param path to be verified as absolute - */ -export function isAbsolute(path: string): boolean { - assertPath(path); - return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH; -} - -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * @param paths to be joined and normalized - */ -export function join(...paths: string[]): string { - if (paths.length === 0) return "."; - let joined: string | undefined; - for (let i = 0, len = paths.length; i < len; ++i) { - const path = paths[i]; - assertPath(path); - if (path.length > 0) { - if (!joined) joined = path; - else joined += `/${path}`; - } - } - if (!joined) return "."; - return normalize(joined); -} - -/** - * Return the relative path from `from` to `to` based on current working directory. - * @param from path in current working directory - * @param to path in current working directory - */ -export function relative(from: string, to: string): string { - assertPath(from); - assertPath(to); - - if (from === to) return ""; - - from = resolve(from); - to = resolve(to); - - if (from === to) return ""; - - // Trim any leading backslashes - let fromStart = 1; - const fromEnd = from.length; - for (; fromStart < fromEnd; ++fromStart) { - if (from.charCodeAt(fromStart) !== CHAR_FORWARD_SLASH) break; - } - const fromLen = fromEnd - fromStart; - - // Trim any leading backslashes - let toStart = 1; - const toEnd = to.length; - for (; toStart < toEnd; ++toStart) { - if (to.charCodeAt(toStart) !== CHAR_FORWARD_SLASH) break; - } - const toLen = toEnd - toStart; - - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for (; i <= length; ++i) { - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) { - // We get here if `from` is the exact base path for `to`. - // For example: from='/foo/bar'; to='/foo/bar/baz' - return to.slice(toStart + i + 1); - } else if (i === 0) { - // We get here if `from` is the root - // For example: from='/'; to='/foo' - return to.slice(toStart + i); - } - } else if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) { - // We get here if `to` is the exact base path for `from`. - // For example: from='/foo/bar/baz'; to='/foo/bar' - lastCommonSep = i; - } else if (i === 0) { - // We get here if `to` is the root. - // For example: from='/foo'; to='/' - lastCommonSep = 0; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (fromCode === CHAR_FORWARD_SLASH) lastCommonSep = i; - } - - let out = ""; - // Generate the relative path based on the path difference between `to` - // and `from` - for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { - if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) { - if (out.length === 0) out += ".."; - else out += "/.."; - } - } - - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) return out + to.slice(toStart + lastCommonSep); - else { - toStart += lastCommonSep; - if (to.charCodeAt(toStart) === CHAR_FORWARD_SLASH) ++toStart; - return to.slice(toStart); - } -} - -/** - * Resolves path to a namespace path - * @param path to resolve to namespace - */ -export function toNamespacedPath(path: string): string { - // Non-op on posix systems - return path; -} - -/** - * Return the directory name of a `path`. - * @param path to determine name for - */ -export function dirname(path: string): string { - assertPath(path); - if (path.length === 0) return "."; - const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - let end = -1; - let matchedSlash = true; - for (let i = path.length - 1; i >= 1; --i) { - if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) return hasRoot ? "/" : "."; - if (hasRoot && end === 1) return "//"; - return path.slice(0, end); -} - -/** - * Return the last portion of a `path`. Trailing directory separators are ignored. - * @param path to process - * @param ext of path directory - */ -export function basename(path: string, ext = ""): string { - if (ext !== undefined && typeof ext !== "string") { - throw new TypeError('"ext" argument must be a string'); - } - assertPath(path); - - let start = 0; - let end = -1; - let matchedSlash = true; - let i: number; - - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { - if (ext.length === path.length && ext === path) return ""; - let extIdx = ext.length - 1; - let firstNonSlashEnd = -1; - for (i = path.length - 1; i >= 0; --i) { - const code = path.charCodeAt(i); - if (code === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else { - if (firstNonSlashEnd === -1) { - // We saw the first non-path separator, remember this index in case - // we need it if the extension ends up not matching - matchedSlash = false; - firstNonSlashEnd = i + 1; - } - if (extIdx >= 0) { - // Try to match the explicit extension - if (code === ext.charCodeAt(extIdx)) { - if (--extIdx === -1) { - // We matched the extension, so mark this as the end of our path - // component - end = i; - } - } else { - // Extension does not match, so our result is the entire path - // component - extIdx = -1; - end = firstNonSlashEnd; - } - } - } - } - - if (start === end) end = firstNonSlashEnd; - else if (end === -1) end = path.length; - return path.slice(start, end); - } else { - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ""; - return path.slice(start, end); - } -} - -/** - * Return the extension of the `path`. - * @param path with extension - */ -export function extname(path: string): string { - assertPath(path); - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - for (let i = path.length - 1; i >= 0; --i) { - const code = path.charCodeAt(i); - if (code === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - return ""; - } - return path.slice(startDot, end); -} - -/** - * Generate a path from `FormatInputPathObject` object. - * @param pathObject with path - */ -export function format(pathObject: FormatInputPathObject): string { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError( - `The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`, - ); - } - return _format("/", pathObject); -} - -/** - * Return a `ParsedPath` object of the `path`. - * @param path to process - */ -export function parse(path: string): ParsedPath { - assertPath(path); - - const ret: ParsedPath = { root: "", dir: "", base: "", ext: "", name: "" }; - if (path.length === 0) return ret; - const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - let start: number; - if (isAbsolute) { - ret.root = "/"; - start = 1; - } else { - start = 0; - } - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Get non-dir info - for (; i >= start; --i) { - const code = path.charCodeAt(i); - if (code === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - if (end !== -1) { - if (startPart === 0 && isAbsolute) { - ret.base = ret.name = path.slice(1, end); - } else { - ret.base = ret.name = path.slice(startPart, end); - } - } - } else { - if (startPart === 0 && isAbsolute) { - ret.name = path.slice(1, startDot); - ret.base = path.slice(1, end); - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - } - ret.ext = path.slice(startDot, end); - } - - if (startPart > 0) ret.dir = path.slice(0, startPart - 1); - else if (isAbsolute) ret.dir = "/"; - - return ret; -} - -/** - * Converts a file URL to a path string. - * - * fromFileUrl("file:///home/foo"); // "/home/foo" - * @param url of a file URL - */ -export function fromFileUrl(url: string | URL): string { - url = url instanceof URL ? url : new URL(url); - if (url.protocol != "file:") { - throw new TypeError("Must be a file URL."); - } - return decodeURIComponent( - url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"), - ); -} - -/** - * Converts a path string to a file URL. - * - * toFileUrl("/home/foo"); // new URL("file:///home/foo") - * @param path to convert to file URL - */ -export function toFileUrl(path: string): URL { - if (!isAbsolute(path)) { - throw new TypeError("Must be an absolute path."); - } - const url = new URL("file:///"); - url.pathname = path.replace(/%/g, "%25").replace(/\\/g, "%5C"); - return url; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1a07e5284bbaeeac02c1ad71f6d5ceafbae383a5.ts b/crates/swc_bundler/tests/.cache/deno/1a07e5284bbaeeac02c1ad71f6d5ceafbae383a5.ts deleted file mode 100644 index 47fd7ef631c0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a07e5284bbaeeac02c1ad71f6d5ceafbae383a5.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/commands/APPLICATION_COMMAND_UPDATE.ts - - -import { eventHandlers } from "../../bot.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { ApplicationCommandCreateUpdateDelete } from "../../types/interactions/commands/application_command_create_update_delete.ts"; - -export function handleApplicationCommandUpdate(data: DiscordGatewayPayload) { - eventHandlers.applicationCommandUpdate?.(data.d as ApplicationCommandCreateUpdateDelete); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1a53b55b41069a12c154eb051f25deb05f797b90.ts b/crates/swc_bundler/tests/.cache/deno/1a53b55b41069a12c154eb051f25deb05f797b90.ts deleted file mode 100644 index 6896adcd404b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a53b55b41069a12c154eb051f25deb05f797b90.ts +++ /dev/null @@ -1,81 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isRFC3339.ts - - -/* Based on https://tools.ietf.org/html/rfc3339#section-5.6 */ - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * @ignore - */ -const dateFullYear = /[0-9]{4}/; - -/** - * @ignore - */ -const dateMonth = /(0[1-9]|1[0-2])/; - -/** - * @ignore - */ -const dateMDay = /([12]\d|0[1-9]|3[01])/; - -/** - * @ignore - */ -const timeHour = /([01][0-9]|2[0-3])/; - -/** - * @ignore - */ -const timeMinute = /[0-5][0-9]/; - -/** - * @ignore - */ -const timeSecond = /([0-5][0-9]|60)/; - -/** - * @ignore - */ -const timeSecFrac = /(\.[0-9]+)?/; - -/** - * @ignore - */ -const timeNumOffset = new RegExp(`[-+]${timeHour.source}:${timeMinute.source}`); - -/** - * @ignore - */ -const timeOffset = new RegExp(`([zZ]|${timeNumOffset.source})`); - -/** - * @ignore - */ -const partialTime = new RegExp( - `${timeHour.source}:${timeMinute.source}:${timeSecond.source}${timeSecFrac.source}` -); - -/** - * @ignore - */ -const fullDate = new RegExp( - `${dateFullYear.source}-${dateMonth.source}-${dateMDay.source}` -); - -/** - * @ignore - */ -const fullTime = new RegExp(`${partialTime.source}${timeOffset.source}`); - -/** - * @ignore - */ -const rfc3339 = new RegExp(`${fullDate.source}[ tT]${fullTime.source}`); - -export const isRFC3339 = (str: string) => { - assertString(str); - return rfc3339.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1a5b9ab371d52f951f291f13fe96c23ebab22c2f.ts b/crates/swc_bundler/tests/.cache/deno/1a5b9ab371d52f951f291f13fe96c23ebab22c2f.ts deleted file mode 100644 index 9fd08c4bfd24..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a5b9ab371d52f951f291f13fe96c23ebab22c2f.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/sortWith.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Sorts a list according to a list of comparators. - * - * @func - * @memberOf R - * @since v0.23.0 - * @category Relation - * @sig [(a, a) -> Number] -> [a] -> [a] - * @param {Array} functions A list of comparator functions. - * @param {Array} list The list to sort. - * @return {Array} A new list sorted according to the comarator functions. - * @see R.ascend, R.descend - * @example - * - * const alice = { - * name: 'alice', - * age: 40 - * }; - * const bob = { - * name: 'bob', - * age: 30 - * }; - * const clara = { - * name: 'clara', - * age: 40 - * }; - * const people = [clara, bob, alice]; - * const ageNameSort = R.sortWith([ - * R.descend(R.prop('age')), - * R.ascend(R.prop('name')) - * ]); - * ageNameSort(people); //=> [alice, clara, bob] - */ -var sortWith = _curry2(function sortWith(fns, list) { - return Array.prototype.slice.call(list, 0).sort(function(a, b) { - var result = 0; - var i = 0; - while (result === 0 && i < fns.length) { - result = fns[i](a, b); - i += 1; - } - return result; - }); -}); -export default sortWith; diff --git a/crates/swc_bundler/tests/.cache/deno/1a60eafc82d4d7ac8ae2352f7ca7699df8de3f20.ts b/crates/swc_bundler/tests/.cache/deno/1a60eafc82d4d7ac8ae2352f7ca7699df8de3f20.ts deleted file mode 100644 index 8090cd4b6a54..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a60eafc82d4d7ac8ae2352f7ca7699df8de3f20.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/paths.js - - -import _curry2 from './internal/_curry2.js'; -import _isInteger from './internal/_isInteger.js'; -import nth from './nth.js'; - -/** - * Retrieves the values at given paths of an object. - * - * @func - * @memberOf R - * @since v0.27.1 - * @category Object - * @typedefn Idx = [String | Int | Symbol] - * @sig [Idx] -> {a} -> [a | Undefined] - * @param {Array} pathsArray The array of paths to be fetched. - * @param {Object} obj The object to retrieve the nested properties from. - * @return {Array} A list consisting of values at paths specified by "pathsArray". - * @see R.path - * @example - * - * R.paths([['a', 'b'], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, 3] - * R.paths([['a', 'b'], ['p', 'r']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, undefined] - */ -var paths = _curry2(function paths(pathsArray, obj) { - return pathsArray.map(function(paths) { - var val = obj; - var idx = 0; - var p; - while (idx < paths.length) { - if (val == null) { - return; - } - p = paths[idx]; - val = _isInteger(p) ? nth(p, val) : val[p]; - idx += 1; - } - return val; - }); -}); -export default paths; diff --git a/crates/swc_bundler/tests/.cache/deno/1a72cbd07cabb6706884b35e157486cd37ea8ec5.ts b/crates/swc_bundler/tests/.cache/deno/1a72cbd07cabb6706884b35e157486cd37ea8ec5.ts deleted file mode 100644 index f0b1ad3de590..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a72cbd07cabb6706884b35e157486cd37ea8ec5.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Loaded from https://deno.land/std/uuid/_common.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -/** - * Converts the byte array to a UUID string - * @param bytes Used to convert Byte to Hex - */ -export function bytesToUuid(bytes: number[] | Uint8Array): string { - const bits = [...bytes].map((bit) => { - const s = bit.toString(16); - return bit < 0x10 ? "0" + s : s; - }); - return [ - ...bits.slice(0, 4), - "-", - ...bits.slice(4, 6), - "-", - ...bits.slice(6, 8), - "-", - ...bits.slice(8, 10), - "-", - ...bits.slice(10, 16), - ].join(""); -} - -/** - * Converts a string to a byte array by converting the hex value to a number. - * @param uuid Value that gets converted. - */ -export function uuidToBytes(uuid: string): number[] { - const bytes: number[] = []; - - uuid.replace(/[a-fA-F0-9]{2}/g, (hex: string): string => { - bytes.push(parseInt(hex, 16)); - return ""; - }); - - return bytes; -} - -/** - * Converts a string to a byte array using the char code. - * @param str Value that gets converted. - */ -export function stringToBytes(str: string): number[] { - str = unescape(encodeURIComponent(str)); - const bytes = new Array(str.length); - for (let i = 0; i < str.length; i++) { - bytes[i] = str.charCodeAt(i); - } - return bytes; -} - -/** - * Creates a buffer for creating a SHA-1 hash. - * @param content Buffer for SHA-1 hash. - */ -export function createBuffer(content: number[]): ArrayBuffer { - const arrayBuffer = new ArrayBuffer(content.length); - const uint8Array = new Uint8Array(arrayBuffer); - for (let i = 0; i < content.length; i++) { - uint8Array[i] = content[i]; - } - return arrayBuffer; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1a822049d3ad75c35f7b9c06d0bcb3d20879b360.ts b/crates/swc_bundler/tests/.cache/deno/1a822049d3ad75c35f7b9c06d0bcb3d20879b360.ts deleted file mode 100644 index 2becdc1860e2..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a822049d3ad75c35f7b9c06d0bcb3d20879b360.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Loaded from https://deno.land/std@0.93.0/path/_constants.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. - -// Alphabet chars. -export const CHAR_UPPERCASE_A = 65; /* A */ -export const CHAR_LOWERCASE_A = 97; /* a */ -export const CHAR_UPPERCASE_Z = 90; /* Z */ -export const CHAR_LOWERCASE_Z = 122; /* z */ - -// Non-alphabetic chars. -export const CHAR_DOT = 46; /* . */ -export const CHAR_FORWARD_SLASH = 47; /* / */ -export const CHAR_BACKWARD_SLASH = 92; /* \ */ -export const CHAR_VERTICAL_LINE = 124; /* | */ -export const CHAR_COLON = 58; /* : */ -export const CHAR_QUESTION_MARK = 63; /* ? */ -export const CHAR_UNDERSCORE = 95; /* _ */ -export const CHAR_LINE_FEED = 10; /* \n */ -export const CHAR_CARRIAGE_RETURN = 13; /* \r */ -export const CHAR_TAB = 9; /* \t */ -export const CHAR_FORM_FEED = 12; /* \f */ -export const CHAR_EXCLAMATION_MARK = 33; /* ! */ -export const CHAR_HASH = 35; /* # */ -export const CHAR_SPACE = 32; /* */ -export const CHAR_NO_BREAK_SPACE = 160; /* \u00A0 */ -export const CHAR_ZERO_WIDTH_NOBREAK_SPACE = 65279; /* \uFEFF */ -export const CHAR_LEFT_SQUARE_BRACKET = 91; /* [ */ -export const CHAR_RIGHT_SQUARE_BRACKET = 93; /* ] */ -export const CHAR_LEFT_ANGLE_BRACKET = 60; /* < */ -export const CHAR_RIGHT_ANGLE_BRACKET = 62; /* > */ -export const CHAR_LEFT_CURLY_BRACKET = 123; /* { */ -export const CHAR_RIGHT_CURLY_BRACKET = 125; /* } */ -export const CHAR_HYPHEN_MINUS = 45; /* - */ -export const CHAR_PLUS = 43; /* + */ -export const CHAR_DOUBLE_QUOTE = 34; /* " */ -export const CHAR_SINGLE_QUOTE = 39; /* ' */ -export const CHAR_PERCENT = 37; /* % */ -export const CHAR_SEMICOLON = 59; /* ; */ -export const CHAR_CIRCUMFLEX_ACCENT = 94; /* ^ */ -export const CHAR_GRAVE_ACCENT = 96; /* ` */ -export const CHAR_AT = 64; /* @ */ -export const CHAR_AMPERSAND = 38; /* & */ -export const CHAR_EQUAL = 61; /* = */ - -// Digits -export const CHAR_0 = 48; /* 0 */ -export const CHAR_9 = 57; /* 9 */ diff --git a/crates/swc_bundler/tests/.cache/deno/1a961bff3c46f42c2f242228b25667e674f87baa.ts b/crates/swc_bundler/tests/.cache/deno/1a961bff3c46f42c2f242228b25667e674f87baa.ts deleted file mode 100644 index 44b1818b376c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1a961bff3c46f42c2f242228b25667e674f87baa.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/ProvidedRequiredArgumentsRule.js - - -import inspect from '../../jsutils/inspect.js'; -import keyMap from '../../jsutils/keyMap.js'; -import { GraphQLError } from '../../error/GraphQLError.js'; -import { Kind } from '../../language/kinds.js'; -import { print } from '../../language/printer.js'; -import { specifiedDirectives } from '../../type/directives.js'; -import { isType, isRequiredArgument } from '../../type/definition.js'; - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -export function ProvidedRequiredArgumentsRule(context) { - return { ...ProvidedRequiredArgumentsOnDirectivesRule(context), - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave(fieldNode) { - const fieldDef = context.getFieldDef(); - - if (!fieldDef) { - return false; - } - /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */ - - - const argNodes = fieldNode.arguments ?? []; - const argNodeMap = keyMap(argNodes, arg => arg.name.value); - - for (const argDef of fieldDef.args) { - const argNode = argNodeMap[argDef.name]; - - if (!argNode && isRequiredArgument(argDef)) { - const argTypeStr = inspect(argDef.type); - context.reportError(new GraphQLError(`Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, fieldNode)); - } - } - } - - } - }; -} -/** - * @internal - */ - -export function ProvidedRequiredArgumentsOnDirectivesRule(context) { - const requiredArgsMap = Object.create(null); - const schema = context.getSchema(); - const definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (const directive of definedDirectives) { - requiredArgsMap[directive.name] = keyMap(directive.args.filter(isRequiredArgument), arg => arg.name); - } - - const astDefinitions = context.getDocument().definitions; - - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */ - const argNodes = def.arguments ?? []; - requiredArgsMap[def.name.value] = keyMap(argNodes.filter(isRequiredArgumentNode), arg => arg.name.value); - } - } - - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave(directiveNode) { - const directiveName = directiveNode.name.value; - const requiredArgs = requiredArgsMap[directiveName]; - - if (requiredArgs) { - /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */ - const argNodes = directiveNode.arguments ?? []; - const argNodeMap = keyMap(argNodes, arg => arg.name.value); - - for (const argName of Object.keys(requiredArgs)) { - if (!argNodeMap[argName]) { - const argType = requiredArgs[argName].type; - const argTypeStr = isType(argType) ? inspect(argType) : print(argType); - context.reportError(new GraphQLError(`Directive "@${directiveName}" argument "${argName}" of type "${argTypeStr}" is required, but it was not provided.`, directiveNode)); - } - } - } - } - - } - }; -} - -function isRequiredArgumentNode(arg) { - return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/1aa8cc6352488fec0e34a6a9d497e25e3779e61c.ts b/crates/swc_bundler/tests/.cache/deno/1aa8cc6352488fec0e34a6a9d497e25e3779e61c.ts deleted file mode 100644 index 0317a6e0fc32..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1aa8cc6352488fec0e34a6a9d497e25e3779e61c.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/defaultTo.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Returns the second argument if it is not `null`, `undefined` or `NaN`; - * otherwise the first argument is returned. - * - * @func - * @memberOf R - * @since v0.10.0 - * @category Logic - * @sig a -> b -> a | b - * @param {a} default The default value. - * @param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`. - * @return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value - * @example - * - * const defaultTo42 = R.defaultTo(42); - * - * defaultTo42(null); //=> 42 - * defaultTo42(undefined); //=> 42 - * defaultTo42(false); //=> false - * defaultTo42('Ramda'); //=> 'Ramda' - * // parseInt('string') results in NaN - * defaultTo42(parseInt('string')); //=> 42 - */ -var defaultTo = _curry2(function defaultTo(d, v) { - return v == null || v !== v ? d : v; -}); -export default defaultTo; diff --git a/crates/swc_bundler/tests/.cache/deno/1ab0ffb728381c0e79b65e1bb44d7b46fa750aee.ts b/crates/swc_bundler/tests/.cache/deno/1ab0ffb728381c0e79b65e1bb44d7b46fa750aee.ts deleted file mode 100644 index 451816b73758..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ab0ffb728381c0e79b65e1bb44d7b46fa750aee.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/emojis/edit_emoji.ts - - -import { rest } from "../../rest/rest.ts"; -import type { Emoji } from "../../types/emojis/emoji.ts"; -import type { ModifyGuildEmoji } from "../../types/emojis/modify_guild_emoji.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** Modify the given emoji. Requires the MANAGE_EMOJIS permission. */ -export async function editEmoji(guildId: bigint, id: bigint, options: ModifyGuildEmoji) { - await requireBotGuildPermissions(guildId, ["MANAGE_EMOJIS"]); - - return await rest.runMethod("patch", endpoints.GUILD_EMOJI(guildId, id), { - name: options.name, - roles: options.roles, - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1aba0fbd7e93e34276469d966245619cbfff5799.ts b/crates/swc_bundler/tests/.cache/deno/1aba0fbd7e93e34276469d966245619cbfff5799.ts deleted file mode 100644 index c2514f17c20c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1aba0fbd7e93e34276469d966245619cbfff5799.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/templates/modify_guild_template.ts - - -/** https://discord.com/developers/docs/resources/template#modify-guild-template */ -export interface ModifyGuildTemplate { - /** Name of the template (1-100 characters) */ - name?: string; - /** Description of the template (0-120 characters) */ - description?: string | null; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1ac6c3c452ff2fdf1cb94120e921046446b48ac0.ts b/crates/swc_bundler/tests/.cache/deno/1ac6c3c452ff2fdf1cb94120e921046446b48ac0.ts deleted file mode 100644 index 03cabdd3d3d8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ac6c3c452ff2fdf1cb94120e921046446b48ac0.ts +++ /dev/null @@ -1,390 +0,0 @@ -// Loaded from https://deno.land/std@0.88.0/path/glob.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -import { osType } from "../_util/os.ts"; -import { join, normalize } from "./mod.ts"; -import { SEP, SEP_PATTERN } from "./separator.ts"; - -export interface GlobOptions { - /** Extended glob syntax. - * See https://www.linuxjournal.com/content/bash-extended-globbing. Defaults - * to true. */ - extended?: boolean; - /** Globstar syntax. - * See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * If false, `**` is treated like `*`. Defaults to true. */ - globstar?: boolean; - /** Operating system. Defaults to the native OS. */ - os?: typeof Deno.build.os; -} - -export type GlobToRegExpOptions = GlobOptions; - -// deno-fmt-ignore -const regExpEscapeChars = ["!", "$", "(", ")", "*", "+", ".", "=", "?", "[", "\\", "^", "{", "|"]; -const rangeEscapeChars = ["-", "\\", "]"]; - -/** Convert a glob string to a regular expression. - * - * Tries to match bash glob expansion as closely as possible. - * - * Basic glob syntax: - * - `*` - Matches everything without leaving the path segment. - * - `{foo,bar}` - Matches `foo` or `bar`. - * - `[abcd]` - Matches `a`, `b`, `c` or `d`. - * - `[a-d]` - Matches `a`, `b`, `c` or `d`. - * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`. - * - `[[::]]` - Matches any character belonging to ``. - * - `[[:alnum:]]` - Matches any digit or letter. - * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`. - * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes - * for a complete list of supported character classes. - * - `\` - Escapes the next character for an `os` other than `"windows"`. - * - \` - Escapes the next character for `os` set to `"windows"`. - * - `/` - Path separator. - * - `\` - Additional path separator only for `os` set to `"windows"`. - * - * Extended syntax: - * - Requires `{ extended: true }`. - * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`. - * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same. - * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`. - * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`. - * - `!(foo|bar)` - Matches anything other than `{foo,bar}`. - * - See https://www.linuxjournal.com/content/bash-extended-globbing. - * - * Globstar syntax: - * - Requires `{ globstar: true }`. - * - `**` - Matches any number of any path segments. - * - Must comprise its entire path segment in the provided glob. - * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * - * Note the following properties: - * - The generated `RegExp` is anchored at both start and end. - * - Repeating and trailing separators are tolerated. Trailing separators in the - * provided glob have no meaning and are discarded. - * - Absolute globs will only match absolute paths, etc. - * - Empty globs will match nothing. - * - Any special glob syntax must be contained to one path segment. For example, - * `?(foo|bar/baz)` is invalid. The separator will take precendence and the - * first segment ends with an unclosed group. - * - If a path segment ends with unclosed groups or a dangling escape prefix, a - * parse error has occured. Every character for that segment is taken - * literally in this event. - * - * Limitations: - * - A negative group like `!(foo|bar)` will wrongly be converted to a negative - * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly - * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively, - * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if - * the group occurs not nested at the end of the segment. */ -export function globToRegExp( - glob: string, - { extended = true, globstar: globstarOption = true, os = osType }: - GlobToRegExpOptions = {}, -): RegExp { - if (glob == "") { - return /(?!)/; - } - - const sep = os == "windows" ? "(?:\\\\|/)+" : "/+"; - const sepMaybe = os == "windows" ? "(?:\\\\|/)*" : "/*"; - const seps = os == "windows" ? ["\\", "/"] : ["/"]; - const globstar = os == "windows" - ? "(?:[^\\\\/]*(?:\\\\|/|$)+)*" - : "(?:[^/]*(?:/|$)+)*"; - const wildcard = os == "windows" ? "[^\\\\/]*" : "[^/]*"; - const escapePrefix = os == "windows" ? "`" : "\\"; - - // Remove trailing separators. - let newLength = glob.length; - for (; newLength > 1 && seps.includes(glob[newLength - 1]); newLength--); - glob = glob.slice(0, newLength); - - let regExpString = ""; - - // Terminates correctly. Trust that `j` is incremented every iteration. - for (let j = 0; j < glob.length;) { - let segment = ""; - const groupStack = []; - let inRange = false; - let inEscape = false; - let endsWithSep = false; - let i = j; - - // Terminates with `i` at the non-inclusive end of the current segment. - for (; i < glob.length && !seps.includes(glob[i]); i++) { - if (inEscape) { - inEscape = false; - const escapeChars = inRange ? rangeEscapeChars : regExpEscapeChars; - segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - continue; - } - - if (glob[i] == escapePrefix) { - inEscape = true; - continue; - } - - if (glob[i] == "[") { - if (!inRange) { - inRange = true; - segment += "["; - if (glob[i + 1] == "!") { - i++; - segment += "^"; - } else if (glob[i + 1] == "^") { - i++; - segment += "\\^"; - } - continue; - } else if (glob[i + 1] == ":") { - let k = i + 1; - let value = ""; - while (glob[k + 1] != null && glob[k + 1] != ":") { - value += glob[k + 1]; - k++; - } - if (glob[k + 1] == ":" && glob[k + 2] == "]") { - i = k + 2; - if (value == "alnum") segment += "\\dA-Za-z"; - else if (value == "alpha") segment += "A-Za-z"; - else if (value == "ascii") segment += "\x00-\x7F"; - else if (value == "blank") segment += "\t "; - else if (value == "cntrl") segment += "\x00-\x1F\x7F"; - else if (value == "digit") segment += "\\d"; - else if (value == "graph") segment += "\x21-\x7E"; - else if (value == "lower") segment += "a-z"; - else if (value == "print") segment += "\x20-\x7E"; - else if (value == "punct") { - segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~"; - } else if (value == "space") segment += "\\s\v"; - else if (value == "upper") segment += "A-Z"; - else if (value == "word") segment += "\\w"; - else if (value == "xdigit") segment += "\\dA-Fa-f"; - continue; - } - } - } - - if (glob[i] == "]" && inRange) { - inRange = false; - segment += "]"; - continue; - } - - if (inRange) { - if (glob[i] == "\\") { - segment += `\\\\`; - } else { - segment += glob[i]; - } - continue; - } - - if ( - glob[i] == ")" && groupStack.length > 0 && - groupStack[groupStack.length - 1] != "BRACE" - ) { - segment += ")"; - const type = groupStack.pop()!; - if (type == "!") { - segment += wildcard; - } else if (type != "@") { - segment += type; - } - continue; - } - - if ( - glob[i] == "|" && groupStack.length > 0 && - groupStack[groupStack.length - 1] != "BRACE" - ) { - segment += "|"; - continue; - } - - if (glob[i] == "+" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("+"); - segment += "(?:"; - continue; - } - - if (glob[i] == "@" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("@"); - segment += "(?:"; - continue; - } - - if (glob[i] == "?") { - if (extended && glob[i + 1] == "(") { - i++; - groupStack.push("?"); - segment += "(?:"; - } else { - segment += "."; - } - continue; - } - - if (glob[i] == "!" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("!"); - segment += "(?!"; - continue; - } - - if (glob[i] == "{") { - groupStack.push("BRACE"); - segment += "(?:"; - continue; - } - - if (glob[i] == "}" && groupStack[groupStack.length - 1] == "BRACE") { - groupStack.pop(); - segment += ")"; - continue; - } - - if (glob[i] == "," && groupStack[groupStack.length - 1] == "BRACE") { - segment += "|"; - continue; - } - - if (glob[i] == "*") { - if (extended && glob[i + 1] == "(") { - i++; - groupStack.push("*"); - segment += "(?:"; - } else { - const prevChar = glob[i - 1]; - let numStars = 1; - while (glob[i + 1] == "*") { - i++; - numStars++; - } - const nextChar = glob[i + 1]; - if ( - globstarOption && numStars == 2 && - [...seps, undefined].includes(prevChar) && - [...seps, undefined].includes(nextChar) - ) { - segment += globstar; - endsWithSep = true; - } else { - segment += wildcard; - } - } - continue; - } - - segment += regExpEscapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - } - - // Check for unclosed groups or a dangling backslash. - if (groupStack.length > 0 || inRange || inEscape) { - // Parse failure. Take all characters from this segment literally. - segment = ""; - for (const c of glob.slice(j, i)) { - segment += regExpEscapeChars.includes(c) ? `\\${c}` : c; - endsWithSep = false; - } - } - - regExpString += segment; - if (!endsWithSep) { - regExpString += i < glob.length ? sep : sepMaybe; - endsWithSep = true; - } - - // Terminates with `i` at the start of the next segment. - while (seps.includes(glob[i])) i++; - - // Check that the next value of `j` is indeed higher than the current value. - if (!(i > j)) { - throw new Error("Assertion failure: i > j (potential infinite loop)"); - } - j = i; - } - - regExpString = `^${regExpString}$`; - return new RegExp(regExpString); -} - -/** Test whether the given string is a glob */ -export function isGlob(str: string): boolean { - const chars: Record = { "{": "}", "(": ")", "[": "]" }; - const regex = - /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; - - if (str === "") { - return false; - } - - let match: RegExpExecArray | null; - - while ((match = regex.exec(str))) { - if (match[2]) return true; - let idx = match.index + match[0].length; - - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - const open = match[1]; - const close = open ? chars[open] : null; - if (open && close) { - const n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - - str = str.slice(idx); - } - - return false; -} - -/** Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. */ -export function normalizeGlob( - glob: string, - { globstar = false }: GlobOptions = {}, -): string { - if (glob.match(/\0/g)) { - throw new Error(`Glob contains invalid characters: "${glob}"`); - } - if (!globstar) { - return normalize(glob); - } - const s = SEP_PATTERN.source; - const badParentPattern = new RegExp( - `(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, - "g", - ); - return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); -} - -/** Like join(), but doesn't collapse "**\/.." when `globstar` is true. */ -export function joinGlobs( - globs: string[], - { extended = false, globstar = false }: GlobOptions = {}, -): string { - if (!globstar || globs.length == 0) { - return join(...globs); - } - if (globs.length === 0) return "."; - let joined: string | undefined; - for (const glob of globs) { - const path = glob; - if (path.length > 0) { - if (!joined) joined = path; - else joined += `${SEP}${path}`; - } - } - if (!joined) return "."; - return normalizeGlob(joined, { extended, globstar }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1b0566230829126fecb541e367fd26ce521069db.ts b/crates/swc_bundler/tests/.cache/deno/1b0566230829126fecb541e367fd26ce521069db.ts deleted file mode 100644 index f57cd8318cad..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b0566230829126fecb541e367fd26ce521069db.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/std@0.81.0/path/separator.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/** This module is browser compatible. */ - -import { isWindows } from "../_util/os.ts"; - -export const SEP = isWindows ? "\\" : "/"; -export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/; diff --git a/crates/swc_bundler/tests/.cache/deno/1b2d0a727fc4a75d47a3e8f0fcd11de718d112a0.ts b/crates/swc_bundler/tests/.cache/deno/1b2d0a727fc4a75d47a3e8f0fcd11de718d112a0.ts deleted file mode 100644 index 42c652fffe67..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b2d0a727fc4a75d47a3e8f0fcd11de718d112a0.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/std@0.86.0/encoding/utf8.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -/** A default TextEncoder instance */ -export const encoder = new TextEncoder(); - -/** Shorthand for new TextEncoder().encode() */ -export function encode(input?: string): Uint8Array { - return encoder.encode(input); -} - -/** A default TextDecoder instance */ -export const decoder = new TextDecoder(); - -/** Shorthand for new TextDecoder().decode() */ -export function decode(input?: Uint8Array): string { - return decoder.decode(input); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1b31922fc075365c794afbfbc4a9360d7a38e2a3.ts b/crates/swc_bundler/tests/.cache/deno/1b31922fc075365c794afbfbc4a9360d7a38e2a3.ts deleted file mode 100644 index 1c61a7b9ba61..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b31922fc075365c794afbfbc4a9360d7a38e2a3.ts +++ /dev/null @@ -1,1898 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/zlib/zlib/deflate.ts - - -import { message as msg, CODE } from "./messages.ts"; -import type ZStream from "./zstream.ts"; -import * as trees from "./trees.ts"; -import adler32 from "./adler32.ts"; -import { crc32 } from "./crc32.ts"; -import STATUS from "./status.ts"; - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -const Z_OK = 0; -const Z_STREAM_END = 1; -//const Z_NEED_DICT = 2; -//const Z_ERRNO = -1; -const Z_STREAM_ERROR = -2; -const Z_DATA_ERROR = -3; -//const Z_MEM_ERROR = -4; -const Z_BUF_ERROR = -5; -//const Z_VERSION_ERROR = -6; - -/* compression levels */ -//const Z_NO_COMPRESSION = 0; -//const Z_BEST_SPEED = 1; -//const Z_BEST_COMPRESSION = 9; -const Z_DEFAULT_COMPRESSION = -1; - -const Z_FILTERED = 1; -const Z_HUFFMAN_ONLY = 2; -const Z_RLE = 3; -const Z_FIXED = 4; -const Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -//const Z_BINARY = 0; -//const Z_TEXT = 1; -//const Z_ASCII = 1; // = Z_TEXT -const Z_UNKNOWN = 2; - -/* The deflate compression method */ -const Z_DEFLATED = 8; - -const MAX_MEM_LEVEL = 9; -/* Maximum value for memLevel in deflateInit2 */ -const MAX_WBITS = 15; -/* 32K LZ77 window */ -const DEF_MEM_LEVEL = 8; - -const LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ -const LITERALS = 256; -/* number of literal bytes 0..255 */ -const L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ -const D_CODES = 30; -/* number of distance codes */ -const BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ -const HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ -const MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -const MIN_MATCH = 3; -const MAX_MATCH = 258; -const MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); -const PRESET_DICT = 0x20; -const INIT_STATE = 42; -const EXTRA_STATE = 69; -const NAME_STATE = 73; -const COMMENT_STATE = 91; -const HCRC_STATE = 103; -const BUSY_STATE = 113; -const FINISH_STATE = 666; -const BS_NEED_MORE = - 1; /* block not completed, need more input or more output */ -const BS_BLOCK_DONE = 2; /* block flush performed */ -const BS_FINISH_STARTED = - 3; /* finish started, need only more output at next deflate */ -const BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ -const OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - -export interface Header { - text: boolean; - time: number; - os: number; - extra: string[]; - name: string; - comment: string; - hcrc: boolean; -} - -function err(strm: ZStream, errorCode: CODE) { - strm.msg = msg[errorCode]; - return errorCode; -} - -function rank(f: number): number { - return ((f) << 1) - ((f) > 4 ? 9 : 0); -} - -function zero(buf: Uint8Array | Uint16Array) { - buf.fill(0, 0, buf.length); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ -function flush_pending(strm: ZStream) { - let s = strm.state as DeflateState; - - //_tr_flush_bits(s); - let len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) return; - strm.output!.set( - s.pending_buf.subarray(s.pending_out, s.pending_out + len), - strm.next_out, - ); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -} - -function flush_block_only(s: DeflateState, last: any) { - trees._tr_flush_block( - s, - (s.block_start >= 0 ? s.block_start : -1), - s.strstart - s.block_start, - last, - ); - s.block_start = s.strstart; - flush_pending(s.strm!); -} - -function put_byte(s: any, b: any) { - s.pending_buf[s.pending++] = b; -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -function putShortMSB(s: any, b: any) { - // put_byte(s, (Byte)(b >> 8)); - // put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ -function read_buf(strm: any, buf: any, start: any, size: any) { - let len = strm.avail_in; - - if (len > size) len = size; - if (len === 0) return 0; - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; -} - -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -function longest_match(s: any, cur_match: any) { - let chain_length = s.max_chain_length; /* max hash chain length */ - let scan = s.strstart; /* current string */ - let match; /* matched string */ - let len; /* length of current match */ - let best_len = s.prev_length; /* best match length so far */ - let nice_match = s.nice_match; /* stop if match long enough */ - let limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) - ? s.strstart - (s.w_size - MIN_LOOKAHEAD) - : 0 /*NIL*/; - - let _win = s.window; // shortcut - - let wmask = s.w_mask; - let prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - let strend = s.strstart + MAX_MATCH; - let scan_end1 = _win[scan + best_len - 1]; - let scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) nice_match = s.lookahead; - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if ( - _win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1] - ) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while ( - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend - ); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ( - (cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0 - ); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -} - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -function fill_window(s: any) { - let _w_size = s.w_size; - let p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - s.window.set(s.window.subarray(_w_size, _w_size + _w_size), 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; - //#if MIN_MATCH != 3 - // Call update_hash() MIN_MATCH-3 more times - //#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & - s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ - // if (s.high_water < s.window_size) { - // let curr = s.strstart + s.lookahead; - // let init = 0; - // - // if (s.high_water < curr) { - // /* Previous high water mark below current data -- zero WIN_INIT - // * bytes or up to end of window, whichever is less. - // */ - // init = s.window_size - curr; - // if (init > WIN_INIT) - // init = WIN_INIT; - // zmemzero(s->window + curr, (unsigned)init); - // s->high_water = curr + init; - // } - // else if (s->high_water < (ulg)curr + WIN_INIT) { - // /* High water mark at or above current data, but below current data - // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up - // * to end of window, whichever is less. - // */ - // init = (ulg)curr + WIN_INIT - s->high_water; - // if (init > s->window_size - s->high_water) - // init = s->window_size - s->high_water; - // zmemzero(s->window + s->high_water, (unsigned)init); - // s->high_water += init; - // } - // } - // - // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, - // "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -function deflate_stored(s: any, flush: any) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - let max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); - // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || - // s.block_start >= s.w_size)) { - // throw new Error("slide too late"); - // } - - fill_window(s); - if (s.lookahead === 0 && flush === STATUS.Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); - // if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - let max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === STATUS.Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -function deflate_fast(s: any, flush: any) { - let hash_head; /* head of the hash chain */ - let bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === STATUS.Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0 /*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = - ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & - s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if ( - hash_head !== 0 /*NIL*/ && - ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD)) - ) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally( - s, - s.strstart - s.match_start, - s.match_length - MIN_MATCH, - ); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if ( - s.match_length <= s.max_lazy_match /*max_insert_length*/ && - s.lookahead >= MIN_MATCH - ) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = - ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & - s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & - s.hash_mask; - - //#if MIN_MATCH != 3 - // Call UPDATE_HASH() MIN_MATCH-3 more times - //#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === STATUS.Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -function deflate_slow(s: any, flush: any) { - let hash_head; /* head of hash chain */ - let bflush; /* set if current block must be flushed */ - - let max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === STATUS.Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0 /*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = - ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & - s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if ( - hash_head !== 0 /*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD) /*MAX_DIST(s)*/ - ) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if ( - s.match_length <= 5 && - (s.strategy === Z_FILTERED || - (s.match_length === MIN_MATCH && - s.strstart - s.match_start > 4096 /*TOO_FAR*/)) - ) { - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally( - s, - s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, - ); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = - ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & - s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === STATUS.Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -function deflate_rle(s: any, flush: any) { - let bflush; /* set if current block must be flushed */ - let prev; /* byte at distance one to match */ - let scan, strend; /* scan goes up to strend for length of run */ - - let _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === STATUS.Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if ( - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] - ) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while ( - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend - ); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === STATUS.Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -function deflate_huff(s: any, flush: any) { - let bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === STATUS.Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === STATUS.Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -class Config { - good_length: any; - max_lazy: any; - nice_length: any; - max_chain: any; - func: any; - constructor( - good_length: any, - max_lazy: any, - nice_length: any, - max_chain: any, - func: any, - ) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; - } -} - -let configuration_table: any; - -configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow), /* 9 max compression */ -]; - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -function lm_init(s: any) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -} - -export class DeflateState { - strm: ZStream | null = null; /* pointer back to this zlib stream */ - status = 0; /* as the name implies */ - pending_buf: any = null; /* output still pending */ - pending_buf_size = 0; /* size of pending_buf */ - pending_out = 0; /* next pending byte to output to the stream */ - pending = 0; /* nb of bytes in the pending buffer */ - wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - gzhead: Header | null = null; /* gzip header information to write */ - gzindex = 0; /* where in extra, name, or comment */ - method = Z_DEFLATED; /* can only be DEFLATED */ - last_flush = -1; /* value of flush param for previous deflate call */ - - w_size = 0; /* LZ77 window size (32K by default) */ - w_bits = 0; /* log2(w_size) (8..16) */ - w_mask = 0; /* w_size - 1 */ - - window: any = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - prev: any = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - head: any = null; /* Heads of the hash chains or NIL. */ - - ins_h = 0; /* hash index of string to be inserted */ - hash_size = 0; /* number of elements in hash table */ - hash_bits = 0; /* log2(hash_size) */ - hash_mask = 0; /* hash_size-1 */ - - hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - match_length = 0; /* length of best match */ - prev_match = 0; /* previous match */ - match_available = 0; /* set if previous match exists */ - strstart = 0; /* start of string to insert */ - match_start = 0; /* start of matching string */ - lookahead = 0; /* number of valid bytes ahead in window */ - - prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - level = 0; /* compression level (1..9) */ - strategy = 0; /* favor or force Huffman coding*/ - - good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - dyn_ltree = new Uint16Array(HEAP_SIZE * 2); - dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2); - bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2); - - l_desc = null; /* desc. for literal tree */ - d_desc = null; /* desc. for distance tree */ - bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - bl_count = new Uint16Array(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - heap = new Uint16Array( - 2 * L_CODES + 1, - ); /* heap used to build the Huffman trees */ - - heap_len = 0; /* number of elements in the heap */ - heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - depth = new Uint16Array(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - l_buf = 0; /* buffer index for literals or lengths */ - - lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - last_lit = 0; /* running index in l_buf */ - - d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - opt_len = 0; /* bit length of current block with optimal trees */ - static_len = 0; /* bit length of current block with static trees */ - matches = 0; /* number of string matches in current block */ - insert = 0; /* bytes at end of window left to insert */ - - bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ - constructor() { - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - zero(this.heap); - zero(this.depth); - } -} - -function deflateResetKeep(strm: ZStream) { - let s; - - if (!strm || !strm.state) { - return err(strm, STATUS.Z_STREAM_ERROR.toString() as CODE); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) - ? 0 // crc32(0, Z_NULL, 0) - : 1; // adler32(0, Z_NULL, 0) - s.last_flush = STATUS.Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; -} - -function deflateReset(strm: ZStream) { - let ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; -} - -export function deflateSetHeader(strm: ZStream, head: Header) { - if (!strm || !strm.state) return Z_STREAM_ERROR; - if (strm.state.wrap !== 2) return Z_STREAM_ERROR; - strm.state.gzhead = head; - return Z_OK; -} - -export function deflateInit2( - strm: ZStream, - level: number, - method: number, - windowBits: number, - memLevel: number, - strategy: number, -): CODE { - if (!strm) { // === Z_NULL - return STATUS.Z_STREAM_ERROR as CODE; - } - let wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { - /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - if ( - memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED - ) { - return err(strm, STATUS.Z_STREAM_ERROR.toString() as CODE); - } - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - let s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new Uint8Array(s.w_size * 2); - s.head = new Uint16Array(s.hash_size); - s.prev = new Uint16Array(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new Uint8Array(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); -} - -function deflateInit(strm: ZStream, level: number) { - return deflateInit2( - strm, - level, - Z_DEFLATED, - MAX_WBITS, - DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, - ); -} - -export function deflate(strm: ZStream, flush: number) { - let old_flush, s; - let beg, val; // for gzip header write only - - if ( - !strm || !strm.state || - flush > STATUS.Z_BLOCK || flush < 0 - ) { - return strm ? err(strm, STATUS.Z_STREAM_ERROR as CODE) : Z_STREAM_ERROR; - } - - s = strm.state; - - if ( - !strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== STATUS.Z_FINISH) - ) { - return err( - strm, - (strm.avail_out === 0 - ? STATUS.Z_BUF_ERROR - : STATUS.Z_STREAM_ERROR) as CODE, - ); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte( - s, - s.level === 9 - ? 2 - : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0), - ); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } else { - put_byte( - s, - (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16), - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte( - s, - s.level === 9 - ? 2 - : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0), - ); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } // DEFLATE header - else { - let header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - let level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - - //#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead!.extra /* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead!.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead!.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead!.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead!.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead!.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead!.name /* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead!.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead!.name.length) { - val = s.gzhead!.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead!.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead!.comment /* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead!.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead!.comment.length) { - val = s.gzhead!.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead!.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead!.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } else { - s.status = BUSY_STATE; - } - } - //#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if ( - strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== STATUS.Z_FINISH - ) { - return err(strm, STATUS.Z_BUF_ERROR as CODE); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, STATUS.Z_BUF_ERROR as CODE); - } - - /* Start a new block or continue the current one. - */ - if ( - strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== STATUS.Z_NO_FLUSH && s.status !== FINISH_STATE) - ) { - let bstate = (s.strategy === Z_HUFFMAN_ONLY) - ? deflate_huff(s, flush) - : (s.strategy === Z_RLE - ? deflate_rle(s, flush) - : configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return STATUS.Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === STATUS.Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } else if (flush !== STATUS.Z_BLOCK) { - /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === STATUS.Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ - /* forget history */ - zero(s.head!); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return STATUS.Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== STATUS.Z_FINISH) return STATUS.Z_OK; - if (s.wrap <= 0) return STATUS.Z_STREAM_END; - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } else { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) s.wrap = -s.wrap; - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; -} - -export function deflateEnd(strm: ZStream): any { - let status; - - if (!strm /*== Z_NULL*/ || !strm.state /*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if ( - status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, STATUS.Z_STREAM_ERROR as CODE); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, STATUS.Z_DATA_ERROR as CODE) : Z_OK; -} - -/* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ -export function deflateSetDictionary( - strm: ZStream, - dictionary: Uint8Array, -): any { - let dictLength = dictionary.length; - - let s; - let str, n; - let wrap; - let avail; - let next; - let input; - let tmpDict; - - if (!strm /*== Z_NULL*/ || !strm.state /*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { - /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head!); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new Uint8Array(s.w_size); - tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window![str + MIN_MATCH - 1]) & - s.hash_mask; - - s.prev![str & s.w_mask] = s.head![s.ins_h]; - - s.head![s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1b331576d3a22cb56c3454878ffae3385d3c660a.ts b/crates/swc_bundler/tests/.cache/deno/1b331576d3a22cb56c3454878ffae3385d3c660a.ts deleted file mode 100644 index 9ec3fc4d46e3..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b331576d3a22cb56c3454878ffae3385d3c660a.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/sort.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Returns a copy of the list, sorted according to the comparator function, - * which should accept two values at a time and return a negative number if the - * first value is smaller, a positive number if it's larger, and zero if they - * are equal. Please note that this is a **copy** of the list. It does not - * modify the original. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig ((a, a) -> Number) -> [a] -> [a] - * @param {Function} comparator A sorting function :: a -> b -> Int - * @param {Array} list The list to sort - * @return {Array} a new array with its elements sorted by the comparator function. - * @see R.ascend, R.descend - * @example - * - * const diff = function(a, b) { return a - b; }; - * R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7] - */ -var sort = _curry2(function sort(comparator, list) { - return Array.prototype.slice.call(list, 0).sort(comparator); -}); -export default sort; diff --git a/crates/swc_bundler/tests/.cache/deno/1b4a2b4a6c460f5bd77c1dfd0134e23f17db993f.ts b/crates/swc_bundler/tests/.cache/deno/1b4a2b4a6c460f5bd77c1dfd0134e23f17db993f.ts deleted file mode 100644 index 7d14f87ebc03..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b4a2b4a6c460f5bd77c1dfd0134e23f17db993f.ts +++ /dev/null @@ -1,615 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/language/lexer.js - - -import { syntaxError } from '../error/syntaxError.js'; -import { Token } from './ast.js'; -import { dedentBlockStringValue } from './blockString.js'; -import { TokenKind } from './tokenKind.js'; -/** - * Given a Source object, creates a Lexer for that source. - * A Lexer is a stateful stream generator in that every time - * it is advanced, it returns the next token in the Source. Assuming the - * source lexes, the final Token emitted by the lexer will be of kind - * EOF, after which the lexer will repeatedly return the same EOF token - * whenever called. - */ - -export class Lexer { - /** - * The previously focused non-ignored token. - */ - - /** - * The currently focused non-ignored token. - */ - - /** - * The (1-indexed) line containing the current token. - */ - - /** - * The character offset at which the current line begins. - */ - constructor(source) { - const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0, null); - this.source = source; - this.lastToken = startOfFileToken; - this.token = startOfFileToken; - this.line = 1; - this.lineStart = 0; - } - /** - * Advances the token stream to the next non-ignored token. - */ - - - advance() { - this.lastToken = this.token; - const token = this.token = this.lookahead(); - return token; - } - /** - * Looks ahead and returns the next non-ignored token, but does not change - * the state of Lexer. - */ - - - lookahead() { - let token = this.token; - - if (token.kind !== TokenKind.EOF) { - do { - // Note: next is only mutable during parsing, so we cast to allow this. - token = token.next ?? (token.next = readToken(this, token)); - } while (token.kind === TokenKind.COMMENT); - } - - return token; - } - -} -/** - * @internal - */ - -export function isPunctuatorTokenKind(kind) { - return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R; -} - -function printCharCode(code) { - return (// NaN/undefined represents access beyond the end of the file. - isNaN(code) ? TokenKind.EOF : // Trust JSON for ASCII. - code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form. - `"\\u${('00' + code.toString(16).toUpperCase()).slice(-4)}"` - ); -} -/** - * Gets the next token from the source starting at the given position. - * - * This skips over whitespace until it finds the next lexable token, then lexes - * punctuators immediately or calls the appropriate helper function for more - * complicated tokens. - */ - - -function readToken(lexer, prev) { - const source = lexer.source; - const body = source.body; - const bodyLength = body.length; - const pos = positionAfterWhitespace(body, prev.end, lexer); - const line = lexer.line; - const col = 1 + pos - lexer.lineStart; - - if (pos >= bodyLength) { - return new Token(TokenKind.EOF, bodyLength, bodyLength, line, col, prev); - } - - const code = body.charCodeAt(pos); // SourceCharacter - - switch (code) { - // ! - case 33: - return new Token(TokenKind.BANG, pos, pos + 1, line, col, prev); - // # - - case 35: - return readComment(source, pos, line, col, prev); - // $ - - case 36: - return new Token(TokenKind.DOLLAR, pos, pos + 1, line, col, prev); - // & - - case 38: - return new Token(TokenKind.AMP, pos, pos + 1, line, col, prev); - // ( - - case 40: - return new Token(TokenKind.PAREN_L, pos, pos + 1, line, col, prev); - // ) - - case 41: - return new Token(TokenKind.PAREN_R, pos, pos + 1, line, col, prev); - // . - - case 46: - if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) { - return new Token(TokenKind.SPREAD, pos, pos + 3, line, col, prev); - } - - break; - // : - - case 58: - return new Token(TokenKind.COLON, pos, pos + 1, line, col, prev); - // = - - case 61: - return new Token(TokenKind.EQUALS, pos, pos + 1, line, col, prev); - // @ - - case 64: - return new Token(TokenKind.AT, pos, pos + 1, line, col, prev); - // [ - - case 91: - return new Token(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev); - // ] - - case 93: - return new Token(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev); - // { - - case 123: - return new Token(TokenKind.BRACE_L, pos, pos + 1, line, col, prev); - // | - - case 124: - return new Token(TokenKind.PIPE, pos, pos + 1, line, col, prev); - // } - - case 125: - return new Token(TokenKind.BRACE_R, pos, pos + 1, line, col, prev); - // A-Z _ a-z - - case 65: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: - case 72: - case 73: - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - case 80: - case 81: - case 82: - case 83: - case 84: - case 85: - case 86: - case 87: - case 88: - case 89: - case 90: - case 95: - case 97: - case 98: - case 99: - case 100: - case 101: - case 102: - case 103: - case 104: - case 105: - case 106: - case 107: - case 108: - case 109: - case 110: - case 111: - case 112: - case 113: - case 114: - case 115: - case 116: - case 117: - case 118: - case 119: - case 120: - case 121: - case 122: - return readName(source, pos, line, col, prev); - // - 0-9 - - case 45: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - return readNumber(source, pos, code, line, col, prev); - // " - - case 34: - if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) { - return readBlockString(source, pos, line, col, prev, lexer); - } - - return readString(source, pos, line, col, prev); - } - - throw syntaxError(source, pos, unexpectedCharacterMessage(code)); -} -/** - * Report a message that an unexpected character was encountered. - */ - - -function unexpectedCharacterMessage(code) { - if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { - return `Cannot contain the invalid character ${printCharCode(code)}.`; - } - - if (code === 39) { - // ' - return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; - } - - return `Cannot parse the unexpected character ${printCharCode(code)}.`; -} -/** - * Reads from body starting at startPosition until it finds a non-whitespace - * character, then returns the position of that character for lexing. - */ - - -function positionAfterWhitespace(body, startPosition, lexer) { - const bodyLength = body.length; - let position = startPosition; - - while (position < bodyLength) { - const code = body.charCodeAt(position); // tab | space | comma | BOM - - if (code === 9 || code === 32 || code === 44 || code === 0xfeff) { - ++position; - } else if (code === 10) { - // new line - ++position; - ++lexer.line; - lexer.lineStart = position; - } else if (code === 13) { - // carriage return - if (body.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - - ++lexer.line; - lexer.lineStart = position; - } else { - break; - } - } - - return position; -} -/** - * Reads a comment token from the source file. - * - * #[\u0009\u0020-\uFFFF]* - */ - - -function readComment(source, start, line, col, prev) { - const body = source.body; - let code; - let position = start; - - do { - code = body.charCodeAt(++position); - } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator - code > 0x001f || code === 0x0009)); - - return new Token(TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position)); -} -/** - * Reads a number token from the source file, either a float - * or an int depending on whether a decimal point appears. - * - * Int: -?(0|[1-9][0-9]*) - * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? - */ - - -function readNumber(source, start, firstCode, line, col, prev) { - const body = source.body; - let code = firstCode; - let position = start; - let isFloat = false; - - if (code === 45) { - // - - code = body.charCodeAt(++position); - } - - if (code === 48) { - // 0 - code = body.charCodeAt(++position); - - if (code >= 48 && code <= 57) { - throw syntaxError(source, position, `Invalid number, unexpected digit after 0: ${printCharCode(code)}.`); - } - } else { - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 46) { - // . - isFloat = true; - code = body.charCodeAt(++position); - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } - - if (code === 69 || code === 101) { - // E e - isFloat = true; - code = body.charCodeAt(++position); - - if (code === 43 || code === 45) { - // + - - code = body.charCodeAt(++position); - } - - position = readDigits(source, position, code); - code = body.charCodeAt(position); - } // Numbers cannot be followed by . or NameStart - - - if (code === 46 || isNameStart(code)) { - throw syntaxError(source, position, `Invalid number, expected digit but got: ${printCharCode(code)}.`); - } - - return new Token(isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, line, col, prev, body.slice(start, position)); -} -/** - * Returns the new position in the source after reading digits. - */ - - -function readDigits(source, start, firstCode) { - const body = source.body; - let position = start; - let code = firstCode; - - if (code >= 48 && code <= 57) { - // 0 - 9 - do { - code = body.charCodeAt(++position); - } while (code >= 48 && code <= 57); // 0 - 9 - - - return position; - } - - throw syntaxError(source, position, `Invalid number, expected digit but got: ${printCharCode(code)}.`); -} -/** - * Reads a string token from the source file. - * - * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" - */ - - -function readString(source, start, line, col, prev) { - const body = source.body; - let position = start + 1; - let chunkStart = position; - let code = 0; - let value = ''; - - while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator - code !== 0x000a && code !== 0x000d) { - // Closing Quote (") - if (code === 34) { - value += body.slice(chunkStart, position); - return new Token(TokenKind.STRING, start, position + 1, line, col, prev, value); - } // SourceCharacter - - - if (code < 0x0020 && code !== 0x0009) { - throw syntaxError(source, position, `Invalid character within String: ${printCharCode(code)}.`); - } - - ++position; - - if (code === 92) { - // \ - value += body.slice(chunkStart, position - 1); - code = body.charCodeAt(position); - - switch (code) { - case 34: - value += '"'; - break; - - case 47: - value += '/'; - break; - - case 92: - value += '\\'; - break; - - case 98: - value += '\b'; - break; - - case 102: - value += '\f'; - break; - - case 110: - value += '\n'; - break; - - case 114: - value += '\r'; - break; - - case 116: - value += '\t'; - break; - - case 117: - { - // uXXXX - const charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); - - if (charCode < 0) { - const invalidSequence = body.slice(position + 1, position + 5); - throw syntaxError(source, position, `Invalid character escape sequence: \\u${invalidSequence}.`); - } - - value += String.fromCharCode(charCode); - position += 4; - break; - } - - default: - throw syntaxError(source, position, `Invalid character escape sequence: \\${String.fromCharCode(code)}.`); - } - - ++position; - chunkStart = position; - } - } - - throw syntaxError(source, position, 'Unterminated string.'); -} -/** - * Reads a block string token from the source file. - * - * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" - */ - - -function readBlockString(source, start, line, col, prev, lexer) { - const body = source.body; - let position = start + 3; - let chunkStart = position; - let code = 0; - let rawValue = ''; - - while (position < body.length && !isNaN(code = body.charCodeAt(position))) { - // Closing Triple-Quote (""") - if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { - rawValue += body.slice(chunkStart, position); - return new Token(TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, dedentBlockStringValue(rawValue)); - } // SourceCharacter - - - if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { - throw syntaxError(source, position, `Invalid character within String: ${printCharCode(code)}.`); - } - - if (code === 10) { - // new line - ++position; - ++lexer.line; - lexer.lineStart = position; - } else if (code === 13) { - // carriage return - if (body.charCodeAt(position + 1) === 10) { - position += 2; - } else { - ++position; - } - - ++lexer.line; - lexer.lineStart = position; - } else if ( // Escape Triple-Quote (\""") - code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { - rawValue += body.slice(chunkStart, position) + '"""'; - position += 4; - chunkStart = position; - } else { - ++position; - } - } - - throw syntaxError(source, position, 'Unterminated string.'); -} -/** - * Converts four hexadecimal chars to the integer that the - * string represents. For example, uniCharCode('0','0','0','f') - * will return 15, and uniCharCode('0','0','f','f') returns 255. - * - * Returns a negative number on error, if a char was invalid. - * - * This is implemented by noting that char2hex() returns -1 on error, - * which means the result of ORing the char2hex() will also be negative. - */ - - -function uniCharCode(a, b, c, d) { - return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d); -} -/** - * Converts a hex character to its integer value. - * '0' becomes 0, '9' becomes 9 - * 'A' becomes 10, 'F' becomes 15 - * 'a' becomes 10, 'f' becomes 15 - * - * Returns -1 on error. - */ - - -function char2hex(a) { - return a >= 48 && a <= 57 ? a - 48 // 0-9 - : a >= 65 && a <= 70 ? a - 55 // A-F - : a >= 97 && a <= 102 ? a - 87 // a-f - : -1; -} -/** - * Reads an alphanumeric + underscore name from the source. - * - * [_A-Za-z][_0-9A-Za-z]* - */ - - -function readName(source, start, line, col, prev) { - const body = source.body; - const bodyLength = body.length; - let position = start + 1; - let code = 0; - - while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _ - code >= 48 && code <= 57 || // 0-9 - code >= 65 && code <= 90 || // A-Z - code >= 97 && code <= 122) // a-z - ) { - ++position; - } - - return new Token(TokenKind.NAME, start, position, line, col, prev, body.slice(start, position)); -} // _ A-Z a-z - - -function isNameStart(code) { - return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/1b50737842a71ff8d90fada6cb46bf96a4012ed9.ts b/crates/swc_bundler/tests/.cache/deno/1b50737842a71ff8d90fada6cb46bf96a4012ed9.ts deleted file mode 100644 index e52e9833e441..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b50737842a71ff8d90fada6cb46bf96a4012ed9.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_curry3.js - - -import _curry1 from './_curry1.js'; -import _curry2 from './_curry2.js'; -import _isPlaceholder from './_isPlaceholder.js'; - - -/** - * Optimized internal three-arity curry function. - * - * @private - * @category Function - * @param {Function} fn The function to curry. - * @return {Function} The curried function. - */ -export default function _curry3(fn) { - return function f3(a, b, c) { - switch (arguments.length) { - case 0: - return f3; - case 1: - return _isPlaceholder(a) - ? f3 - : _curry2(function(_b, _c) { return fn(a, _b, _c); }); - case 2: - return _isPlaceholder(a) && _isPlaceholder(b) - ? f3 - : _isPlaceholder(a) - ? _curry2(function(_a, _c) { return fn(_a, b, _c); }) - : _isPlaceholder(b) - ? _curry2(function(_b, _c) { return fn(a, _b, _c); }) - : _curry1(function(_c) { return fn(a, b, _c); }); - default: - return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) - ? f3 - : _isPlaceholder(a) && _isPlaceholder(b) - ? _curry2(function(_a, _b) { return fn(_a, _b, c); }) - : _isPlaceholder(a) && _isPlaceholder(c) - ? _curry2(function(_a, _c) { return fn(_a, b, _c); }) - : _isPlaceholder(b) && _isPlaceholder(c) - ? _curry2(function(_b, _c) { return fn(a, _b, _c); }) - : _isPlaceholder(a) - ? _curry1(function(_a) { return fn(_a, b, c); }) - : _isPlaceholder(b) - ? _curry1(function(_b) { return fn(a, _b, c); }) - : _isPlaceholder(c) - ? _curry1(function(_c) { return fn(a, b, _c); }) - : fn(a, b, c); - } - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1b59e61107b04ef461b193fc873a00e993e2157e.ts b/crates/swc_bundler/tests/.cache/deno/1b59e61107b04ef461b193fc873a00e993e2157e.ts deleted file mode 100644 index ea4284794b9f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b59e61107b04ef461b193fc873a00e993e2157e.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isPort.ts - - -// @ts-ignore allowing typedoc to build -import { isInt } from './isInt.ts'; - -export const isPort = (str: string) => { - return isInt(str, { min: 0, max: 65535 }); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1b5b62f0b0b53381965f66fc754510c8c0d647a2.ts b/crates/swc_bundler/tests/.cache/deno/1b5b62f0b0b53381965f66fc754510c8c0d647a2.ts deleted file mode 100644 index 574b52ffe66d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1b5b62f0b0b53381965f66fc754510c8c0d647a2.ts +++ /dev/null @@ -1,644 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/archive/tar.ts - - -/** - * Ported and modified from: https://github.com/beatgammit/tar-js and - * licensed as: - * - * (The MIT License) - * - * Copyright (c) 2011 T. Jameson Little - * Copyright (c) 2019 Jun Kato - * Copyright (c) 2018-2021 the Deno authors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -import { MultiReader } from "../io/readers.ts"; -import { PartialReadError } from "../io/bufio.ts"; -import { assert } from "../_util/assert.ts"; -import { Buffer } from "../io/buffer.ts"; -import { readAll } from "../io/util.ts"; - -type Reader = Deno.Reader; -type Seeker = Deno.Seeker; - -const recordSize = 512; -const ustar = "ustar\u000000"; - -// https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_06 -// eight checksum bytes taken to be ascii spaces (decimal value 32) -const initialChecksum = 8 * 32; - -async function readBlock( - reader: Deno.Reader, - p: Uint8Array, -): Promise { - let bytesRead = 0; - while (bytesRead < p.length) { - const rr = await reader.read(p.subarray(bytesRead)); - if (rr === null) { - if (bytesRead === 0) { - return null; - } else { - throw new PartialReadError(); - } - } - bytesRead += rr; - } - return bytesRead; -} - -/** - * Simple file reader - */ -class FileReader implements Reader { - private file?: Deno.File; - - constructor(private filePath: string) {} - - public async read(p: Uint8Array): Promise { - if (!this.file) { - this.file = await Deno.open(this.filePath, { read: true }); - } - const res = await Deno.read(this.file.rid, p); - if (res === null) { - Deno.close(this.file.rid); - this.file = undefined; - } - return res; - } -} - -/** - * Remove the trailing null codes - * @param buffer - */ -function trim(buffer: Uint8Array): Uint8Array { - const index = buffer.findIndex((v): boolean => v === 0); - if (index < 0) return buffer; - return buffer.subarray(0, index); -} - -/** - * Initialize Uint8Array of the specified length filled with 0 - * @param length - */ -function clean(length: number): Uint8Array { - const buffer = new Uint8Array(length); - buffer.fill(0, 0, length - 1); - return buffer; -} - -function pad(num: number, bytes: number, base = 8): string { - const numString = num.toString(base); - return "000000000000".substr(numString.length + 12 - bytes) + numString; -} - -enum FileTypes { - "file" = 0, - "link" = 1, - "symlink" = 2, - "character-device" = 3, - "block-device" = 4, - "directory" = 5, - "fifo" = 6, - "contiguous-file" = 7, -} - -/* -struct posix_header { // byte offset - char name[100]; // 0 - char mode[8]; // 100 - char uid[8]; // 108 - char gid[8]; // 116 - char size[12]; // 124 - char mtime[12]; // 136 - char chksum[8]; // 148 - char typeflag; // 156 - char linkname[100]; // 157 - char magic[6]; // 257 - char version[2]; // 263 - char uname[32]; // 265 - char gname[32]; // 297 - char devmajor[8]; // 329 - char devminor[8]; // 337 - char prefix[155]; // 345 - // 500 -}; -*/ - -const ustarStructure: Array<{ field: string; length: number }> = [ - { - field: "fileName", - length: 100, - }, - { - field: "fileMode", - length: 8, - }, - { - field: "uid", - length: 8, - }, - { - field: "gid", - length: 8, - }, - { - field: "fileSize", - length: 12, - }, - { - field: "mtime", - length: 12, - }, - { - field: "checksum", - length: 8, - }, - { - field: "type", - length: 1, - }, - { - field: "linkName", - length: 100, - }, - { - field: "ustar", - length: 8, - }, - { - field: "owner", - length: 32, - }, - { - field: "group", - length: 32, - }, - { - field: "majorNumber", - length: 8, - }, - { - field: "minorNumber", - length: 8, - }, - { - field: "fileNamePrefix", - length: 155, - }, - { - field: "padding", - length: 12, - }, -]; - -/** - * Create header for a file in a tar archive - */ -function formatHeader(data: TarData): Uint8Array { - const encoder = new TextEncoder(), - buffer = clean(512); - let offset = 0; - ustarStructure.forEach(function (value): void { - const entry = encoder.encode(data[value.field as keyof TarData] || ""); - buffer.set(entry, offset); - offset += value.length; // space it out with nulls - }); - return buffer; -} - -/** - * Parse file header in a tar archive - * @param length - */ -function parseHeader(buffer: Uint8Array): { [key: string]: Uint8Array } { - const data: { [key: string]: Uint8Array } = {}; - let offset = 0; - ustarStructure.forEach(function (value): void { - const arr = buffer.subarray(offset, offset + value.length); - data[value.field] = arr; - offset += value.length; - }); - return data; -} - -interface TarHeader { - [key: string]: Uint8Array; -} - -export interface TarData { - fileName?: string; - fileNamePrefix?: string; - fileMode?: string; - uid?: string; - gid?: string; - fileSize?: string; - mtime?: string; - checksum?: string; - type?: string; - ustar?: string; - owner?: string; - group?: string; -} - -export interface TarDataWithSource extends TarData { - /** - * file to read - */ - filePath?: string; - /** - * buffer to read - */ - reader?: Reader; -} - -export interface TarInfo { - fileMode?: number; - mtime?: number; - uid?: number; - gid?: number; - owner?: string; - group?: string; - type?: string; -} - -export interface TarOptions extends TarInfo { - /** - * append file - */ - filePath?: string; - - /** - * append any arbitrary content - */ - reader?: Reader; - - /** - * size of the content to be appended - */ - contentSize?: number; -} - -export interface TarMeta extends TarInfo { - fileName: string; - fileSize?: number; -} - -// deno-lint-ignore no-empty-interface -interface TarEntry extends TarMeta {} - -/** - * A class to create a tar archive - */ -export class Tar { - data: TarDataWithSource[]; - - constructor() { - this.data = []; - } - - /** - * Append a file to this tar archive - * @param fn file name - * e.g., test.txt; use slash for directory separators - * @param opts options - */ - async append(fn: string, opts: TarOptions): Promise { - if (typeof fn !== "string") { - throw new Error("file name not specified"); - } - let fileName = fn; - // separate file name into two parts if needed - let fileNamePrefix: string | undefined; - if (fileName.length > 100) { - let i = fileName.length; - while (i >= 0) { - i = fileName.lastIndexOf("/", i); - if (i <= 155) { - fileNamePrefix = fileName.substr(0, i); - fileName = fileName.substr(i + 1); - break; - } - i--; - } - const errMsg = - "ustar format does not allow a long file name (length of [file name" + - "prefix] + / + [file name] must be shorter than 256 bytes)"; - if (i < 0 || fileName.length > 100) { - throw new Error(errMsg); - } else { - assert(fileNamePrefix != null); - if (fileNamePrefix.length > 155) { - throw new Error(errMsg); - } - } - } - - opts = opts || {}; - - // set meta data - let info: Deno.FileInfo | undefined; - if (opts.filePath) { - info = await Deno.stat(opts.filePath); - if (info.isDirectory) { - info.size = 0; - opts.reader = new Buffer(); - } - } - - const mode = opts.fileMode || (info && info.mode) || - parseInt("777", 8) & 0xfff, - mtime = Math.floor( - opts.mtime ?? (info?.mtime ?? new Date()).valueOf() / 1000, - ), - uid = opts.uid || 0, - gid = opts.gid || 0; - if (typeof opts.owner === "string" && opts.owner.length >= 32) { - throw new Error( - "ustar format does not allow owner name length >= 32 bytes", - ); - } - if (typeof opts.group === "string" && opts.group.length >= 32) { - throw new Error( - "ustar format does not allow group name length >= 32 bytes", - ); - } - - const fileSize = info?.size ?? opts.contentSize; - assert(fileSize != null, "fileSize must be set"); - - const type = opts.type - ? FileTypes[opts.type as keyof typeof FileTypes] - : (info?.isDirectory ? FileTypes.directory : FileTypes.file); - const tarData: TarDataWithSource = { - fileName, - fileNamePrefix, - fileMode: pad(mode, 7), - uid: pad(uid, 7), - gid: pad(gid, 7), - fileSize: pad(fileSize, 11), - mtime: pad(mtime, 11), - checksum: " ", - type: type.toString(), - ustar, - owner: opts.owner || "", - group: opts.group || "", - filePath: opts.filePath, - reader: opts.reader, - }; - - // calculate the checksum - let checksum = 0; - const encoder = new TextEncoder(); - Object.keys(tarData) - .filter((key): boolean => ["filePath", "reader"].indexOf(key) < 0) - .forEach(function (key): void { - checksum += encoder - .encode(tarData[key as keyof TarData]) - .reduce((p, c): number => p + c, 0); - }); - - tarData.checksum = pad(checksum, 6) + "\u0000 "; - this.data.push(tarData); - } - - /** - * Get a Reader instance for this tar data - */ - getReader(): Reader { - const readers: Reader[] = []; - this.data.forEach((tarData): void => { - let { reader } = tarData; - const { filePath } = tarData; - const headerArr = formatHeader(tarData); - readers.push(new Buffer(headerArr)); - if (!reader) { - assert(filePath != null); - reader = new FileReader(filePath); - } - readers.push(reader); - - // to the nearest multiple of recordSize - assert(tarData.fileSize != null, "fileSize must be set"); - readers.push( - new Buffer( - clean( - recordSize - - (parseInt(tarData.fileSize, 8) % recordSize || recordSize), - ), - ), - ); - }); - - // append 2 empty records - readers.push(new Buffer(clean(recordSize * 2))); - return new MultiReader(...readers); - } -} - -class TarEntry implements Reader { - #header: TarHeader; - #reader: Reader | (Reader & Deno.Seeker); - #size: number; - #read = 0; - #consumed = false; - #entrySize: number; - constructor( - meta: TarMeta, - header: TarHeader, - reader: Reader | (Reader & Deno.Seeker), - ) { - Object.assign(this, meta); - this.#header = header; - this.#reader = reader; - - // File Size - this.#size = this.fileSize || 0; - // Entry Size - const blocks = Math.ceil(this.#size / recordSize); - this.#entrySize = blocks * recordSize; - } - - get consumed(): boolean { - return this.#consumed; - } - - async read(p: Uint8Array): Promise { - // Bytes left for entry - const entryBytesLeft = this.#entrySize - this.#read; - const bufSize = Math.min( - // bufSize can't be greater than p.length nor bytes left in the entry - p.length, - entryBytesLeft, - ); - - if (entryBytesLeft <= 0) { - this.#consumed = true; - return null; - } - - const block = new Uint8Array(bufSize); - const n = await readBlock(this.#reader, block); - const bytesLeft = this.#size - this.#read; - - this.#read += n || 0; - if (n === null || bytesLeft <= 0) { - if (n === null) this.#consumed = true; - return null; - } - - // Remove zero filled - const offset = bytesLeft < n ? bytesLeft : n; - p.set(block.subarray(0, offset), 0); - - return offset < 0 ? n - Math.abs(offset) : offset; - } - - async discard(): Promise { - // Discard current entry - if (this.#consumed) return; - this.#consumed = true; - - if (typeof (this.#reader as Seeker).seek === "function") { - await (this.#reader as Seeker).seek( - this.#entrySize - this.#read, - Deno.SeekMode.Current, - ); - this.#read = this.#entrySize; - } else { - await readAll(this); - } - } -} - -/** - * A class to extract a tar archive - */ -export class Untar { - reader: Reader; - block: Uint8Array; - #entry: TarEntry | undefined; - - constructor(reader: Reader) { - this.reader = reader; - this.block = new Uint8Array(recordSize); - } - - #checksum = (header: Uint8Array): number => { - let sum = initialChecksum; - for (let i = 0; i < 512; i++) { - if (i >= 148 && i < 156) { - // Ignore checksum header - continue; - } - sum += header[i]; - } - return sum; - }; - - #getHeader = async (): Promise => { - await readBlock(this.reader, this.block); - const header = parseHeader(this.block); - - // calculate the checksum - const decoder = new TextDecoder(); - const checksum = this.#checksum(this.block); - - if (parseInt(decoder.decode(header.checksum), 8) !== checksum) { - if (checksum === initialChecksum) { - // EOF - return null; - } - throw new Error("checksum error"); - } - - const magic = decoder.decode(header.ustar); - - if (magic.indexOf("ustar")) { - throw new Error(`unsupported archive format: ${magic}`); - } - - return header; - }; - - #getMetadata = (header: TarHeader): TarMeta => { - const decoder = new TextDecoder(); - // get meta data - const meta: TarMeta = { - fileName: decoder.decode(trim(header.fileName)), - }; - const fileNamePrefix = trim(header.fileNamePrefix); - if (fileNamePrefix.byteLength > 0) { - meta.fileName = decoder.decode(fileNamePrefix) + "/" + meta.fileName; - } - (["fileMode", "mtime", "uid", "gid"] as [ - "fileMode", - "mtime", - "uid", - "gid", - ]).forEach((key): void => { - const arr = trim(header[key]); - if (arr.byteLength > 0) { - meta[key] = parseInt(decoder.decode(arr), 8); - } - }); - (["owner", "group", "type"] as ["owner", "group", "type"]).forEach( - (key): void => { - const arr = trim(header[key]); - if (arr.byteLength > 0) { - meta[key] = decoder.decode(arr); - } - }, - ); - - meta.fileSize = parseInt(decoder.decode(header.fileSize), 8); - meta.type = FileTypes[parseInt(meta.type!)] ?? meta.type; - - return meta; - }; - - async extract(): Promise { - if (this.#entry && !this.#entry.consumed) { - // If entry body was not read, discard the body - // so we can read the next entry. - await this.#entry.discard(); - } - - const header = await this.#getHeader(); - if (header === null) return null; - - const meta = this.#getMetadata(header); - - this.#entry = new TarEntry(meta, header, this.reader); - - return this.#entry; - } - - async *[Symbol.asyncIterator](): AsyncIterableIterator { - while (true) { - const entry = await this.extract(); - - if (entry === null) return; - - yield entry; - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1bb092a8985beb3c101d0c8cebff7023aafe5218.ts b/crates/swc_bundler/tests/.cache/deno/1bb092a8985beb3c101d0c8cebff7023aafe5218.ts deleted file mode 100644 index f90c623a30d4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1bb092a8985beb3c101d0c8cebff7023aafe5218.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isLength.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -type LengthOptions = { - min?: number; - max?: number; -}; - -export const isLength = (str: string, options?: LengthOptions) => { - assertString(str); - - const min = options?.min || 0; - const max = options?.max; - - const surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || []; - const len = str.length - surrogatePairs.length; - return len >= min && (typeof max === 'undefined' || len <= max); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1bd0ce95901d7d41f02892f345773c2c80aee914.ts b/crates/swc_bundler/tests/.cache/deno/1bd0ce95901d7d41f02892f345773c2c80aee914.ts deleted file mode 100644 index 58dbf21ce543..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1bd0ce95901d7d41f02892f345773c2c80aee914.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Loaded from https://deno.land/std/hash/_wasm/hash.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -import init, { - create_hash as createHash, - DenoHash, - digest_hash as digestHash, - source, - update_hash as updateHash, -} from "./wasm.js"; - -import * as hex from "../../encoding/hex.ts"; -import * as base64 from "../../encoding/base64.ts"; -import type { Hasher, Message, OutputFormat } from "../hasher.ts"; - -await init(source); - -const TYPE_ERROR_MSG = "hash: `data` is invalid type"; - -export class Hash implements Hasher { - #hash: DenoHash; - #digested: boolean; - - constructor(algorithm: string) { - this.#hash = createHash(algorithm); - this.#digested = false; - } - - /** - * Update internal state - * @param data data to update - */ - update(data: Message): this { - let msg: Uint8Array; - - if (typeof data === "string") { - msg = new TextEncoder().encode(data as string); - } else if (typeof data === "object") { - if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) { - msg = new Uint8Array(data); - } else { - throw new Error(TYPE_ERROR_MSG); - } - } else { - throw new Error(TYPE_ERROR_MSG); - } - - updateHash(this.#hash, msg); - - return this; - } - - /** Returns final hash */ - digest(): ArrayBuffer { - if (this.#digested) throw new Error("hash: already digested"); - - this.#digested = true; - return digestHash(this.#hash); - } - - /** - * Returns hash as a string of given format - * @param format format of output string (hex or base64). Default is hex - */ - toString(format: OutputFormat = "hex"): string { - const finalized = new Uint8Array(this.digest()); - - switch (format) { - case "hex": - return hex.encodeToString(finalized); - case "base64": - return base64.encode(finalized); - default: - throw new Error("hash: invalid format"); - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1c2d932450b79c54e05590e6e6a3dce706d77229.ts b/crates/swc_bundler/tests/.cache/deno/1c2d932450b79c54e05590e6e6a3dce706d77229.ts deleted file mode 100644 index 76980b62cebb..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1c2d932450b79c54e05590e6e6a3dce706d77229.ts +++ /dev/null @@ -1,125 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/inspect.js - - -import nodejsCustomInspectSymbol from './nodejsCustomInspectSymbol.js'; -const MAX_ARRAY_LENGTH = 10; -const MAX_RECURSIVE_DEPTH = 2; -/** - * Used to print values in error messages. - */ - -export default function inspect(value) { - return formatValue(value, []); -} - -function formatValue(value, seenValues) { - switch (typeof value) { - case 'string': - return JSON.stringify(value); - - case 'function': - return value.name ? `[function ${value.name}]` : '[function]'; - - case 'object': - if (value === null) { - return 'null'; - } - - return formatObjectValue(value, seenValues); - - default: - return String(value); - } -} - -function formatObjectValue(value, previouslySeenValues) { - if (previouslySeenValues.indexOf(value) !== -1) { - return '[Circular]'; - } - - const seenValues = [...previouslySeenValues, value]; - const customInspectFn = getCustomFn(value); - - if (customInspectFn !== undefined) { - // $FlowFixMe(>=0.90.0) - const customValue = customInspectFn.call(value); // check for infinite recursion - - if (customValue !== value) { - return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); - } - } else if (Array.isArray(value)) { - return formatArray(value, seenValues); - } - - return formatObject(value, seenValues); -} - -function formatObject(object, seenValues) { - const keys = Object.keys(object); - - if (keys.length === 0) { - return '{}'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[' + getObjectTag(object) + ']'; - } - - const properties = keys.map(key => { - const value = formatValue(object[key], seenValues); - return key + ': ' + value; - }); - return '{ ' + properties.join(', ') + ' }'; -} - -function formatArray(array, seenValues) { - if (array.length === 0) { - return '[]'; - } - - if (seenValues.length > MAX_RECURSIVE_DEPTH) { - return '[Array]'; - } - - const len = Math.min(MAX_ARRAY_LENGTH, array.length); - const remaining = array.length - len; - const items = []; - - for (let i = 0; i < len; ++i) { - items.push(formatValue(array[i], seenValues)); - } - - if (remaining === 1) { - items.push('... 1 more item'); - } else if (remaining > 1) { - items.push(`... ${remaining} more items`); - } - - return '[' + items.join(', ') + ']'; -} - -function getCustomFn(object) { - const customInspectFn = object[String(nodejsCustomInspectSymbol)]; - - if (typeof customInspectFn === 'function') { - return customInspectFn; - } - - if (typeof object.inspect === 'function') { - return object.inspect; - } -} - -function getObjectTag(object) { - const tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); - - if (tag === 'Object' && typeof object.constructor === 'function') { - const name = object.constructor.name; - - if (typeof name === 'string' && name !== '') { - return name; - } - } - - return tag; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/1c704466d024900efad5fd741596acad3fc58f83.ts b/crates/swc_bundler/tests/.cache/deno/1c704466d024900efad5fd741596acad3fc58f83.ts deleted file mode 100644 index 80cad56a9d3a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1c704466d024900efad5fd741596acad3fc58f83.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/interactions/commands/application_command_interaction_data.ts - - -import { ApplicationCommandInteractionDataOption } from "./application_command_interaction_data_option.ts"; -import { ApplicationCommandInteractionDataResolved } from "./application_command_interaction_data_resolved.ts"; - -/** https://discord.com/developers/docs/interactions/slash-commands#interaction-applicationcommandinteractiondata */ -export interface ApplicationCommandInteractionData { - /** The Id of the invoked command */ - id?: string; - /** The name of the invoked command */ - name?: string; - /** Converted users + roles + channels */ - resolved?: ApplicationCommandInteractionDataResolved; - /** The params + values from the user */ - options?: ApplicationCommandInteractionDataOption[]; - /** with the value you defined for this component */ - customId?: string; - /** The type of this component */ - componentType?: 2; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1c94a232c601b633a5feb4fad3bb61dced4c6929.ts b/crates/swc_bundler/tests/.cache/deno/1c94a232c601b633a5feb4fad3bb61dced4c6929.ts deleted file mode 100644 index 305fc01ededa..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1c94a232c601b633a5feb4fad3bb61dced4c6929.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/validasaur/src/rules/is_email.ts - - -import type { Validity } from "../types.ts"; -import { invalid } from "../utils.ts"; - -export function isEmail(value: any): Validity { - // https://stackoverflow.com/a/46181 - const regex = - /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - if (typeof value !== "string" || !regex.test(value.toLowerCase())) { - return invalid("isEmail", { value }); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1ca0a0c4f846e6d768165adbe3e6eb0f5255aa6b.ts b/crates/swc_bundler/tests/.cache/deno/1ca0a0c4f846e6d768165adbe3e6eb0f5255aa6b.ts deleted file mode 100644 index aa1c69ba64bc..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ca0a0c4f846e6d768165adbe3e6eb0f5255aa6b.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/integrations/INTEGRATION_UPDATE.ts - - -import { eventHandlers } from "../../bot.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { IntegrationCreateUpdate } from "../../types/integrations/integration_create_update.ts"; - -export function handleIntegrationUpdate(data: DiscordGatewayPayload) { - eventHandlers.integrationUpdate?.(data.d as IntegrationCreateUpdate); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1cc7ac0e1510d58095d23a75ae64e342c4d15559.ts b/crates/swc_bundler/tests/.cache/deno/1cc7ac0e1510d58095d23a75ae64e342c4d15559.ts deleted file mode 100644 index 51147f5f93f4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1cc7ac0e1510d58095d23a75ae64e342c4d15559.ts +++ /dev/null @@ -1,1003 +0,0 @@ -// Loaded from https://deno.land/std@0.81.0/path/win32.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -/** This module is browser compatible. */ -import type { FormatInputPathObject, ParsedPath } from "./_interface.ts"; -import { - CHAR_BACKWARD_SLASH, - CHAR_COLON, - CHAR_DOT, - CHAR_QUESTION_MARK, -} from "./_constants.ts"; - -import { - _format, - assertPath, - isPathSeparator, - isWindowsDeviceRoot, - normalizeString, -} from "./_util.ts"; -import { assert } from "../_util/assert.ts"; - -export const sep = "\\"; -export const delimiter = ";"; - -/** - * Resolves path segments into a `path` - * @param pathSegments to process to path - */ -export function resolve(...pathSegments: string[]): string { - let resolvedDevice = ""; - let resolvedTail = ""; - let resolvedAbsolute = false; - - for (let i = pathSegments.length - 1; i >= -1; i--) { - let path: string; - if (i >= 0) { - path = pathSegments[i]; - } else if (!resolvedDevice) { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a drive-letter-less path without a CWD."); - } - path = Deno.cwd(); - } else { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a relative path without a CWD."); - } - // Windows has the concept of drive-specific current working - // directories. If we've resolved a drive letter but not yet an - // absolute path, get cwd for that drive, or the process cwd if - // the drive cwd is not available. We're sure the device is not - // a UNC path at this points, because UNC paths are always absolute. - path = Deno.env.get(`=${resolvedDevice}`) || Deno.cwd(); - - // Verify that a cwd was found and that it actually points - // to our drive. If not, default to the drive's root. - if ( - path === undefined || - path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\` - ) { - path = `${resolvedDevice}\\`; - } - } - - assertPath(path); - - const len = path.length; - - // Skip empty entries - if (len === 0) continue; - - let rootEnd = 0; - let device = ""; - let isAbsolute = false; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - // If we started with a separator, we know we at least have an - // absolute path of some kind (UNC or otherwise) - isAbsolute = true; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - device = `\\\\${firstPart}\\${path.slice(last)}`; - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator - rootEnd = 1; - isAbsolute = true; - } - - if ( - device.length > 0 && - resolvedDevice.length > 0 && - device.toLowerCase() !== resolvedDevice.toLowerCase() - ) { - // This path points to another device so it is not applicable - continue; - } - - if (resolvedDevice.length === 0 && device.length > 0) { - resolvedDevice = device; - } - if (!resolvedAbsolute) { - resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`; - resolvedAbsolute = isAbsolute; - } - - if (resolvedAbsolute && resolvedDevice.length > 0) break; - } - - // At this point the path should be resolved to a full absolute path, - // but handle relative paths to be safe (might happen when process.cwd() - // fails) - - // Normalize the tail path - resolvedTail = normalizeString( - resolvedTail, - !resolvedAbsolute, - "\\", - isPathSeparator, - ); - - return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || "."; -} - -/** - * Normalizes a `path` - * @param path to normalize - */ -export function normalize(path: string): string { - assertPath(path); - const len = path.length; - if (len === 0) return "."; - let rootEnd = 0; - let device: string | undefined; - let isAbsolute = false; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - // If we started with a separator, we know we at least have an absolute - // path of some kind (UNC or otherwise) - isAbsolute = true; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - // Return the normalized version of the UNC root since there - // is nothing left to process - - return `\\\\${firstPart}\\${path.slice(last)}\\`; - } else if (j !== last) { - // We matched a UNC root with leftovers - - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid unnecessary - // work - return "\\"; - } - - let tail: string; - if (rootEnd < len) { - tail = normalizeString( - path.slice(rootEnd), - !isAbsolute, - "\\", - isPathSeparator, - ); - } else { - tail = ""; - } - if (tail.length === 0 && !isAbsolute) tail = "."; - if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) { - tail += "\\"; - } - if (device === undefined) { - if (isAbsolute) { - if (tail.length > 0) return `\\${tail}`; - else return "\\"; - } else if (tail.length > 0) { - return tail; - } else { - return ""; - } - } else if (isAbsolute) { - if (tail.length > 0) return `${device}\\${tail}`; - else return `${device}\\`; - } else if (tail.length > 0) { - return device + tail; - } else { - return device; - } -} - -/** - * Verifies whether path is absolute - * @param path to verify - */ -export function isAbsolute(path: string): boolean { - assertPath(path); - const len = path.length; - if (len === 0) return false; - - const code = path.charCodeAt(0); - if (isPathSeparator(code)) { - return true; - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (len > 2 && path.charCodeAt(1) === CHAR_COLON) { - if (isPathSeparator(path.charCodeAt(2))) return true; - } - } - return false; -} - -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * @param paths to be joined and normalized - */ -export function join(...paths: string[]): string { - const pathsCount = paths.length; - if (pathsCount === 0) return "."; - - let joined: string | undefined; - let firstPart: string | null = null; - for (let i = 0; i < pathsCount; ++i) { - const path = paths[i]; - assertPath(path); - if (path.length > 0) { - if (joined === undefined) joined = firstPart = path; - else joined += `\\${path}`; - } - } - - if (joined === undefined) return "."; - - // Make sure that the joined path doesn't start with two slashes, because - // normalize() will mistake it for an UNC path then. - // - // This step is skipped when it is very clear that the user actually - // intended to point at an UNC path. This is assumed when the first - // non-empty string arguments starts with exactly two slashes followed by - // at least one more non-slash character. - // - // Note that for normalize() to treat a path as an UNC path it needs to - // have at least 2 components, so we don't filter for that here. - // This means that the user can use join to construct UNC paths from - // a server name and a share name; for example: - // path.join('//server', 'share') -> '\\\\server\\share\\') - let needsReplace = true; - let slashCount = 0; - assert(firstPart != null); - if (isPathSeparator(firstPart.charCodeAt(0))) { - ++slashCount; - const firstLen = firstPart.length; - if (firstLen > 1) { - if (isPathSeparator(firstPart.charCodeAt(1))) { - ++slashCount; - if (firstLen > 2) { - if (isPathSeparator(firstPart.charCodeAt(2))) ++slashCount; - else { - // We matched a UNC path in the first part - needsReplace = false; - } - } - } - } - } - if (needsReplace) { - // Find any more consecutive slashes we need to replace - for (; slashCount < joined.length; ++slashCount) { - if (!isPathSeparator(joined.charCodeAt(slashCount))) break; - } - - // Replace the slashes if needed - if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`; - } - - return normalize(joined); -} - -/** - * It will solve the relative path from `from` to `to`, for instance: - * from = 'C:\\orandea\\test\\aaa' - * to = 'C:\\orandea\\impl\\bbb' - * The output of the function should be: '..\\..\\impl\\bbb' - * @param from relative path - * @param to relative path - */ -export function relative(from: string, to: string): string { - assertPath(from); - assertPath(to); - - if (from === to) return ""; - - const fromOrig = resolve(from); - const toOrig = resolve(to); - - if (fromOrig === toOrig) return ""; - - from = fromOrig.toLowerCase(); - to = toOrig.toLowerCase(); - - if (from === to) return ""; - - // Trim any leading backslashes - let fromStart = 0; - let fromEnd = from.length; - for (; fromStart < fromEnd; ++fromStart) { - if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for (; fromEnd - 1 > fromStart; --fromEnd) { - if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const fromLen = fromEnd - fromStart; - - // Trim any leading backslashes - let toStart = 0; - let toEnd = to.length; - for (; toStart < toEnd; ++toStart) { - if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for (; toEnd - 1 > toStart; --toEnd) { - if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const toLen = toEnd - toStart; - - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for (; i <= length; ++i) { - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `from` is the exact base path for `to`. - // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz' - return toOrig.slice(toStart + i + 1); - } else if (i === 2) { - // We get here if `from` is the device root. - // For example: from='C:\\'; to='C:\\foo' - return toOrig.slice(toStart + i); - } - } - if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `to` is the exact base path for `from`. - // For example: from='C:\\foo\\bar'; to='C:\\foo' - lastCommonSep = i; - } else if (i === 2) { - // We get here if `to` is the device root. - // For example: from='C:\\foo\\bar'; to='C:\\' - lastCommonSep = 3; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (fromCode === CHAR_BACKWARD_SLASH) lastCommonSep = i; - } - - // We found a mismatch before the first common path separator was seen, so - // return the original `to`. - if (i !== length && lastCommonSep === -1) { - return toOrig; - } - - let out = ""; - if (lastCommonSep === -1) lastCommonSep = 0; - // Generate the relative path based on the path difference between `to` and - // `from` - for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { - if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) { - if (out.length === 0) out += ".."; - else out += "\\.."; - } - } - - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) { - return out + toOrig.slice(toStart + lastCommonSep, toEnd); - } else { - toStart += lastCommonSep; - if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart; - return toOrig.slice(toStart, toEnd); - } -} - -/** - * Resolves path to a namespace path - * @param path to resolve to namespace - */ -export function toNamespacedPath(path: string): string { - // Note: this will *probably* throw somewhere. - if (typeof path !== "string") return path; - if (path.length === 0) return ""; - - const resolvedPath = resolve(path); - - if (resolvedPath.length >= 3) { - if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) { - // Possible UNC root - - if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) { - const code = resolvedPath.charCodeAt(2); - if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { - // Matched non-long UNC root, convert the path to a long UNC path - return `\\\\?\\UNC\\${resolvedPath.slice(2)}`; - } - } - } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) { - // Possible device root - - if ( - resolvedPath.charCodeAt(1) === CHAR_COLON && - resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH - ) { - // Matched device root, convert the path to a long UNC path - return `\\\\?\\${resolvedPath}`; - } - } - } - - return path; -} - -/** - * Return the directory name of a `path`. - * @param path to determine name for - */ -export function dirname(path: string): string { - assertPath(path); - const len = path.length; - if (len === 0) return "."; - let rootEnd = -1; - let end = -1; - let matchedSlash = true; - let offset = 0; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - rootEnd = offset = 1; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - return path; - } - if (j !== last) { - // We matched a UNC root with leftovers - - // Offset by 1 to include the separator after the UNC root to - // treat it as a "normal root" on top of a (UNC) root - rootEnd = offset = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = offset = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) rootEnd = offset = 3; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - return path; - } - - for (let i = len - 1; i >= offset; --i) { - if (isPathSeparator(path.charCodeAt(i))) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) { - if (rootEnd === -1) return "."; - else end = rootEnd; - } - return path.slice(0, end); -} - -/** - * Return the last portion of a `path`. Trailing directory separators are ignored. - * @param path to process - * @param ext of path directory - */ -export function basename(path: string, ext = ""): string { - if (ext !== undefined && typeof ext !== "string") { - throw new TypeError('"ext" argument must be a string'); - } - - assertPath(path); - - let start = 0; - let end = -1; - let matchedSlash = true; - let i: number; - - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - if (path.length >= 2) { - const drive = path.charCodeAt(0); - if (isWindowsDeviceRoot(drive)) { - if (path.charCodeAt(1) === CHAR_COLON) start = 2; - } - } - - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { - if (ext.length === path.length && ext === path) return ""; - let extIdx = ext.length - 1; - let firstNonSlashEnd = -1; - for (i = path.length - 1; i >= start; --i) { - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else { - if (firstNonSlashEnd === -1) { - // We saw the first non-path separator, remember this index in case - // we need it if the extension ends up not matching - matchedSlash = false; - firstNonSlashEnd = i + 1; - } - if (extIdx >= 0) { - // Try to match the explicit extension - if (code === ext.charCodeAt(extIdx)) { - if (--extIdx === -1) { - // We matched the extension, so mark this as the end of our path - // component - end = i; - } - } else { - // Extension does not match, so our result is the entire path - // component - extIdx = -1; - end = firstNonSlashEnd; - } - } - } - } - - if (start === end) end = firstNonSlashEnd; - else if (end === -1) end = path.length; - return path.slice(start, end); - } else { - for (i = path.length - 1; i >= start; --i) { - if (isPathSeparator(path.charCodeAt(i))) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ""; - return path.slice(start, end); - } -} - -/** - * Return the extension of the `path`. - * @param path with extension - */ -export function extname(path: string): string { - assertPath(path); - let start = 0; - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - - if ( - path.length >= 2 && - path.charCodeAt(1) === CHAR_COLON && - isWindowsDeviceRoot(path.charCodeAt(0)) - ) { - start = startPart = 2; - } - - for (let i = path.length - 1; i >= start; --i) { - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - return ""; - } - return path.slice(startDot, end); -} - -/** - * Generate a path from `FormatInputPathObject` object. - * @param pathObject with path - */ -export function format(pathObject: FormatInputPathObject): string { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError( - `The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`, - ); - } - return _format("\\", pathObject); -} - -/** - * Return a `ParsedPath` object of the `path`. - * @param path to process - */ -export function parse(path: string): ParsedPath { - assertPath(path); - - const ret: ParsedPath = { root: "", dir: "", base: "", ext: "", name: "" }; - - const len = path.length; - if (len === 0) return ret; - - let rootEnd = 0; - let code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - rootEnd = 1; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - - rootEnd = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - if (len === 3) { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - rootEnd = 3; - } - } else { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - - if (rootEnd > 0) ret.root = path.slice(0, rootEnd); - - let startDot = -1; - let startPart = rootEnd; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Get non-dir info - for (; i >= rootEnd; --i) { - code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - if (end !== -1) { - ret.base = ret.name = path.slice(startPart, end); - } - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - ret.ext = path.slice(startDot, end); - } - - // If the directory is the root, use the entire root as the `dir` including - // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the - // trailing slash (`C:\abc\def` -> `C:\abc`). - if (startPart > 0 && startPart !== rootEnd) { - ret.dir = path.slice(0, startPart - 1); - } else ret.dir = ret.root; - - return ret; -} - -/** - * Converts a file URL to a path string. - * - * fromFileUrl("file:///home/foo"); // "\\home\\foo" - * fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo" - * fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo" - * @param url of a file URL - */ -export function fromFileUrl(url: string | URL): string { - url = url instanceof URL ? url : new URL(url); - if (url.protocol != "file:") { - throw new TypeError("Must be a file URL."); - } - let path = decodeURIComponent( - url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25"), - ).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); - if (url.hostname != "") { - // Note: The `URL` implementation guarantees that the drive letter and - // hostname are mutually exclusive. Otherwise it would not have been valid - // to append the hostname and path like this. - path = `\\\\${url.hostname}${path}`; - } - return path; -} - -/** - * Converts a path string to a file URL. - * - * toFileUrl("\\home\\foo"); // new URL("file:///home/foo") - * toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo") - * toFileUrl("\\\\localhost\\home\\foo"); // new URL("file://localhost/home/foo") - * @param path to convert to file URL - */ -export function toFileUrl(path: string): URL { - if (!isAbsolute(path)) { - throw new TypeError("Must be an absolute path."); - } - const [, hostname, pathname] = path.match( - /^(?:[/\\]{2}([^/\\]+)(?=[/\\][^/\\]))?(.*)/, - )!; - const url = new URL("file:///"); - url.pathname = pathname.replace(/%/g, "%25"); - if (hostname != null) { - url.hostname = hostname; - if (!url.hostname) { - throw new TypeError("Invalid hostname."); - } - } - return url; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1ce8a95d0b5f273dd7ac2d6e32ddaeeb16285913.ts b/crates/swc_bundler/tests/.cache/deno/1ce8a95d0b5f273dd7ac2d6e32ddaeeb16285913.ts deleted file mode 100644 index 2892bb857d23..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ce8a95d0b5f273dd7ac2d6e32ddaeeb16285913.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/audit_log/mod.ts - - -export * from "./audit_log.ts"; -export * from "./audit_log_change.ts"; -export * from "./audit_log_change_value.ts"; -export * from "./audit_log_entry.ts"; -export * from "./audit_log_events.ts"; -export * from "./get_guild_audit_log.ts"; -export * from "./optional_audit_entry_info.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/1d264b326a56d2da3f4916061b2d7ba8fd120cdd.ts b/crates/swc_bundler/tests/.cache/deno/1d264b326a56d2da3f4916061b2d7ba8fd120cdd.ts deleted file mode 100644 index 6c7454d499d0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1d264b326a56d2da3f4916061b2d7ba8fd120cdd.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_of.js - - -export default function _of(x) { return [x]; } diff --git a/crates/swc_bundler/tests/.cache/deno/1d2e15181dc539bfe8e9784b45df9eb58aa1bd10.ts b/crates/swc_bundler/tests/.cache/deno/1d2e15181dc539bfe8e9784b45df9eb58aa1bd10.ts deleted file mode 100644 index 12de9655d39d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1d2e15181dc539bfe8e9784b45df9eb58aa1bd10.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/tap.js - - -import _curry2 from './internal/_curry2.js'; -import _dispatchable from './internal/_dispatchable.js'; -import _xtap from './internal/_xtap.js'; - - -/** - * Runs the given function with the supplied object, then returns the object. - * - * Acts as a transducer if a transformer is given as second parameter. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Function - * @sig (a -> *) -> a -> a - * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away. - * @param {*} x - * @return {*} `x`. - * @example - * - * const sayX = x => console.log('x is ' + x); - * R.tap(sayX, 100); //=> 100 - * // logs 'x is 100' - * @symb R.tap(f, a) = a - */ -var tap = _curry2(_dispatchable([], _xtap, function tap(fn, x) { - fn(x); - return x; -})); -export default tap; diff --git a/crates/swc_bundler/tests/.cache/deno/1d4a3723429f81f8242f9c87454d60c0f11b48d2.ts b/crates/swc_bundler/tests/.cache/deno/1d4a3723429f81f8242f9c87454d60c0f11b48d2.ts deleted file mode 100644 index 819f26a8138f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1d4a3723429f81f8242f9c87454d60c0f11b48d2.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/table/lib/row.ts - - -import { Cell, ICell } from './cell.ts'; - -export type IRow = T[] | Row; -export type IDataRow = Record; - -export interface IRowOptions { - indent?: number; - border?: boolean; -} - -export class Row extends Array { - - protected options: IRowOptions = {}; - - public static from( cells: IRow ): Row { - const row = new this( ...cells ); - if ( cells instanceof Row ) { - row.options = Object.assign( {}, cells.options ); - } - return row; - } - - public clone(): Row { - const row = new Row( ...this.map( ( cell: T ) => - cell instanceof Cell ? cell.clone() : cell ) ); - row.options = Object.assign( {}, this.options ); - return row; - } - - /** - * Setter: - */ - - public border( enable: boolean, override: boolean = true ): this { - if ( override || typeof this.options.border === 'undefined' ) { - this.options.border = enable; - } - return this; - } - - /** - * Getter: - */ - - public getBorder(): boolean { - return this.options.border === true; - } - - public hasBorder(): boolean { - return this.getBorder() || this.some( cell => cell instanceof Cell && cell.getBorder() ); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1d587601653b6b01ec687661cd35b698d9503137.ts b/crates/swc_bundler/tests/.cache/deno/1d587601653b6b01ec687661cd35b698d9503137.ts deleted file mode 100644 index f61d1226b69e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1d587601653b6b01ec687661cd35b698d9503137.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/members/search_guild_members.ts - - -/** https://discord.com/developers/docs/resources/guild#search-guild-members-query-string-params */ -export interface SearchGuildMembers { - /** Query string to match username(s) and nickname(s) against */ - query: string; - /** Max number of members to return (1-1000). Default: 1 */ - limit?: number; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1d7d1c1e1a2c07b345548f79d2e593adb3054812.ts b/crates/swc_bundler/tests/.cache/deno/1d7d1c1e1a2c07b345548f79d2e593adb3054812.ts deleted file mode 100644 index 34e3fd8b7bc6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1d7d1c1e1a2c07b345548f79d2e593adb3054812.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/isNil.js - - -import _curry1 from './internal/_curry1.js'; - - -/** - * Checks if the input value is `null` or `undefined`. - * - * @func - * @memberOf R - * @since v0.9.0 - * @category Type - * @sig * -> Boolean - * @param {*} x The value to test. - * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`. - * @example - * - * R.isNil(null); //=> true - * R.isNil(undefined); //=> true - * R.isNil(0); //=> false - * R.isNil([]); //=> false - */ -var isNil = _curry1(function isNil(x) { return x == null; }); -export default isNil; diff --git a/crates/swc_bundler/tests/.cache/deno/1de8150cd53e58efec03968654c0e0240e6fa5b4.ts b/crates/swc_bundler/tests/.cache/deno/1de8150cd53e58efec03968654c0e0240e6fa5b4.ts deleted file mode 100644 index 52473365401b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1de8150cd53e58efec03968654c0e0240e6fa5b4.ts +++ /dev/null @@ -1,153 +0,0 @@ -// Loaded from https://deno.land/x/media_types@v2.4.7/mod.ts - - -/*! - * Ported from: https://github.com/jshttp/mime-types and licensed as: - * - * (The MIT License) - * - * Copyright (c) 2014 Jonathan Ong - * Copyright (c) 2015 Douglas Christopher Wilson - * Copyright (c) 2020 the Deno authors - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * 'Software'), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import { db } from "./db.ts"; -import { extname } from "./deps.ts"; - -const EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/; -const TEXT_TYPE_REGEXP = /^text\//i; - -/** A map of extensions for a given media type */ -export const extensions = new Map(); - -/** A map of the media type for a given extension */ -export const types = new Map(); - -/** Internal function to populate the maps based on the Mime DB */ -function populateMaps( - extensions: Map, - types: Map, -): void { - const preference = ["nginx", "apache", undefined, "iana"]; - - for (const type of Object.keys(db)) { - const mime = db[type]; - const exts = mime.extensions; - - if (!exts || !exts.length) { - continue; - } - - extensions.set(type, exts); - - for (const ext of exts) { - const current = types.get(ext); - if (current) { - const from = preference.indexOf(db[current].source); - const to = preference.indexOf(mime.source); - - if ( - current !== "application/octet-stream" && - (from > to || - (from === to && current.substr(0, 12) === "application/")) - ) { - continue; - } - } - - types.set(ext, type); - } - } -} - -// Populate the maps upon module load -populateMaps(extensions, types); - -/** Given a media type return any default charset string. Returns `undefined` - * if not resolvable. - */ -export function charset(type: string): string | undefined { - const m = EXTRACT_TYPE_REGEXP.exec(type); - if (!m) { - return; - } - const [match] = m; - const mime = db[match.toLowerCase()]; - - if (mime && mime.charset) { - return mime.charset; - } - - if (TEXT_TYPE_REGEXP.test(match)) { - return "UTF-8"; - } -} - -/** Given an extension, lookup the appropriate media type for that extension. - * Likely you should be using `contentType()` though instead. - */ -export function lookup(path: string): string | undefined { - const extension = extname("x." + path) - .toLowerCase() - .substr(1); - - return types.get(extension); -} - -/** Given an extension or media type, return the full `Content-Type` header - * string. Returns `undefined` if not resolvable. - */ -export function contentType(str: string): string | undefined { - let mime = str.includes("/") ? str : lookup(str); - - if (!mime) { - return; - } - - if (!mime.includes("charset")) { - const cs = charset(mime); - if (cs) { - mime += `; charset=${cs.toLowerCase()}`; - } - } - - return mime; -} - -/** Given a media type, return the most appropriate extension or return - * `undefined` if there is none. - */ -export function extension(type: string): string | undefined { - const match = EXTRACT_TYPE_REGEXP.exec(type); - - if (!match) { - return; - } - - const exts = extensions.get(match[1].toLowerCase()); - - if (!exts || !exts.length) { - return; - } - - return exts[0]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1decd533a4b3cddede80ab6124372e87a6e9ac83.ts b/crates/swc_bundler/tests/.cache/deno/1decd533a4b3cddede80ab6124372e87a6e9ac83.ts deleted file mode 100644 index 3d0792a0b149..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1decd533a4b3cddede80ab6124372e87a6e9ac83.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/all.js - - -import _curry2 from './internal/_curry2.js'; -import _dispatchable from './internal/_dispatchable.js'; -import _xall from './internal/_xall.js'; - - -/** - * Returns `true` if all elements of the list match the predicate, `false` if - * there are any that don't. - * - * Dispatches to the `all` method of the second argument, if present. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig (a -> Boolean) -> [a] -> Boolean - * @param {Function} fn The predicate function. - * @param {Array} list The array to consider. - * @return {Boolean} `true` if the predicate is satisfied by every element, `false` - * otherwise. - * @see R.any, R.none, R.transduce - * @example - * - * const equals3 = R.equals(3); - * R.all(equals3)([3, 3, 3, 3]); //=> true - * R.all(equals3)([3, 3, 1, 3]); //=> false - */ -var all = _curry2(_dispatchable(['all'], _xall, function all(fn, list) { - var idx = 0; - while (idx < list.length) { - if (!fn(list[idx])) { - return false; - } - idx += 1; - } - return true; -})); -export default all; diff --git a/crates/swc_bundler/tests/.cache/deno/1dee43122f76d3b4c8fd31ea058551b766a6f36f.ts b/crates/swc_bundler/tests/.cache/deno/1dee43122f76d3b4c8fd31ea058551b766a6f36f.ts deleted file mode 100644 index 23af548d9208..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1dee43122f76d3b4c8fd31ea058551b766a6f36f.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/channels/get_channel_webhooks.ts - - -import { rest } from "../../rest/rest.ts"; -import type { Webhook } from "../../types/webhooks/webhook.ts"; -import { Collection } from "../../util/collection.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotChannelPermissions } from "../../util/permissions.ts"; - -/** Gets the webhooks for this channel. Requires MANAGE_WEBHOOKS */ -export async function getChannelWebhooks(channelId: bigint) { - await requireBotChannelPermissions(channelId, ["MANAGE_WEBHOOKS"]); - - const result = await rest.runMethod("get", endpoints.CHANNEL_WEBHOOKS(channelId)); - - return new Collection(result.map((webhook) => [webhook.id, webhook])); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1df917ce33031ac28d35aee85f13aad03e1cf3b9.ts b/crates/swc_bundler/tests/.cache/deno/1df917ce33031ac28d35aee85f13aad03e1cf3b9.ts deleted file mode 100644 index cb0f537fefc0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1df917ce33031ac28d35aee85f13aad03e1cf3b9.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/prompt/mod.ts - - -export * from "./figures.ts"; -export * from "./_generic_prompt.ts"; -export * from "./_generic_input.ts"; -export * from "./_generic_list.ts"; - -export * from "./checkbox.ts"; -export * from "./confirm.ts"; -export * from "./input.ts"; -export * from "./list.ts"; -export * from "./number.ts"; -export * from "./secret.ts"; -export * from "./select.ts"; -export * from "./toggle.ts"; - -export * from "./prompt.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/1dfd4a9b35173d9489abdc782f55d0d4b8a431b8.ts b/crates/swc_bundler/tests/.cache/deno/1dfd4a9b35173d9489abdc782f55d0d4b8a431b8.ts deleted file mode 100644 index 1b9617e39e1d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1dfd4a9b35173d9489abdc782f55d0d4b8a431b8.ts +++ /dev/null @@ -1,61 +0,0 @@ -// Loaded from https://deno.land/std/encoding/base64.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -// deno-fmt-ignore -const base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", - "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", - "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", - "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", "+", "/"]; - -/** - * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 - * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation - * @param data - */ -export function encode(data: ArrayBuffer | string): string { - const uint8 = typeof data === "string" - ? new TextEncoder().encode(data) - : data instanceof Uint8Array - ? data - : new Uint8Array(data); - let result = "", - i; - const l = uint8.length; - for (i = 2; i < l; i += 3) { - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; - result += base64abc[((uint8[i - 1] & 0x0f) << 2) | (uint8[i] >> 6)]; - result += base64abc[uint8[i] & 0x3f]; - } - if (i === l + 1) { - // 1 octet yet to write - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[(uint8[i - 2] & 0x03) << 4]; - result += "=="; - } - if (i === l) { - // 2 octets yet to write - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; - result += base64abc[(uint8[i - 1] & 0x0f) << 2]; - result += "="; - } - return result; -} - -/** - * Decodes a given RFC4648 base64 encoded string - * @param b64 - */ -export function decode(b64: string): Uint8Array { - const binString = atob(b64); - const size = binString.length; - const bytes = new Uint8Array(size); - for (let i = 0; i < size; i++) { - bytes[i] = binString.charCodeAt(i); - } - return bytes; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1e1d3032f76952002512c3f6d047ba419d12841d.ts b/crates/swc_bundler/tests/.cache/deno/1e1d3032f76952002512c3f6d047ba419d12841d.ts deleted file mode 100644 index a454c2968269..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1e1d3032f76952002512c3f6d047ba419d12841d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/messages/message_reaction_remove.ts - - -import { MessageReactionAdd } from "./message_reaction_add.ts"; - -/** https://discord.com/developers/docs/topics/gateway#message-reaction-remove */ -export type MessageReactionRemove = Omit; diff --git a/crates/swc_bundler/tests/.cache/deno/1e3611887d74fbc5aa1c5e5e9211e8ba09127a7f.ts b/crates/swc_bundler/tests/.cache/deno/1e3611887d74fbc5aa1c5e5e9211e8ba09127a7f.ts deleted file mode 100644 index b05da024484b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1e3611887d74fbc5aa1c5e5e9211e8ba09127a7f.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/mod.ts - - -export * from "./ban.ts"; -export * from "./begin_guild_prune.ts"; -export * from "./create_guild.ts"; -export * from "./create_guild_ban.ts"; -export * from "./create_guild_channel.ts"; -export * from "./create_guild_role.ts"; -export * from "./default_message_notification_levels.ts"; -export * from "./explicit_content_filter_levels.ts"; -export * from "./get_guild.ts"; -export * from "./get_guild_prune_count.ts"; -export * from "./get_guild_widget_image.ts"; -export * from "./get_guild_widget_image_style_options.ts"; -export * from "./guild.ts"; -export * from "./guild_ban_add_remove.ts"; -export * from "./guild_ban_remove.ts"; -export * from "./guild_features.ts"; -export * from "./guild_preview.ts"; -export * from "./guild_role_create.ts"; -export * from "./guild_role_delete.ts"; -export * from "./guild_role_update.ts"; -export * from "./guild_widget.ts"; -export * from "./guild_widget_details.ts"; -export * from "./mfa_levels.ts"; -export * from "./modify_guild.ts"; -export * from "./modify_guild_channel_position.ts"; -export * from "./modify_guild_member.ts"; -export * from "./modify_guild_role.ts"; -export * from "./modify_guild_role_positions.ts"; -export * from "./modify_guild_welcome_screen.ts"; -export * from "./premium_tiers.ts"; -export * from "./system_channel_flags.ts"; -export * from "./unavailable_guild.ts"; -export * from "./update_others_voice_state.ts"; -export * from "./update_self_voice_state.ts"; -export * from "./verification_levels.ts"; -export * from "./welcome_screen.ts"; -export * from "./welcome_screen_channel.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/1e425603b458319a84c69cb564936fca745ddd13.ts b/crates/swc_bundler/tests/.cache/deno/1e425603b458319a84c69cb564936fca745ddd13.ts deleted file mode 100644 index a2d86b581ebc..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1e425603b458319a84c69cb564936fca745ddd13.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/pako/lib/zlib/zstream.js - - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -export function ZStream() { - /* next input byte */ - this.input = null; // JS specific, because we have no pointers - this.next_in = 0; - /* number of bytes available at input */ - this.avail_in = 0; - /* total number of input bytes read so far */ - this.total_in = 0; - /* next output byte should be put there */ - this.output = null; // JS specific, because we have no pointers - this.next_out = 0; - /* remaining free space at output */ - this.avail_out = 0; - /* total number of bytes output so far */ - this.total_out = 0; - /* last error message, NULL if no error */ - this.msg = ''/*Z_NULL*/; - /* not visible by applications */ - this.state = null; - /* best guess about the data type: binary or text */ - this.data_type = 2/*Z_UNKNOWN*/; - /* adler32 value of the uncompressed data */ - this.adler = 0; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1e5f425f88f8d6a6fe07dd802d9c56d0a464ab10.ts b/crates/swc_bundler/tests/.cache/deno/1e5f425f88f8d6a6fe07dd802d9c56d0a464ab10.ts deleted file mode 100644 index 8d60a21634f1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1e5f425f88f8d6a6fe07dd802d9c56d0a464ab10.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/dropRepeats.js - - -import _curry1 from './internal/_curry1.js'; -import _dispatchable from './internal/_dispatchable.js'; -import _xdropRepeatsWith from './internal/_xdropRepeatsWith.js'; -import dropRepeatsWith from './dropRepeatsWith.js'; -import equals from './equals.js'; - - -/** - * Returns a new list without any consecutively repeating elements. - * [`R.equals`](#equals) is used to determine equality. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category List - * @sig [a] -> [a] - * @param {Array} list The array to consider. - * @return {Array} `list` without repeating elements. - * @see R.transduce - * @example - * - * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] - */ -var dropRepeats = _curry1( - _dispatchable([], _xdropRepeatsWith(equals), dropRepeatsWith(equals)) -); -export default dropRepeats; diff --git a/crates/swc_bundler/tests/.cache/deno/1e6adcffc2ad6931824a313d09e20e4b1db0c077.ts b/crates/swc_bundler/tests/.cache/deno/1e6adcffc2ad6931824a313d09e20e4b1db0c077.ts deleted file mode 100644 index a795efdebba5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1e6adcffc2ad6931824a313d09e20e4b1db0c077.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Loaded from https://deno.land/std@0.81.0/datetime/tokenizer.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -export type Token = { - type: string; - value: string | number; - index: number; - [key: string]: unknown; -}; - -export interface ReceiverResult { - [name: string]: string | number | unknown; -} -export type CallbackResult = { - type: string; - value: string | number; - [key: string]: unknown; -}; -type CallbackFunction = (value: unknown) => CallbackResult; - -export type TestResult = { value: unknown; length: number } | undefined; -export type TestFunction = ( - string: string, -) => TestResult | undefined; - -export interface Rule { - test: TestFunction; - fn: CallbackFunction; -} - -export class Tokenizer { - rules: Rule[]; - - constructor(rules: Rule[] = []) { - this.rules = rules; - } - - addRule(test: TestFunction, fn: CallbackFunction): Tokenizer { - this.rules.push({ test, fn }); - return this; - } - - tokenize( - string: string, - receiver = (token: Token): ReceiverResult => token, - ): ReceiverResult[] { - function* generator(rules: Rule[]): IterableIterator { - let index = 0; - for (const rule of rules) { - const result = rule.test(string); - if (result) { - const { value, length } = result; - index += length; - string = string.slice(length); - const token = { ...rule.fn(value), index }; - yield receiver(token); - yield* generator(rules); - } - } - } - const tokenGenerator = generator(this.rules); - - const tokens: ReceiverResult[] = []; - - for (const token of tokenGenerator) { - tokens.push(token); - } - - if (string.length) { - throw new Error( - `parser error: string not fully parsed! ${string.slice(0, 25)}`, - ); - } - - return tokens; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1e70110a27b77ce4047986f5401326ad4ef7b5c8.ts b/crates/swc_bundler/tests/.cache/deno/1e70110a27b77ce4047986f5401326ad4ef7b5c8.ts deleted file mode 100644 index 41e1c0a9c859..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1e70110a27b77ce4047986f5401326ad4ef7b5c8.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/takeLast.js - - -import _curry2 from './internal/_curry2.js'; -import drop from './drop.js'; - - -/** - * Returns a new list containing the last `n` elements of the given list. - * If `n > list.length`, returns a list of `list.length` elements. - * - * @func - * @memberOf R - * @since v0.16.0 - * @category List - * @sig Number -> [a] -> [a] - * @sig Number -> String -> String - * @param {Number} n The number of elements to return. - * @param {Array} xs The collection to consider. - * @return {Array} - * @see R.dropLast - * @example - * - * R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz'] - * R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] - * R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] - * R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] - * R.takeLast(3, 'ramda'); //=> 'mda' - */ -var takeLast = _curry2(function takeLast(n, xs) { - return drop(n >= 0 ? xs.length - n : 0, xs); -}); -export default takeLast; diff --git a/crates/swc_bundler/tests/.cache/deno/1ea734242118f7ccc262c1caa4bcc639a2fe709b.ts b/crates/swc_bundler/tests/.cache/deno/1ea734242118f7ccc262c1caa4bcc639a2fe709b.ts deleted file mode 100644 index cbc30764416b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ea734242118f7ccc262c1caa4bcc639a2fe709b.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/activity/activity_timestamps.ts - - -/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-timestamps */ -export interface ActivityTimestamps { - /** Unix time (in milliseconds) of when the activity started */ - start?: number; - /** Unix time (in milliseconds) of when the activity ends */ - end?: number; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1eae6cb756fd595674695de852cdb68c7e346d2d.ts b/crates/swc_bundler/tests/.cache/deno/1eae6cb756fd595674695de852cdb68c7e346d2d.ts deleted file mode 100644 index c43b4bf2d2af..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1eae6cb756fd595674695de852cdb68c7e346d2d.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/webhooks/create_webhook.ts - - -import { rest } from "../../rest/rest.ts"; -import { Errors } from "../../types/discordeno/errors.ts"; -import type { CreateWebhook } from "../../types/webhooks/create_webhook.ts"; -import type { Webhook } from "../../types/webhooks/webhook.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotChannelPermissions } from "../../util/permissions.ts"; -import { urlToBase64 } from "../../util/utils.ts"; -import { validateLength } from "../../util/validate_length.ts"; - -/** - * Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations: - * - * Webhook names cannot be: 'clyde' - */ -export async function createWebhook(channelId: bigint, options: CreateWebhook) { - await requireBotChannelPermissions(channelId, ["MANAGE_WEBHOOKS"]); - - if ( - // Specific usernames that discord does not allow - options.name === "clyde" || - !validateLength(options.name, { min: 2, max: 32 }) - ) { - throw new Error(Errors.INVALID_WEBHOOK_NAME); - } - - return await rest.runMethod("post", endpoints.CHANNEL_WEBHOOKS(channelId), { - ...options, - avatar: options.avatar ? await urlToBase64(options.avatar) : undefined, - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1ecf7bba1624502a5f3159b7bd7c948afcfa6f8d.ts b/crates/swc_bundler/tests/.cache/deno/1ecf7bba1624502a5f3159b7bd7c948afcfa6f8d.ts deleted file mode 100644 index f05bcfb17281..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ecf7bba1624502a5f3159b7bd7c948afcfa6f8d.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/uniq.js - - -import identity from './identity.js'; -import uniqBy from './uniqBy.js'; - - -/** - * Returns a new list containing only one copy of each element in the original - * list. [`R.equals`](#equals) is used to determine equality. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig [a] -> [a] - * @param {Array} list The array to consider. - * @return {Array} The list of unique items. - * @example - * - * R.uniq([1, 1, 2, 1]); //=> [1, 2] - * R.uniq([1, '1']); //=> [1, '1'] - * R.uniq([[42], [42]]); //=> [[42]] - */ -var uniq = uniqBy(identity); -export default uniq; diff --git a/crates/swc_bundler/tests/.cache/deno/1ee173bc90e59030878ab7e8704cbe8bbedb2622.ts b/crates/swc_bundler/tests/.cache/deno/1ee173bc90e59030878ab7e8704cbe8bbedb2622.ts deleted file mode 100644 index 9864ddd2a794..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ee173bc90e59030878ab7e8704cbe8bbedb2622.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/findLast.js - - -import _curry2 from './internal/_curry2.js'; -import _dispatchable from './internal/_dispatchable.js'; -import _xfindLast from './internal/_xfindLast.js'; - - -/** - * Returns the last element of the list which matches the predicate, or - * `undefined` if no element matches. - * - * Acts as a transducer if a transformer is given in list position. - * - * @func - * @memberOf R - * @since v0.1.1 - * @category List - * @sig (a -> Boolean) -> [a] -> a | undefined - * @param {Function} fn The predicate function used to determine if the element is the - * desired one. - * @param {Array} list The array to consider. - * @return {Object} The element found, or `undefined`. - * @see R.transduce - * @example - * - * const xs = [{a: 1, b: 0}, {a:1, b: 1}]; - * R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} - * R.findLast(R.propEq('a', 4))(xs); //=> undefined - */ -var findLast = _curry2(_dispatchable([], _xfindLast, function findLast(fn, list) { - var idx = list.length - 1; - while (idx >= 0) { - if (fn(list[idx])) { - return list[idx]; - } - idx -= 1; - } -})); -export default findLast; diff --git a/crates/swc_bundler/tests/.cache/deno/1ee353624ef6241df943ac3d4ead4415d9f2d033.ts b/crates/swc_bundler/tests/.cache/deno/1ee353624ef6241df943ac3d4ead4415d9f2d033.ts deleted file mode 100644 index 5d69442bf8a8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ee353624ef6241df943ac3d4ead4415d9f2d033.ts +++ /dev/null @@ -1,158 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.18.0/prompt/_generic_input.ts - - -import type { KeyEvent } from "../keycode/key_event.ts"; -import { - GenericPrompt, - GenericPromptKeys, - GenericPromptOptions, - GenericPromptSettings, -} from "./_generic_prompt.ts"; -import { blue, dim, stripColor, underline } from "./deps.ts"; - -/** Input keys options. */ -export interface GenericInputKeys extends GenericPromptKeys { - moveCursorLeft?: string[]; - moveCursorRight?: string[]; - deleteCharLeft?: string[]; - deleteCharRight?: string[]; -} - -/** Generic input prompt options. */ -export interface GenericInputPromptOptions - extends GenericPromptOptions { - keys?: GenericInputKeys; -} - -/** Generic input prompt settings. */ -export interface GenericInputPromptSettings - extends GenericPromptSettings { - keys?: GenericInputKeys; -} - -/** Generic input prompt representation. */ -export abstract class GenericInput< - T, - V, - S extends GenericInputPromptSettings, -> extends GenericPrompt { - protected inputValue = ""; - protected inputIndex = 0; - - /** - * Prompt constructor. - * @param settings Prompt settings. - */ - protected constructor(settings: S) { - super({ - ...settings, - keys: { - moveCursorLeft: ["left"], - moveCursorRight: ["right"], - deleteCharLeft: ["backspace"], - deleteCharRight: ["delete"], - ...(settings.keys ?? {}), - }, - }); - } - - protected getCurrentInputValue(): string { - return this.inputValue; - } - - protected message(): string { - const message: string = super.message() + " " + this.settings.pointer + " "; - this.cursor.x = stripColor(message).length + this.inputIndex + 1; - return message + this.input(); - } - - protected input(): string { - return underline(this.inputValue); - } - - protected highlight( - value: string | number, - color1: (val: string) => string = dim, - color2: (val: string) => string = blue, - ): string { - value = value.toString(); - const inputLowerCase = this.getCurrentInputValue().toLowerCase(); - const valueLowerCase = value.toLowerCase(); - const index = valueLowerCase.indexOf(inputLowerCase); - const matched: string = value.slice(index, index + inputLowerCase.length); - return index >= 0 - ? color1(value.slice(0, index)) + color2(matched) + - color1(value.slice(index + inputLowerCase.length)) - : value; - } - - /** - * Handle user input event. - * @param event Key event. - */ - protected async handleEvent(event: KeyEvent): Promise { - switch (true) { - case event.name === "c" && event.ctrl: - this.clear(); - this.tty.cursorShow(); - Deno.exit(0); - return; - case this.isKey(this.settings.keys, "moveCursorLeft", event): - this.moveCursorLeft(); - break; - case this.isKey(this.settings.keys, "moveCursorRight", event): - this.moveCursorRight(); - break; - case this.isKey(this.settings.keys, "deleteCharRight", event): - this.deleteCharRight(); - break; - case this.isKey(this.settings.keys, "deleteCharLeft", event): - this.deleteChar(); - break; - case this.isKey(this.settings.keys, "submit", event): - await this.submit(); - break; - default: - if (event.sequence && !event.meta && !event.ctrl) { - this.addChar(event.sequence); - } - } - } - - /** Add character to current input. */ - protected addChar(char: string): void { - this.inputValue = this.inputValue.slice(0, this.inputIndex) + char + - this.inputValue.slice(this.inputIndex); - this.inputIndex++; - } - - /** Move prompt cursor left. */ - protected moveCursorLeft(): void { - if (this.inputIndex > 0) { - this.inputIndex--; - } - } - - /** Move prompt cursor right. */ - protected moveCursorRight(): void { - if (this.inputIndex < this.inputValue.length) { - this.inputIndex++; - } - } - - /** Delete char left. */ - protected deleteChar(): void { - if (this.inputIndex > 0) { - this.inputIndex--; - this.deleteCharRight(); - } - } - - /** Delete char right. */ - protected deleteCharRight(): void { - if (this.inputIndex < this.inputValue.length) { - this.inputValue = this.inputValue.slice(0, this.inputIndex) + - this.inputValue.slice(this.inputIndex + 1); - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/1ee87725016ae057029c33381458b238686cdf0e.ts b/crates/swc_bundler/tests/.cache/deno/1ee87725016ae057029c33381458b238686cdf0e.ts deleted file mode 100644 index 8a88a338fe1d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ee87725016ae057029c33381458b238686cdf0e.ts +++ /dev/null @@ -1,84 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/tar/mod.ts - - -import { Tar, Untar, ensureDir, path } from "../deps.ts"; -import type { compressInterface } from "../interface.ts"; - -export async function uncompress(src: string, dest: string): Promise { - const reader = await Deno.open(src, { read: true }); - const untar = new Untar(reader); - for await (const entry of untar) { - const filePath = path.resolve(dest, entry.fileName); - if (entry.type === "directory") { - await ensureDir(filePath); - continue; - } - await ensureDir(path.dirname(filePath)); - const file = await Deno.open(filePath, { write: true, create: true }); - await Deno.copy(entry, file); - await file.close(); - } - reader.close(); -} - -export async function compress( - src: string, - dest: string, - options?: compressInterface, -): Promise { - const tar = new Tar(); - const stat = await Deno.lstat(src); - if (stat.isFile) { - await tar.append(path.basename(src), { - filePath: src, - contentSize: stat.size, - mtime: (stat?.mtime ?? new Date()).valueOf() / 1000, - }); - } else { - const appendFolder = async (folder: string, prefix?: string) => { - for await (const entry of Deno.readDir(folder)) { - const { isDirectory, name } = entry; - const fileName = prefix ? `${prefix}/${name}` : name; - const filePath = path.resolve(folder, name); - const stat = await Deno.stat(filePath); - if (isDirectory) { - await tar.append( - `${fileName}/`, - { - reader: new Deno.Buffer(), - contentSize: 0, - type: "directory", - mtime: (stat?.mtime ?? new Date()).valueOf() / 1000, - }, - ); - await appendFolder(filePath, fileName); - } else { - await tar.append(fileName, { - filePath, - mtime: (stat?.mtime ?? new Date()).valueOf() / 1000, - contentSize: stat.size, - }); - } - } - }; - if (options?.excludeSrc) { - await appendFolder(src); - } else { - const folderName = path.basename(src); - await tar.append( - `${folderName}/`, - { - filePath: src, - // type: "directory", - // mtime: (stat?.mtime ?? new Date()).valueOf() / 1000, - // contentSize: 0, - // reader: new Deno.Buffer(), - }, - ); - await appendFolder(src, folderName); - } - } - const writer = await Deno.open(dest, { write: true, create: true }); - await Deno.copy(tar.getReader(), writer); - writer.close(); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1f0dc9b13a24de08f6bc89d190c17b85afb3c770.ts b/crates/swc_bundler/tests/.cache/deno/1f0dc9b13a24de08f6bc89d190c17b85afb3c770.ts deleted file mode 100644 index a753fe066cb0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1f0dc9b13a24de08f6bc89d190c17b85afb3c770.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isBefore.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; -// @ts-ignore allowing typedoc to build -import { toDate } from '../helpers/toDate.ts'; - -export const isBefore = (str: string, date = String(new Date())) => { - assertString(str); - - const comparison = toDate(date); - const original = toDate(str); - - return !!(original && comparison && original < comparison); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1f19c7f6c7f920a1d641403a5a5037fbdc2fe68f.ts b/crates/swc_bundler/tests/.cache/deno/1f19c7f6c7f920a1d641403a5a5037fbdc2fe68f.ts deleted file mode 100644 index 990048da3dbd..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1f19c7f6c7f920a1d641403a5a5037fbdc2fe68f.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/hash/mod.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -import { Hash } from "./_wasm/hash.ts"; -import type { Hasher } from "./hasher.ts"; - -export type { Hasher } from "./hasher.ts"; -export type SupportedAlgorithm = - | "md2" - | "md4" - | "md5" - | "ripemd160" - | "ripemd320" - | "sha1" - | "sha224" - | "sha256" - | "sha384" - | "sha512" - | "sha3-224" - | "sha3-256" - | "sha3-384" - | "sha3-512" - | "keccak224" - | "keccak256" - | "keccak384" - | "keccak512"; - -/** - * Creates a new `Hash` instance. - * - * @param algorithm name of hash algorithm to use - */ -export function createHash(algorithm: SupportedAlgorithm): Hasher { - return new Hash(algorithm as string); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1f429c4cfe3b434f4499e64af941c5f3500798ba.ts b/crates/swc_bundler/tests/.cache/deno/1f429c4cfe3b434f4499e64af941c5f3500798ba.ts deleted file mode 100644 index 1842ae725573..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1f429c4cfe3b434f4499e64af941c5f3500798ba.ts +++ /dev/null @@ -1,198 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/validation/ValidationContext.js - - -import { Kind } from '../language/kinds.js'; -import { visit } from '../language/visitor.js'; -import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.js'; - -/** - * An instance of this class is passed as the "this" context to all validators, - * allowing access to commonly useful contextual information from within a - * validation rule. - */ -export class ASTValidationContext { - constructor(ast, onError) { - this._ast = ast; - this._fragments = undefined; - this._fragmentSpreads = new Map(); - this._recursivelyReferencedFragments = new Map(); - this._onError = onError; - } - - reportError(error) { - this._onError(error); - } - - getDocument() { - return this._ast; - } - - getFragment(name) { - let fragments = this._fragments; - - if (!fragments) { - this._fragments = fragments = this.getDocument().definitions.reduce((frags, statement) => { - if (statement.kind === Kind.FRAGMENT_DEFINITION) { - frags[statement.name.value] = statement; - } - - return frags; - }, Object.create(null)); - } - - return fragments[name]; - } - - getFragmentSpreads(node) { - let spreads = this._fragmentSpreads.get(node); - - if (!spreads) { - spreads = []; - const setsToVisit = [node]; - - while (setsToVisit.length !== 0) { - const set = setsToVisit.pop(); - - for (const selection of set.selections) { - if (selection.kind === Kind.FRAGMENT_SPREAD) { - spreads.push(selection); - } else if (selection.selectionSet) { - setsToVisit.push(selection.selectionSet); - } - } - } - - this._fragmentSpreads.set(node, spreads); - } - - return spreads; - } - - getRecursivelyReferencedFragments(operation) { - let fragments = this._recursivelyReferencedFragments.get(operation); - - if (!fragments) { - fragments = []; - const collectedNames = Object.create(null); - const nodesToVisit = [operation.selectionSet]; - - while (nodesToVisit.length !== 0) { - const node = nodesToVisit.pop(); - - for (const spread of this.getFragmentSpreads(node)) { - const fragName = spread.name.value; - - if (collectedNames[fragName] !== true) { - collectedNames[fragName] = true; - const fragment = this.getFragment(fragName); - - if (fragment) { - fragments.push(fragment); - nodesToVisit.push(fragment.selectionSet); - } - } - } - } - - this._recursivelyReferencedFragments.set(operation, fragments); - } - - return fragments; - } - -} -export class SDLValidationContext extends ASTValidationContext { - constructor(ast, schema, onError) { - super(ast, onError); - this._schema = schema; - } - - getSchema() { - return this._schema; - } - -} -export class ValidationContext extends ASTValidationContext { - constructor(schema, ast, typeInfo, onError) { - super(ast, onError); - this._schema = schema; - this._typeInfo = typeInfo; - this._variableUsages = new Map(); - this._recursiveVariableUsages = new Map(); - } - - getSchema() { - return this._schema; - } - - getVariableUsages(node) { - let usages = this._variableUsages.get(node); - - if (!usages) { - const newUsages = []; - const typeInfo = new TypeInfo(this._schema); - visit(node, visitWithTypeInfo(typeInfo, { - VariableDefinition: () => false, - - Variable(variable) { - newUsages.push({ - node: variable, - type: typeInfo.getInputType(), - defaultValue: typeInfo.getDefaultValue() - }); - } - - })); - usages = newUsages; - - this._variableUsages.set(node, usages); - } - - return usages; - } - - getRecursiveVariableUsages(operation) { - let usages = this._recursiveVariableUsages.get(operation); - - if (!usages) { - usages = this.getVariableUsages(operation); - - for (const frag of this.getRecursivelyReferencedFragments(operation)) { - usages = usages.concat(this.getVariableUsages(frag)); - } - - this._recursiveVariableUsages.set(operation, usages); - } - - return usages; - } - - getType() { - return this._typeInfo.getType(); - } - - getParentType() { - return this._typeInfo.getParentType(); - } - - getInputType() { - return this._typeInfo.getInputType(); - } - - getParentInputType() { - return this._typeInfo.getParentInputType(); - } - - getFieldDef() { - return this._typeInfo.getFieldDef(); - } - - getDirective() { - return this._typeInfo.getDirective(); - } - - getArgument() { - return this._typeInfo.getArgument(); - } - -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/1f595005ac31bf95953bd02fb3f806bc8ee829ac.ts b/crates/swc_bundler/tests/.cache/deno/1f595005ac31bf95953bd02fb3f806bc8ee829ac.ts deleted file mode 100644 index 4fafa80c9926..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1f595005ac31bf95953bd02fb3f806bc8ee829ac.ts +++ /dev/null @@ -1,114 +0,0 @@ -// Loaded from https://deno.land/std@0.75.0/encoding/hex.ts - - -// Ported from Go -// https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -const hextable = new TextEncoder().encode("0123456789abcdef"); - -/** - * ErrInvalidByte takes an invalid byte and returns an Error. - * @param byte - */ -export function errInvalidByte(byte: number): Error { - return new Error( - "encoding/hex: invalid byte: " + - new TextDecoder().decode(new Uint8Array([byte])), - ); -} - -/** ErrLength returns an error about odd string length. */ -export function errLength(): Error { - return new Error("encoding/hex: odd length hex string"); -} - -// fromHexChar converts a hex character into its value. -function fromHexChar(byte: number): number { - // '0' <= byte && byte <= '9' - if (48 <= byte && byte <= 57) return byte - 48; - // 'a' <= byte && byte <= 'f' - if (97 <= byte && byte <= 102) return byte - 97 + 10; - // 'A' <= byte && byte <= 'F' - if (65 <= byte && byte <= 70) return byte - 65 + 10; - - throw errInvalidByte(byte); -} - -/** - * EncodedLen returns the length of an encoding of n source bytes. Specifically, - * it returns n * 2. - * @param n - */ -export function encodedLen(n: number): number { - return n * 2; -} - -/** - * Encode encodes `src` into `encodedLen(src.length)` bytes. - * @param src - */ -export function encode(src: Uint8Array): Uint8Array { - const dst = new Uint8Array(encodedLen(src.length)); - for (let i = 0; i < dst.length; i++) { - const v = src[i]; - dst[i * 2] = hextable[v >> 4]; - dst[i * 2 + 1] = hextable[v & 0x0f]; - } - return dst; -} - -/** - * EncodeToString returns the hexadecimal encoding of `src`. - * @param src - */ -export function encodeToString(src: Uint8Array): string { - return new TextDecoder().decode(encode(src)); -} - -/** - * Decode decodes `src` into `decodedLen(src.length)` bytes - * If the input is malformed an error will be thrown - * the error. - * @param src - */ -export function decode(src: Uint8Array): Uint8Array { - const dst = new Uint8Array(decodedLen(src.length)); - for (let i = 0; i < dst.length; i++) { - const a = fromHexChar(src[i * 2]); - const b = fromHexChar(src[i * 2 + 1]); - dst[i] = (a << 4) | b; - } - - if (src.length % 2 == 1) { - // Check for invalid char before reporting bad length, - // since the invalid char (if present) is an earlier problem. - fromHexChar(src[dst.length * 2]); - throw errLength(); - } - - return dst; -} - -/** - * DecodedLen returns the length of decoding `x` source bytes. - * Specifically, it returns `x / 2`. - * @param x - */ -export function decodedLen(x: number): number { - return x >>> 1; -} - -/** - * DecodeString returns the bytes represented by the hexadecimal string `s`. - * DecodeString expects that src contains only hexadecimal characters and that - * src has even length. - * If the input is malformed, DecodeString will throw an error. - * @param s the `string` to decode to `Uint8Array` - */ -export function decodeString(s: string): Uint8Array { - return decode(new TextEncoder().encode(s)); -} diff --git a/crates/swc_bundler/tests/.cache/deno/1f5f2fee52bd827e920929dd5763097080e756b4.ts b/crates/swc_bundler/tests/.cache/deno/1f5f2fee52bd827e920929dd5763097080e756b4.ts deleted file mode 100644 index b4f9bb42b56d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1f5f2fee52bd827e920929dd5763097080e756b4.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/language/index.js - - -export { Source } from './source.js'; -export { getLocation } from './location.js'; -export { printLocation, printSourceLocation } from './printLocation.js'; -export { Kind } from './kinds.js'; -export { TokenKind } from './tokenKind.js'; -export { Lexer } from './lexer.js'; -export { parse, parseValue, parseType } from './parser.js'; -export { print } from './printer.js'; -export { visit, visitInParallel, getVisitFn, BREAK } from './visitor.js'; -export { isDefinitionNode, isExecutableDefinitionNode, isSelectionNode, isValueNode, isTypeNode, isTypeSystemDefinitionNode, isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode } from './predicates.js'; -export { DirectiveLocation } from './directiveLocation.js'; \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/1f87aec459f140142a6c8ce4197c36daf9d959d5.ts b/crates/swc_bundler/tests/.cache/deno/1f87aec459f140142a6c8ce4197c36daf9d959d5.ts deleted file mode 100644 index 7f31eda19eca..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1f87aec459f140142a6c8ce4197c36daf9d959d5.ts +++ /dev/null @@ -1,159 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isIBAN.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * List of country codes with - * corresponding IBAN regular expression - * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number - */ -/** - * @ignore - */ -const ibanRegexThroughCountryCode = { - AD: /^(AD[0-9]{2})\d{8}[A-Z0-9]{12}$/, - AE: /^(AE[0-9]{2})\d{3}\d{16}$/, - AL: /^(AL[0-9]{2})\d{8}[A-Z0-9]{16}$/, - AT: /^(AT[0-9]{2})\d{16}$/, - AZ: /^(AZ[0-9]{2})[A-Z0-9]{4}\d{20}$/, - BA: /^(BA[0-9]{2})\d{16}$/, - BE: /^(BE[0-9]{2})\d{12}$/, - BG: /^(BG[0-9]{2})[A-Z]{4}\d{6}[A-Z0-9]{8}$/, - BH: /^(BH[0-9]{2})[A-Z]{4}[A-Z0-9]{14}$/, - BR: /^(BR[0-9]{2})\d{23}[A-Z]{1}[A-Z0-9]{1}$/, - BY: /^(BY[0-9]{2})[A-Z0-9]{4}\d{20}$/, - CH: /^(CH[0-9]{2})\d{5}[A-Z0-9]{12}$/, - CR: /^(CR[0-9]{2})\d{18}$/, - CY: /^(CY[0-9]{2})\d{8}[A-Z0-9]{16}$/, - CZ: /^(CZ[0-9]{2})\d{20}$/, - DE: /^(DE[0-9]{2})\d{18}$/, - DK: /^(DK[0-9]{2})\d{14}$/, - DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/, - EE: /^(EE[0-9]{2})\d{16}$/, - EG: /^(EG[0-9]{2})\d{25}$/, - ES: /^(ES[0-9]{2})\d{20}$/, - FI: /^(FI[0-9]{2})\d{14}$/, - FO: /^(FO[0-9]{2})\d{14}$/, - FR: /^(FR[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/, - GB: /^(GB[0-9]{2})[A-Z]{4}\d{14}$/, - GE: /^(GE[0-9]{2})[A-Z0-9]{2}\d{16}$/, - GI: /^(GI[0-9]{2})[A-Z]{4}[A-Z0-9]{15}$/, - GL: /^(GL[0-9]{2})\d{14}$/, - GR: /^(GR[0-9]{2})\d{7}[A-Z0-9]{16}$/, - GT: /^(GT[0-9]{2})[A-Z0-9]{4}[A-Z0-9]{20}$/, - HR: /^(HR[0-9]{2})\d{17}$/, - HU: /^(HU[0-9]{2})\d{24}$/, - IE: /^(IE[0-9]{2})[A-Z0-9]{4}\d{14}$/, - IL: /^(IL[0-9]{2})\d{19}$/, - IQ: /^(IQ[0-9]{2})[A-Z]{4}\d{15}$/, - IR: /^(IR[0-9]{2})0\d{2}0\d{18}$/, - IS: /^(IS[0-9]{2})\d{22}$/, - IT: /^(IT[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/, - JO: /^(JO[0-9]{2})[A-Z]{4}\d{22}$/, - KW: /^(KW[0-9]{2})[A-Z]{4}[A-Z0-9]{22}$/, - KZ: /^(KZ[0-9]{2})\d{3}[A-Z0-9]{13}$/, - LB: /^(LB[0-9]{2})\d{4}[A-Z0-9]{20}$/, - LC: /^(LC[0-9]{2})[A-Z]{4}[A-Z0-9]{24}$/, - LI: /^(LI[0-9]{2})\d{5}[A-Z0-9]{12}$/, - LT: /^(LT[0-9]{2})\d{16}$/, - LU: /^(LU[0-9]{2})\d{3}[A-Z0-9]{13}$/, - LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/, - MC: /^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/, - MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/, - ME: /^(ME[0-9]{2})\d{18}$/, - MK: /^(MK[0-9]{2})\d{3}[A-Z0-9]{10}\d{2}$/, - MR: /^(MR[0-9]{2})\d{23}$/, - MT: /^(MT[0-9]{2})[A-Z]{4}\d{5}[A-Z0-9]{18}$/, - MU: /^(MU[0-9]{2})[A-Z]{4}\d{19}[A-Z]{3}$/, - NL: /^(NL[0-9]{2})[A-Z]{4}\d{10}$/, - NO: /^(NO[0-9]{2})\d{11}$/, - PK: /^(PK[0-9]{2})[A-Z0-9]{4}\d{16}$/, - PL: /^(PL[0-9]{2})\d{24}$/, - PS: /^(PS[0-9]{2})[A-Z0-9]{4}\d{21}$/, - PT: /^(PT[0-9]{2})\d{21}$/, - QA: /^(QA[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/, - RO: /^(RO[0-9]{2})[A-Z]{4}[A-Z0-9]{16}$/, - RS: /^(RS[0-9]{2})\d{18}$/, - SA: /^(SA[0-9]{2})\d{2}[A-Z0-9]{18}$/, - SC: /^(SC[0-9]{2})[A-Z]{4}\d{20}[A-Z]{3}$/, - SE: /^(SE[0-9]{2})\d{20}$/, - SI: /^(SI[0-9]{2})\d{15}$/, - SK: /^(SK[0-9]{2})\d{20}$/, - SM: /^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/, - SV: /^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/, - TL: /^(TL[0-9]{2})\d{19}$/, - TN: /^(TN[0-9]{2})\d{20}$/, - TR: /^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/, - UA: /^(UA[0-9]{2})\d{6}[A-Z0-9]{19}$/, - VA: /^(VA[0-9]{2})\d{18}$/, - VG: /^(VG[0-9]{2})[A-Z0-9]{4}\d{16}$/, - XK: /^(XK[0-9]{2})\d{16}$/, -}; - -/** - * Check whether string has correct universal IBAN format - * The IBAN consists of up to 34 alphanumeric characters, as follows: - * Country Code using ISO 3166-1 alpha-2, two letters - * check digits, two digits and - * Basic Bank Account Number (BBAN), up to 30 alphanumeric characters. - * NOTE: Permitted IBAN characters are: digits [0-9] and the 26 latin alphabetic [A-Z] - * - * @param {string} str - string under validation - * @return {boolean} - */ -/** - * @ignore - */ -const hasValidIbanFormat = (str: string) => { - // Strip white spaces and hyphens - const strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase(); - const isoCountryCode = strippedStr.slice(0, 2).toUpperCase(); - - return ( - isoCountryCode in ibanRegexThroughCountryCode && - (ibanRegexThroughCountryCode as any)[isoCountryCode].test(strippedStr) - ); -}; - -/** - * Check whether string has valid IBAN Checksum - * by performing basic mod-97 operation and - * the remainder should equal 1 - * -- Start by rearranging the IBAN by moving the four initial characters to the end of the string - * -- Replace each letter in the string with two digits, A -> 10, B = 11, Z = 35 - * -- Interpret the string as a decimal integer and - * -- compute the remainder on division by 97 (mod 97) - * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number - * - * @param {string} str - * @return {boolean} - */ -/** - * @ignore - */ -const hasValidIbanChecksum = (str: string) => { - const strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); // Keep only digits and A-Z latin alphabetic - const rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4); - const alphaCapsReplacedWithDigits = rearranged.replace( - /[A-Z]/g, - // @ts-ignore allowing typedoc to build - (char) => char.charCodeAt(0) - 55 - ); - - // @ts-ignore allowing typedoc to build - const remainder = alphaCapsReplacedWithDigits - .match(/\d{1,7}/g) - // @ts-ignore allowing typedoc to build - .reduce((acc, value) => Number(acc + value) % 97, ''); - - // @ts-ignore allowing typedoc to build - return remainder === 1; -}; - -export const isIBAN = (str: string) => { - assertString(str); - - return hasValidIbanFormat(str) && hasValidIbanChecksum(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1fb57519bb17c899ccede64820e37e4a757717ed.ts b/crates/swc_bundler/tests/.cache/deno/1fb57519bb17c899ccede64820e37e4a757717ed.ts deleted file mode 100644 index b45ea40bd7a6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1fb57519bb17c899ccede64820e37e4a757717ed.ts +++ /dev/null @@ -1,899 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/encoding/_yaml/dumper/dumper.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { YAMLError } from "../error.ts"; -import type { RepresentFn, StyleVariant, Type } from "../type.ts"; -import * as common from "../utils.ts"; -import { DumperState, DumperStateOptions } from "./dumper_state.ts"; - -type Any = common.Any; -type ArrayObject = common.ArrayObject; - -const _toString = Object.prototype.toString; -const _hasOwnProperty = Object.prototype.hasOwnProperty; - -const CHAR_TAB = 0x09; /* Tab */ -const CHAR_LINE_FEED = 0x0a; /* LF */ -const CHAR_SPACE = 0x20; /* Space */ -const CHAR_EXCLAMATION = 0x21; /* ! */ -const CHAR_DOUBLE_QUOTE = 0x22; /* " */ -const CHAR_SHARP = 0x23; /* # */ -const CHAR_PERCENT = 0x25; /* % */ -const CHAR_AMPERSAND = 0x26; /* & */ -const CHAR_SINGLE_QUOTE = 0x27; /* ' */ -const CHAR_ASTERISK = 0x2a; /* * */ -const CHAR_COMMA = 0x2c; /* , */ -const CHAR_MINUS = 0x2d; /* - */ -const CHAR_COLON = 0x3a; /* : */ -const CHAR_GREATER_THAN = 0x3e; /* > */ -const CHAR_QUESTION = 0x3f; /* ? */ -const CHAR_COMMERCIAL_AT = 0x40; /* @ */ -const CHAR_LEFT_SQUARE_BRACKET = 0x5b; /* [ */ -const CHAR_RIGHT_SQUARE_BRACKET = 0x5d; /* ] */ -const CHAR_GRAVE_ACCENT = 0x60; /* ` */ -const CHAR_LEFT_CURLY_BRACKET = 0x7b; /* { */ -const CHAR_VERTICAL_LINE = 0x7c; /* | */ -const CHAR_RIGHT_CURLY_BRACKET = 0x7d; /* } */ - -const ESCAPE_SEQUENCES: { [char: number]: string } = {}; - -ESCAPE_SEQUENCES[0x00] = "\\0"; -ESCAPE_SEQUENCES[0x07] = "\\a"; -ESCAPE_SEQUENCES[0x08] = "\\b"; -ESCAPE_SEQUENCES[0x09] = "\\t"; -ESCAPE_SEQUENCES[0x0a] = "\\n"; -ESCAPE_SEQUENCES[0x0b] = "\\v"; -ESCAPE_SEQUENCES[0x0c] = "\\f"; -ESCAPE_SEQUENCES[0x0d] = "\\r"; -ESCAPE_SEQUENCES[0x1b] = "\\e"; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5c] = "\\\\"; -ESCAPE_SEQUENCES[0x85] = "\\N"; -ESCAPE_SEQUENCES[0xa0] = "\\_"; -ESCAPE_SEQUENCES[0x2028] = "\\L"; -ESCAPE_SEQUENCES[0x2029] = "\\P"; - -const DEPRECATED_BOOLEANS_SYNTAX = [ - "y", - "Y", - "yes", - "Yes", - "YES", - "on", - "On", - "ON", - "n", - "N", - "no", - "No", - "NO", - "off", - "Off", - "OFF", -]; - -function encodeHex(character: number): string { - const string = character.toString(16).toUpperCase(); - - let handle: string; - let length: number; - if (character <= 0xff) { - handle = "x"; - length = 2; - } else if (character <= 0xffff) { - handle = "u"; - length = 4; - } else if (character <= 0xffffffff) { - handle = "U"; - length = 8; - } else { - throw new YAMLError( - "code point within a string may not be greater than 0xFFFFFFFF", - ); - } - - return `\\${handle}${common.repeat("0", length - string.length)}${string}`; -} - -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string: string, spaces: number): string { - const ind = common.repeat(" ", spaces), - length = string.length; - let position = 0, - next = -1, - result = "", - line: string; - - while (position < length) { - next = string.indexOf("\n", position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - - if (line.length && line !== "\n") result += ind; - - result += line; - } - - return result; -} - -function generateNextLine(state: DumperState, level: number): string { - return `\n${common.repeat(" ", state.indent * level)}`; -} - -function testImplicitResolving(state: DumperState, str: string): boolean { - let type: Type; - for ( - let index = 0, length = state.implicitTypes.length; - index < length; - index += 1 - ) { - type = state.implicitTypes[index]; - - if (type.resolve(str)) { - return true; - } - } - - return false; -} - -// [33] s-white ::= s-space | s-tab -function isWhitespace(c: number): boolean { - return c === CHAR_SPACE || c === CHAR_TAB; -} - -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c: number): boolean { - return ( - (0x00020 <= c && c <= 0x00007e) || - (0x000a1 <= c && c <= 0x00d7ff && c !== 0x2028 && c !== 0x2029) || - (0x0e000 <= c && c <= 0x00fffd && c !== 0xfeff) /* BOM */ || - (0x10000 <= c && c <= 0x10ffff) - ); -} - -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe(c: number): boolean { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return ( - isPrintable(c) && - c !== 0xfeff && - // - c-flow-indicator - c !== CHAR_COMMA && - c !== CHAR_LEFT_SQUARE_BRACKET && - c !== CHAR_RIGHT_SQUARE_BRACKET && - c !== CHAR_LEFT_CURLY_BRACKET && - c !== CHAR_RIGHT_CURLY_BRACKET && - // - ":" - "#" - c !== CHAR_COLON && - c !== CHAR_SHARP - ); -} - -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c: number): boolean { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - return ( - isPrintable(c) && - c !== 0xfeff && - !isWhitespace(c) && // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - c !== CHAR_MINUS && - c !== CHAR_QUESTION && - c !== CHAR_COLON && - c !== CHAR_COMMA && - c !== CHAR_LEFT_SQUARE_BRACKET && - c !== CHAR_RIGHT_SQUARE_BRACKET && - c !== CHAR_LEFT_CURLY_BRACKET && - c !== CHAR_RIGHT_CURLY_BRACKET && - // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"” - c !== CHAR_SHARP && - c !== CHAR_AMPERSAND && - c !== CHAR_ASTERISK && - c !== CHAR_EXCLAMATION && - c !== CHAR_VERTICAL_LINE && - c !== CHAR_GREATER_THAN && - c !== CHAR_SINGLE_QUOTE && - c !== CHAR_DOUBLE_QUOTE && - // | “%” | “@” | “`”) - c !== CHAR_PERCENT && - c !== CHAR_COMMERCIAL_AT && - c !== CHAR_GRAVE_ACCENT - ); -} - -// Determines whether block indentation indicator is required. -function needIndentIndicator(string: string): boolean { - const leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} - -const STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; - -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle( - string: string, - singleLineOnly: boolean, - indentPerLevel: number, - lineWidth: number, - testAmbiguousType: (...args: Any[]) => Any, -): number { - const shouldTrackWidth = lineWidth !== -1; - let hasLineBreak = false, - hasFoldableLine = false, // only checked if shouldTrackWidth - previousLineBreak = -1, // count the first line correctly - plain = isPlainSafeFirst(string.charCodeAt(0)) && - !isWhitespace(string.charCodeAt(string.length - 1)); - - let char: number, i: number; - if (singleLineOnly) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char); - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== " "); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char); - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || - (shouldTrackWidth && - i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== " "); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; -} - -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line: string, width: number): string { - if (line === "" || line[0] === " ") return line; - - // Since a more-indented line adds a \n, breaks can't be followed by a space. - const breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - let match; - // start is an inclusive index. end, curr, and next are exclusive. - let start = 0, - end, - curr = 0, - next = 0; - let result = ""; - - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - // tslint:disable-next-line:no-conditional-assignment - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = curr > start ? curr : next; // derive end <= length-2 - result += `\n${line.slice(start, end)}`; - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } - - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += "\n"; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += `${line.slice(start, curr)}\n${line.slice(curr + 1)}`; - } else { - result += line.slice(start); - } - - return result.slice(1); // drop extra \n joiner -} - -// (See the note for writeScalar.) -function dropEndingNewline(string: string): string { - return string[string.length - 1] === "\n" ? string.slice(0, -1) : string; -} - -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string: string, width: number): string { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - const lineRe = /(\n+)([^\n]*)/g; - - // first line (possibly an empty line) - let result = ((): string => { - let nextLF = string.indexOf("\n"); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - // eslint-disable-next-line @typescript-eslint/no-use-before-define - return foldLine(string.slice(0, nextLF), width); - })(); - // If we haven't reached the first content line yet, don't add an extra \n. - let prevMoreIndented = string[0] === "\n" || string[0] === " "; - let moreIndented; - - // rest of the lines - let match; - // tslint:disable-next-line:no-conditional-assignment - while ((match = lineRe.exec(string))) { - const prefix = match[1], - line = match[2]; - moreIndented = line[0] === " "; - result += prefix + - (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + - // eslint-disable-next-line @typescript-eslint/no-use-before-define - foldLine(line, width); - prevMoreIndented = moreIndented; - } - - return result; -} - -// Escapes a double-quoted string. -function escapeString(string: string): string { - let result = ""; - let char, nextChar; - let escapeSeq; - - for (let i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xd800 && char <= 0xdbff /* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xdc00 && nextChar <= 0xdfff /* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex( - (char - 0xd800) * 0x400 + nextChar - 0xdc00 + 0x10000, - ); - // Advance index one extra since we already used that char here. - i++; - continue; - } - } - escapeSeq = ESCAPE_SEQUENCES[char]; - result += !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); - } - - return result; -} - -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string: string, indentPerLevel: number): string { - const indentIndicator = needIndentIndicator(string) - ? String(indentPerLevel) - : ""; - - // note the special case: the string '\n' counts as a "trailing" empty line. - const clip = string[string.length - 1] === "\n"; - const keep = clip && (string[string.length - 2] === "\n" || string === "\n"); - const chomp = keep ? "+" : clip ? "" : "-"; - - return `${indentIndicator}${chomp}\n`; -} - -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar( - state: DumperState, - string: string, - level: number, - iskey: boolean, -): void { - state.dump = ((): string => { - if (string.length === 0) { - return "''"; - } - if ( - !state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 - ) { - return `'${string}'`; - } - - const indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower - // bound. - // This behaves better than a constant minimum width which disallows - // narrower options, or an indent threshold which causes the width - // to suddenly increase. - const lineWidth = state.lineWidth === -1 - ? -1 - : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - - // Without knowing if keys are implicit/explicit, - // assume implicit for safety. - const singleLineOnly = iskey || - // No block styles in flow mode. - (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(str: string): boolean { - return testImplicitResolving(state, str); - } - - switch ( - chooseScalarStyle( - string, - singleLineOnly, - state.indent, - lineWidth, - testAmbiguity, - ) - ) { - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return `'${string.replace(/'/g, "''")}'`; - case STYLE_LITERAL: - return `|${blockHeader(string, state.indent)}${ - dropEndingNewline( - indentString(string, indent), - ) - }`; - case STYLE_FOLDED: - return `>${blockHeader(string, state.indent)}${ - dropEndingNewline( - indentString(foldString(string, lineWidth), indent), - ) - }`; - case STYLE_DOUBLE: - return `"${escapeString(string)}"`; - default: - throw new YAMLError("impossible error: invalid scalar style"); - } - })(); -} - -function writeFlowSequence( - state: DumperState, - level: number, - object: Any, -): void { - let _result = ""; - const _tag = state.tag; - - for (let index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - // eslint-disable-next-line @typescript-eslint/no-use-before-define - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += `,${!state.condenseFlow ? " " : ""}`; - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = `[${_result}]`; -} - -function writeBlockSequence( - state: DumperState, - level: number, - object: Any, - compact = false, -): void { - let _result = ""; - const _tag = state.tag; - - for (let index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - // eslint-disable-next-line @typescript-eslint/no-use-before-define - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += "-"; - } else { - _result += "- "; - } - - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || "[]"; // Empty sequence if no valid values. -} - -function writeFlowMapping( - state: DumperState, - level: number, - object: Any, -): void { - let _result = ""; - const _tag = state.tag, - objectKeyList = Object.keys(object); - - let pairBuffer: string, objectKey: string, objectValue: Any; - for ( - let index = 0, length = objectKeyList.length; - index < length; - index += 1 - ) { - pairBuffer = state.condenseFlow ? '"' : ""; - - if (index !== 0) pairBuffer += ", "; - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } - - if (state.dump.length > 1024) pairBuffer += "? "; - - pairBuffer += `${state.dump}${state.condenseFlow ? '"' : ""}:${ - state.condenseFlow ? "" : " " - }`; - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = `{${_result}}`; -} - -function writeBlockMapping( - state: DumperState, - level: number, - object: Any, - compact = false, -): void { - const _tag = state.tag, - objectKeyList = Object.keys(object); - let _result = ""; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === "function") { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new YAMLError("sortKeys must be a boolean or a function"); - } - - let pairBuffer = "", - objectKey: string, - objectValue: Any, - explicitPair: boolean; - for ( - let index = 0, length = objectKeyList.length; - index < length; - index += 1 - ) { - pairBuffer = ""; - - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } - - explicitPair = (state.tag !== null && state.tag !== "?") || - (state.dump && state.dump.length > 1024); - - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += "?"; - } else { - pairBuffer += "? "; - } - } - - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ":"; - } else { - pairBuffer += ": "; - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = _result || "{}"; // Empty mapping if no valid pairs. -} - -function detectType( - state: DumperState, - object: Any, - explicit = false, -): boolean { - const typeList = explicit ? state.explicitTypes : state.implicitTypes; - - let type: Type; - let style: StyleVariant; - let _result: string; - for (let index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; - - if ( - (type.instanceOf || type.predicate) && - (!type.instanceOf || - (typeof object === "object" && object instanceof type.instanceOf)) && - (!type.predicate || type.predicate(object)) - ) { - state.tag = explicit ? type.tag : "?"; - - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - - if (_toString.call(type.represent) === "[object Function]") { - _result = (type.represent as RepresentFn)(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = (type.represent as ArrayObject)[style]( - object, - style, - ); - } else { - throw new YAMLError( - `!<${type.tag}> tag resolver accepts not "${style}" style`, - ); - } - - state.dump = _result; - } - - return true; - } - } - - return false; -} - -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode( - state: DumperState, - level: number, - object: Any, - block: boolean, - compact: boolean, - iskey = false, -): boolean { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - const type = _toString.call(state.dump); - - if (block) { - block = state.flowLevel < 0 || state.flowLevel > level; - } - - const objectOrArray = type === "[object Object]" || type === "[object Array]"; - - let duplicateIndex = -1; - let duplicate = false; - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } - - if ( - (state.tag !== null && state.tag !== "?") || - duplicate || - (state.indent !== 2 && level > 0) - ) { - compact = false; - } - - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = `*ref_${duplicateIndex}`; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === "[object Object]") { - if (block && Object.keys(state.dump).length !== 0) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = `&ref_${duplicateIndex}${state.dump}`; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = `&ref_${duplicateIndex} ${state.dump}`; - } - } - } else if (type === "[object Array]") { - const arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level; - if (block && state.dump.length !== 0) { - writeBlockSequence(state, arrayLevel, state.dump, compact); - if (duplicate) { - state.dump = `&ref_${duplicateIndex}${state.dump}`; - } - } else { - writeFlowSequence(state, arrayLevel, state.dump); - if (duplicate) { - state.dump = `&ref_${duplicateIndex} ${state.dump}`; - } - } - } else if (type === "[object String]") { - if (state.tag !== "?") { - writeScalar(state, state.dump, level, iskey); - } - } else { - if (state.skipInvalid) return false; - throw new YAMLError(`unacceptable kind of an object to dump ${type}`); - } - - if (state.tag !== null && state.tag !== "?") { - state.dump = `!<${state.tag}> ${state.dump}`; - } - } - - return true; -} - -function inspectNode( - object: Any, - objects: Any[], - duplicatesIndexes: number[], -): void { - if (object !== null && typeof object === "object") { - const index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); - - if (Array.isArray(object)) { - for (let idx = 0, length = object.length; idx < length; idx += 1) { - inspectNode(object[idx], objects, duplicatesIndexes); - } - } else { - const objectKeyList = Object.keys(object); - - for ( - let idx = 0, length = objectKeyList.length; - idx < length; - idx += 1 - ) { - inspectNode(object[objectKeyList[idx]], objects, duplicatesIndexes); - } - } - } - } -} - -function getDuplicateReferences( - object: Record, - state: DumperState, -): void { - const objects: Any[] = [], - duplicatesIndexes: number[] = []; - - inspectNode(object, objects, duplicatesIndexes); - - const length = duplicatesIndexes.length; - for (let index = 0; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); -} - -export function dump(input: Any, options?: DumperStateOptions): string { - options = options || {}; - - const state = new DumperState(options); - - if (!state.noRefs) getDuplicateReferences(input, state); - - if (writeNode(state, 0, input, true, true)) return `${state.dump}\n`; - - return ""; -} diff --git a/crates/swc_bundler/tests/.cache/deno/1fb5d6eb9dcd21056962f0b0b8703f120add3040.ts b/crates/swc_bundler/tests/.cache/deno/1fb5d6eb9dcd21056962f0b0b8703f120add3040.ts deleted file mode 100644 index f07da9d240a3..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1fb5d6eb9dcd21056962f0b0b8703f120add3040.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/messages/mod.ts - - -export * from "./allowed_mentions.ts"; -export * from "./allowed_mentions_types.ts"; -export * from "./attachment.ts"; -export * from "./components/action_row.ts"; -export * from "./components/button_component.ts"; -export * from "./components/button_styles.ts"; -export * from "./components/message_component_types.ts"; -export * from "./components/message_components.ts"; -export * from "./create_message.ts"; -export * from "./edit_message.ts"; -export * from "./get_messages.ts"; -export * from "./message.ts"; -export * from "./message_activity.ts"; -export * from "./message_activity_types.ts"; -export * from "./message_delete.ts"; -export * from "./message_delete_bulk.ts"; -export * from "./message_flags.ts"; -export * from "./message_get_reactions.ts"; -export * from "./message_reaction_add.ts"; -export * from "./message_reaction_remove.ts"; -export * from "./message_reaction_remove_all.ts"; -export * from "./message_reaction_remove_emoji.ts"; -export * from "./message_reference.ts"; -export * from "./message_sticker.ts"; -export * from "./message_sticker_format_types.ts"; -export * from "./message_types.ts"; -export * from "./reaction.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/1fca36f2394e0e6489e8249cb95bdcfac94bf09b.ts b/crates/swc_bundler/tests/.cache/deno/1fca36f2394e0e6489e8249cb95bdcfac94bf09b.ts deleted file mode 100644 index 0deec2168fa5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1fca36f2394e0e6489e8249cb95bdcfac94bf09b.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/messages/allowed_mentions_types.ts - - -/** https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */ -export enum DiscordAllowedMentionsTypes { - /** Controls role mentions */ - RoleMentions = "roles", - /** Controls user mentions */ - UserMentions = "users", - /** Controls @everyone and @here mentions */ - EveryoneMentions = "everyone", -} - -export type AllowedMentionsTypes = DiscordAllowedMentionsTypes; -export const AllowedMentionsTypes = DiscordAllowedMentionsTypes; diff --git a/crates/swc_bundler/tests/.cache/deno/1fd0175804216d11e14cfa6fe2663b4c3f62ac2f.ts b/crates/swc_bundler/tests/.cache/deno/1fd0175804216d11e14cfa6fe2663b4c3f62ac2f.ts deleted file mode 100644 index 03e601d39864..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1fd0175804216d11e14cfa6fe2663b4c3f62ac2f.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isWhitelisted.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -export const isWhitelisted = (str: string, chars: string[]) => { - assertString(str); - for (let i = str.length - 1; i >= 0; i--) { - if (chars.indexOf(str[i]) === -1) { - return false; - } - } - return true; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/1ff509c9694ea91930285d4ac609e7dd403917f0.ts b/crates/swc_bundler/tests/.cache/deno/1ff509c9694ea91930285d4ac609e7dd403917f0.ts deleted file mode 100644 index 6f1a17f0d18b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ff509c9694ea91930285d4ac609e7dd403917f0.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Loaded from https://deno.land/std@0.73.0/async/mod.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./deferred.ts"; -export * from "./delay.ts"; -export * from "./mux_async_iterator.ts"; -export * from "./pool.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/1ff6a595e378303b3b5dad0661049f3137822aa8.ts b/crates/swc_bundler/tests/.cache/deno/1ff6a595e378303b3b5dad0661049f3137822aa8.ts deleted file mode 100644 index 430dc467ca59..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/1ff6a595e378303b3b5dad0661049f3137822aa8.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Loaded from https://deno.land/std/uuid/v4.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { bytesToUuid } from "./_common.ts"; - -const UUID_RE = - /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; - -/** - * Validates the UUID v4. - * @param id UUID value. - */ -export function validate(id: string): boolean { - return UUID_RE.test(id); -} - -/** Generates a RFC4122 v4 UUID (pseudo-randomly-based) */ -export function generate(): string { - const rnds = crypto.getRandomValues(new Uint8Array(16)); - - rnds[6] = (rnds[6] & 0x0f) | 0x40; // Version 4 - rnds[8] = (rnds[8] & 0x3f) | 0x80; // Variant 10 - - return bytesToUuid(rnds); -} diff --git a/crates/swc_bundler/tests/.cache/deno/209bbc6a5e3d5962580306a9a7389dc32842d4b6.ts b/crates/swc_bundler/tests/.cache/deno/209bbc6a5e3d5962580306a9a7389dc32842d4b6.ts deleted file mode 100644 index d9e50ab59dda..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/209bbc6a5e3d5962580306a9a7389dc32842d4b6.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/emojis/guild_emojis_update.ts - - -import { Emoji } from "../emojis/emoji.ts"; - -/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update */ -export interface GuildEmojisUpdate { - /** id of the guild */ - guildId: string; - /** Array of emojis */ - emojis: Emoji[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/20b47a4a80dcf4024da1d6c4155148c5e92c7560.ts b/crates/swc_bundler/tests/.cache/deno/20b47a4a80dcf4024da1d6c4155148c5e92c7560.ts deleted file mode 100644 index 35f669abbf27..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/20b47a4a80dcf4024da1d6c4155148c5e92c7560.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/messages/get_reactions.ts - - -import { rest } from "../../rest/rest.ts"; -import type { GetReactions } from "../../types/messages/message_get_reactions.ts"; -import type { User } from "../../types/users/user.ts"; -import { Collection } from "../../util/collection.ts"; -import { endpoints } from "../../util/constants.ts"; - -/** Get a list of users that reacted with this emoji. */ -export async function getReactions(channelId: bigint, messageId: bigint, reaction: string, options?: GetReactions) { - const users = await rest.runMethod( - "get", - endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, reaction), - options - ); - - return new Collection(users.map((user) => [user.id, user])); -} diff --git a/crates/swc_bundler/tests/.cache/deno/20e4512d5c898122c7d93fc59c314fc1610d96b6.ts b/crates/swc_bundler/tests/.cache/deno/20e4512d5c898122c7d93fc59c314fc1610d96b6.ts deleted file mode 100644 index 0ede7fb0bfc1..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/20e4512d5c898122c7d93fc59c314fc1610d96b6.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Loaded from https://deno.land/x/jpegts@1.1/mod.ts - - -export { decode } from "./lib/decoder.ts" -export { encode } from "./lib/encoder.ts" -export { Image } from "./lib/image.ts" -export { Pixel } from "./lib/pixel.ts" diff --git a/crates/swc_bundler/tests/.cache/deno/212822c05c6e42e4f774ec561becbdf587150b2f.ts b/crates/swc_bundler/tests/.cache/deno/212822c05c6e42e4f774ec561becbdf587150b2f.ts deleted file mode 100644 index 2f1329c79c0c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/212822c05c6e42e4f774ec561becbdf587150b2f.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Loaded from https://deno.land/x/abc@v1.2.4/router.ts - - -import type { HandlerFunc } from "./types.ts"; -import type { Context } from "./context.ts"; - -import { Node } from "./vendor/https/deno.land/x/router/mod.ts"; -import { hasTrailingSlash, NotFoundHandler } from "./util.ts"; - -export class Router { - trees: Record = {}; - - add(method: string, path: string, h: HandlerFunc): void { - if (path[0] !== "/") { - path = `/${path}`; - } - - if (hasTrailingSlash(path)) { - path = path.slice(0, path.length - 1); - } - - let root = this.trees[method]; - if (!root) { - root = new Node(); - this.trees[method] = root; - } - - root.add(path, h); - } - - find(method: string, c: Context): HandlerFunc { - const node = this.trees[method]; - let path = c.path; - if (hasTrailingSlash(path)) { - path = path.slice(0, path.length - 1); - } - let h: HandlerFunc | undefined; - if (node) { - const [handle, params] = node.find(path); - if (params) { - for (const [k, v] of params) { - c.params[k] = v; - } - } - - if (handle) { - h = handle as HandlerFunc; - } - } - - return h ?? NotFoundHandler; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/2142a574d05831629b1f10318078984950a5d48b.ts b/crates/swc_bundler/tests/.cache/deno/2142a574d05831629b1f10318078984950a5d48b.ts deleted file mode 100644 index c25872c6d346..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2142a574d05831629b1f10318078984950a5d48b.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/roles/GUILD_ROLE_DELETE.ts - - -import { eventHandlers } from "../../bot.ts"; -import { cacheHandlers } from "../../cache.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { GuildRoleDelete } from "../../types/guilds/guild_role_delete.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; - -export async function handleGuildRoleDelete(data: DiscordGatewayPayload) { - const payload = data.d as GuildRoleDelete; - const guild = await cacheHandlers.get("guilds", snowflakeToBigint(payload.guildId)); - if (!guild) return; - - const roleId = snowflakeToBigint(payload.roleId); - - const cachedRole = guild.roles.get(roleId)!; - guild.roles.delete(roleId); - - if (cachedRole) eventHandlers.roleDelete?.(guild, cachedRole); - - // For bots without GUILD_MEMBERS member.roles is never updated breaking permissions checking. - cacheHandlers.forEach("members", (member) => { - eventHandlers.debug?.("loop", `1. Running forEach members loop in GUILD_ROLE_DELETE file.`); - // Not in the relevant guild so just skip. - if (!member.guilds.has(guild.id)) return; - - member.guilds.forEach((g) => { - eventHandlers.debug?.("loop", `2. Running forEach loop in CHANNEL_DELTE file.`); - // Member does not have this role - if (!g.roles.includes(roleId)) return; - // Remove this role from the members cache - g.roles = g.roles.filter((id) => id !== roleId); - cacheHandlers.set("members", member.id, member); - }); - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/214868c4b3fe07f8136d5c9bacdd210c92358372.ts b/crates/swc_bundler/tests/.cache/deno/214868c4b3fe07f8136d5c9bacdd210c92358372.ts deleted file mode 100644 index ef3efb99b3c9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/214868c4b3fe07f8136d5c9bacdd210c92358372.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isMongoId.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; -// @ts-ignore allowing typedoc to build -import { isHexadecimal } from './isHexadecimal.ts'; - -export const isMongoId = (str: string) => { - assertString(str); - return isHexadecimal(str) && str.length === 24; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/2177309745b4816746b9fee98c1447f965bcbadb.ts b/crates/swc_bundler/tests/.cache/deno/2177309745b4816746b9fee98c1447f965bcbadb.ts deleted file mode 100644 index 455631fe621b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2177309745b4816746b9fee98c1447f965bcbadb.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Loaded from https://deno.land/x/validasaur/src/rules/is_float.ts - - -import type { Validity } from "../types.ts"; -import { invalid } from "../utils.ts"; - -export function isFloat(value: any): Validity { - if (typeof value !== "number" || value % 1 === 0) { - return invalid("isFloat", { value }); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/21ecfb5d36b7bde52b3ad64e6d594b0c8b4547b3.ts b/crates/swc_bundler/tests/.cache/deno/21ecfb5d36b7bde52b3ad64e6d594b0c8b4547b3.ts deleted file mode 100644 index 3a3ed0dfe3e6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/21ecfb5d36b7bde52b3ad64e6d594b0c8b4547b3.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/path/common.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -import { SEP } from "./separator.ts"; - -/** Determines the common path from a set of paths, using an optional separator, - * which defaults to the OS default separator. - * - * import { common } from "https://deno.land/std/path/mod.ts"; - * const p = common([ - * "./deno/std/path/mod.ts", - * "./deno/std/fs/mod.ts", - * ]); - * console.log(p); // "./deno/std/" - * - */ -export function common(paths: string[], sep = SEP): string { - const [first = "", ...remaining] = paths; - if (first === "" || remaining.length === 0) { - return first.substring(0, first.lastIndexOf(sep) + 1); - } - const parts = first.split(sep); - - let endOfPrefix = parts.length; - for (const path of remaining) { - const compare = path.split(sep); - for (let i = 0; i < endOfPrefix; i++) { - if (compare[i] !== parts[i]) { - endOfPrefix = i; - } - } - - if (endOfPrefix === 0) { - return ""; - } - } - const prefix = parts.slice(0, endOfPrefix).join(sep); - return prefix.endsWith(sep) ? prefix : `${prefix}${sep}`; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2245d08f0e8ec31c6412dc4041c0ca6fcb5e5423.ts b/crates/swc_bundler/tests/.cache/deno/2245d08f0e8ec31c6412dc4041c0ca6fcb5e5423.ts deleted file mode 100644 index 0fb4b3daac15..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2245d08f0e8ec31c6412dc4041c0ca6fcb5e5423.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isDataURI.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * @ignore - */ -const validMediaType = /^[a-z]+\/[a-z0-9\-\+]+$/i; - -/** - * @ignore - */ -const validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i; - -/** - * @ignore - */ -const validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i; - -export const isDataURI = (str: string) => { - assertString(str); - - let data = str.split(','); - - if (data.length < 2) { - return false; - } - - const attributes = (data.shift() as string).trim().split(';'); - const schemeAndMediaType = attributes.shift() as string; - - if (schemeAndMediaType.substr(0, 5) !== 'data:') { - return false; - } - - const mediaType = schemeAndMediaType.substr(5); - - if (mediaType !== '' && !validMediaType.test(mediaType)) { - return false; - } - - for (let i = 0; i < attributes.length; i++) { - if ( - i === attributes.length - 1 && - attributes[i].toLowerCase() === 'base64' - ) { - // ok - } else if (!validAttribute.test(attributes[i])) { - return false; - } - } - - for (let i = 0; i < data.length; i++) { - if (!validData.test(data[i])) { - return false; - } - } - - return true; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/2248898495ad0b68a8c3c60d718a0c75db13067d.ts b/crates/swc_bundler/tests/.cache/deno/2248898495ad0b68a8c3c60d718a0c75db13067d.ts deleted file mode 100644 index 857e5b33b048..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2248898495ad0b68a8c3c60d718a0c75db13067d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/discordeno/guild_update_change.ts - - -import { Guild } from "../guilds/guild.ts"; - -export interface GuildUpdateChange { - key: keyof Guild; - oldValue?: unknown; - value?: unknown; -} diff --git a/crates/swc_bundler/tests/.cache/deno/227bede68fafb47619d0717320f64a046bb27841.ts b/crates/swc_bundler/tests/.cache/deno/227bede68fafb47619d0717320f64a046bb27841.ts deleted file mode 100644 index 8ac1f2b56e30..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/227bede68fafb47619d0717320f64a046bb27841.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/codes/http_response_codes.ts - - -/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#http */ -export enum DiscordHTTPResponseCodes { - Ok = 200, - Created, - NoContent = 204, - NotModified = 304, - BadRequest = 400, - Unauthorized, - Forbidden = 403, - NotFound, - MethodNotAllowed, - TooManyRequests = 429, - GatewayUnavailable = 502, -} - -export type HTTPResponseCodes = DiscordHTTPResponseCodes; -export const HTTPResponseCodes = DiscordHTTPResponseCodes; diff --git a/crates/swc_bundler/tests/.cache/deno/22bfe63e325acaa541a6ce50d7bf77fb6a82e9a7.ts b/crates/swc_bundler/tests/.cache/deno/22bfe63e325acaa541a6ce50d7bf77fb6a82e9a7.ts deleted file mode 100644 index 5027c7d1317a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/22bfe63e325acaa541a6ce50d7bf77fb6a82e9a7.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/activity/presence_update.ts - - -import { User } from "../users/user.ts"; -import { Activity } from "./activity.ts"; -import { ClientStatus } from "./client_status.ts"; - -/** https://discord.com/developers/docs/topics/gateway#presence-update */ -export interface PresenceUpdate { - /** The user presence is being updated for */ - user: User; - /** id of the guild */ - guildId: string; - /** Either "idle", "dnd", "online", or "offline" */ - status: "idle" | "dnd" | "online" | "offline"; - /** User's current activities */ - activities: Activity[]; - /** User's platform-dependent status */ - clientStatus: ClientStatus; -} diff --git a/crates/swc_bundler/tests/.cache/deno/22d4cff3c725f357baab702365bd0574fd9ac91f.ts b/crates/swc_bundler/tests/.cache/deno/22d4cff3c725f357baab702365bd0574fd9ac91f.ts deleted file mode 100644 index 63cd2b137386..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/22d4cff3c725f357baab702365bd0574fd9ac91f.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_stepCat.js - - -import _objectAssign from './_objectAssign.js'; -import _identity from './_identity.js'; -import _isArrayLike from './_isArrayLike.js'; -import _isTransformer from './_isTransformer.js'; -import objOf from '../objOf.js'; - - -var _stepCatArray = { - '@@transducer/init': Array, - '@@transducer/step': function(xs, x) { - xs.push(x); - return xs; - }, - '@@transducer/result': _identity -}; -var _stepCatString = { - '@@transducer/init': String, - '@@transducer/step': function(a, b) { return a + b; }, - '@@transducer/result': _identity -}; -var _stepCatObject = { - '@@transducer/init': Object, - '@@transducer/step': function(result, input) { - return _objectAssign( - result, - _isArrayLike(input) ? objOf(input[0], input[1]) : input - ); - }, - '@@transducer/result': _identity -}; - -export default function _stepCat(obj) { - if (_isTransformer(obj)) { - return obj; - } - if (_isArrayLike(obj)) { - return _stepCatArray; - } - if (typeof obj === 'string') { - return _stepCatString; - } - if (typeof obj === 'object') { - return _stepCatObject; - } - throw new Error('Cannot create transformer for ' + obj); -} diff --git a/crates/swc_bundler/tests/.cache/deno/22f36390a0c69ba96a5e2f34e6f90b3dd514e3bf.ts b/crates/swc_bundler/tests/.cache/deno/22f36390a0c69ba96a5e2f34e6f90b3dd514e3bf.ts deleted file mode 100644 index e3ed54a6d81b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/22f36390a0c69ba96a5e2f34e6f90b3dd514e3bf.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Loaded from https://deno.land/x/deno_lodash@v0.1.0/mod.ts - - -export * from './lodash.ts' \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/233295ae9b26d1a31cacd984af3623706fcd83a6.ts b/crates/swc_bundler/tests/.cache/deno/233295ae9b26d1a31cacd984af3623706fcd83a6.ts deleted file mode 100644 index e9727d05f7be..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/233295ae9b26d1a31cacd984af3623706fcd83a6.ts +++ /dev/null @@ -1,94 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/command/lib/types.ts - - -import { IFlagArgument, IFlagOptions, ITypeHandler } from '../../flags/lib/types.ts'; -import { Type } from '../types/type.ts'; -import { Command } from './command.ts'; - -/** Description handler. */ -export type IDescription = string | ( ( this: Command ) => string ); - -/** Action handler. */ -export type IAction> = ( this: Command, options: O, ...args: A ) => void | Promise; - -/** Argument details. */ -export interface IArgumentDetails extends IFlagArgument { - /** Argument name. */ - name: string; - /** Shell completion action. */ - action: string; - /** Arguments type. */ - type: string; -} - -/** Command settings. */ -export interface ICommandOption = any> extends Omit { - override?: boolean; - hidden?: boolean; - global?: boolean; - action?: IAction; - prepend?: boolean; -} - -/** Command option setting's. */ -export interface IOption = any> extends ICommandOption, IFlagOptions { - description: string, - flags: string; - typeDefinition?: string; - args: IArgumentDetails[]; -} - -export interface IEnvVarOption { - hidden?: boolean; - global?: boolean; -} - -/** Environment variable setting's. */ -export interface IEnvVariable extends IEnvVarOption { - names: string[]; - description: string; - type: string; - details: IArgumentDetails; -} - -/** Type option's. */ -export interface ITypeOption { - override?: boolean; - global?: boolean; -} - -/** Type option's. */ -export interface ITypeSettings extends ITypeOption { - name: string; - handler: Type | ITypeHandler; -} - -export type ITypeMap = Map; - -/** Example setting's. */ -export interface IExample { - name: string; - description: string; -} - -/** Result of `cmd.parse()`. */ -export interface IParseResult = any> { - options: O; - args: A; - literal: string[]; - cmd: Command; -} - -export interface ICompleteOptions { - override?: boolean; - global?: boolean; -} - -export interface ICompleteSettings extends ICompleteOptions { - name: string; - complete: ICompleteHandler; -} - -/** Type parser method. */ -export type ICompleteHandler = ( cmd: Command, parent?: Command ) => string[] | Promise; diff --git a/crates/swc_bundler/tests/.cache/deno/23757f2a45edf09f858ba2b3dd6b3d1ca9908dc2.ts b/crates/swc_bundler/tests/.cache/deno/23757f2a45edf09f858ba2b3dd6b3d1ca9908dc2.ts deleted file mode 100644 index 0b96b236fc3b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/23757f2a45edf09f858ba2b3dd6b3d1ca9908dc2.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/mysql/src/auth_plugin/crypt.ts - - -import { RSA } from "https://deno.land/x/god_crypto@v0.2.0/mod.ts"; -function encryptWithPublicKey(key: string, data: Uint8Array): Uint8Array { - const publicKey = RSA.parseKey(key); - return RSA.encrypt(data, publicKey); -} - -export { encryptWithPublicKey }; diff --git a/crates/swc_bundler/tests/.cache/deno/23932f4bd1fc8d5fc3f43bec5ebb45e8a8003868.ts b/crates/swc_bundler/tests/.cache/deno/23932f4bd1fc8d5fc3f43bec5ebb45e8a8003868.ts deleted file mode 100644 index 6aacb700a3ab..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/23932f4bd1fc8d5fc3f43bec5ebb45e8a8003868.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/ws/events.ts - - -import type { DiscordGatewayPayload } from "../types/gateway/gateway_payload.ts"; -import { DiscordenoShard, WebSocketRequest } from "./ws.ts"; - -/** The handler for logging different actions happening inside the ws. User can override and put custom handling per event. */ -export function log(type: "CLOSED", data: { shardId: number; payload: CloseEvent }): unknown; -export function log(type: "CLOSED_RECONNECT", data: { shardId: number; payload: CloseEvent }): unknown; -export function log(type: "ERROR", data: Record & { shardId: number }): unknown; -export function log(type: "HEARTBEATING", data: { shardId: number; shard: DiscordenoShard }): unknown; -export function log(type: "HEARTBEATING_CLOSED", data: { shardId: number; shard: DiscordenoShard }): unknown; -export function log( - type: "HEARTBEATING_DETAILS", - data: { shardId: number; interval: number; shard: DiscordenoShard } -): unknown; -export function log(type: "HEARTBEATING_STARTED", data: { shardId: number; interval: number }): unknown; -export function log(type: "IDENTIFYING", data: { shardId: number; maxShards: number }): unknown; -export function log(type: "INVALID_SESSION", data: { shardId: number; payload: DiscordGatewayPayload }): unknown; -export function log(type: "RAW", data: Record): unknown; -export function log(type: "RAW_SEND", shardId: number, data: WebSocketRequest): unknown; -export function log(type: "RECONNECT", data: { shardId: number }): unknown; -export function log(type: "RESUMED", data: { shardId: number }): unknown; -export function log(type: "RESUMING", data: { shardId: number }): unknown; -export function log(type: "DEBUG", data: unknown): unknown; -export function log( - type: - | "CLOSED" - | "CLOSED_RECONNECT" - | "ERROR" - | "HEARTBEATING" - | "HEARTBEATING_CLOSED" - | "HEARTBEATING_DETAILS" - | "HEARTBEATING_STARTED" - | "IDENTIFYING" - | "INVALID_SESSION" - | "RAW" - | "RAW_SEND" - | "RECONNECT" - | "RESUMED" - | "RESUMING" - | "DEBUG", - data: unknown -) { - // This is just a placeholder for the dev to override - if (!type && !data) console.log(type, data); -} diff --git a/crates/swc_bundler/tests/.cache/deno/2398ec583e381bfbf7d3d6bf9daa86f50224c05f.ts b/crates/swc_bundler/tests/.cache/deno/2398ec583e381bfbf7d3d6bf9daa86f50224c05f.ts deleted file mode 100644 index 8f58546a1296..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2398ec583e381bfbf7d3d6bf9daa86f50224c05f.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/members/guild_member.ts - - -import { User } from "../users/user.ts"; - -/** https://discord.com/developers/docs/resources/guild#guild-member-object */ -export interface GuildMember { - /** The user this guild member represents */ - user?: User; - /** This users guild nickname */ - nick?: string | null; - /** Array of role object ids */ - roles: string[]; - /** When the user joined the guild */ - joinedAt: string; - /** When the user started boosing the guild */ - premiumSince?: string | null; - /** Whether the user is deafened in voice channels */ - deaf: boolean; - /** Whether the user is muted in voice channels */ - mute: boolean; - /** Whether the user has not yet passed the guild's Membership Screening requirements */ - pending?: boolean; -} - -// We use these types much since user always exists unless its a `CREATE_MESSAGE` or `MESSAGE_UPDATE` event - -/** https://discord.com/developers/docs/resources/guild#guild-member-object */ -export type GuildMemberWithUser = Omit & { user: User }; diff --git a/crates/swc_bundler/tests/.cache/deno/23c84b974d00dec426c6a7225d4b451aca13ba70.ts b/crates/swc_bundler/tests/.cache/deno/23c84b974d00dec426c6a7225d4b451aca13ba70.ts deleted file mode 100644 index c52e3b9b1535..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/23c84b974d00dec426c6a7225d4b451aca13ba70.ts +++ /dev/null @@ -1,105 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/gateway/gateway_intents.ts - - -/** https://discord.com/developers/docs/topics/gateway#list-of-intents */ -export enum DiscordGatewayIntents { - /** - * - GUILD_CREATE - * - GUILD_DELETE - * - GUILD_ROLE_CREATE - * - GUILD_ROLE_UPDATE - * - GUILD_ROLE_DELETE - * - CHANNEL_CREATE - * - CHANNEL_UPDATE - * - CHANNEL_DELETE - * - CHANNEL_PINS_UPDATE - * - THREAD_CREATE - * - THREAD_UPDATE - * - THREAD_DELETE - * - THREAD_LIST_SYNC - * - THREAD_MEMBER_UPDATE - * - THREAD_MEMBERS_UPDATE - * - STAGE_INSTANCE_CREATE - * - STAGE_INSTANCE_UPDATE - * - STAGE_INSTANCE_DELETE - */ - Guilds = 1 << 0, - /** - * - GUILD_MEMBER_ADD - * - GUILD_MEMBER_UPDATE - * - GUILD_MEMBER_REMOVE - */ - GuildMembers = 1 << 1, - /** - * - GUILD_BAN_ADD - * - GUILD_BAN_REMOVE - */ - GuildBans = 1 << 2, - /** - * - GUILD_EMOJIS_UPDATE - */ - GuildEmojis = 1 << 3, - /** - * - GUILD_INTEGRATIONS_UPDATE - * - INTEGRATION_CREATE - * - INTEGRATION_UPDATE - * - INTEGRATION_DELETE - */ - GuildIntegrations = 1 << 4, - /** Enables the following events: - * - WEBHOOKS_UPDATE - */ - GuildWebhooks = 1 << 5, - /** - * - INVITE_CREATE - * - INVITE_DELETE - */ - GuildInvites = 1 << 6, - /** - * - VOICE_STATE_UPDATE - */ - GuildVoiceStates = 1 << 7, - /** - * - PRESENCE_UPDATE - */ - GuildPresences = 1 << 8, - /** - * - MESSAGE_CREATE - * - MESSAGE_UPDATE - * - MESSAGE_DELETE - */ - GuildMessages = 1 << 9, - /** - * - MESSAGE_REACTION_ADD - * - MESSAGE_REACTION_REMOVE - * - MESSAGE_REACTION_REMOVE_ALL - * - MESSAGE_REACTION_REMOVE_EMOJI - */ - GuildMessageReactions = 1 << 10, - /** - * - TYPING_START - */ - GuildMessageTyping = 1 << 11, - /** - * - CHANNEL_CREATE - * - MESSAGE_CREATE - * - MESSAGE_UPDATE - * - MESSAGE_DELETE - * - CHANNEL_PINS_UPDATE - */ - DirectMessages = 1 << 12, - /** - * - MESSAGE_REACTION_ADD - * - MESSAGE_REACTION_REMOVE - * - MESSAGE_REACTION_REMOVE_ALL - * - MESSAGE_REACTION_REMOVE_EMOJI - */ - DirectMessageReactions = 1 << 13, - /** - * - TYPING_START - */ - DirectMessageTyping = 1 << 14, -} - -export type Intents = DiscordGatewayIntents; -export const Intents = DiscordGatewayIntents; diff --git a/crates/swc_bundler/tests/.cache/deno/23ea8eb81de07a565c0781f28bcd6b4725d81f70.ts b/crates/swc_bundler/tests/.cache/deno/23ea8eb81de07a565c0781f28bcd6b4725d81f70.ts deleted file mode 100644 index 85d61807c157..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/23ea8eb81de07a565c0781f28bcd6b4725d81f70.ts +++ /dev/null @@ -1,546 +0,0 @@ -// Loaded from https://deno.land/std@0.75.0/hash/sha256.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -/* - * Adapted to deno from: - * - * [js-sha256]{@link https://github.com/emn178/js-sha256} - * - * @version 0.9.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2014-2017 - * @license MIT - */ - -export type Message = string | number[] | ArrayBuffer; - -const HEX_CHARS = "0123456789abcdef".split(""); -const EXTRA = [-2147483648, 8388608, 32768, 128] as const; -const SHIFT = [24, 16, 8, 0] as const; -// deno-fmt-ignore -const K = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, - 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, - 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, - 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, - 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, - 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, -] as const; - -const blocks: number[] = []; - -export class Sha256 { - #block!: number; - #blocks!: number[]; - #bytes!: number; - #finalized!: boolean; - #first!: boolean; - #h0!: number; - #h1!: number; - #h2!: number; - #h3!: number; - #h4!: number; - #h5!: number; - #h6!: number; - #h7!: number; - #hashed!: boolean; - #hBytes!: number; - #is224!: boolean; - #lastByteIndex = 0; - #start!: number; - - constructor(is224 = false, sharedMemory = false) { - this.init(is224, sharedMemory); - } - - protected init(is224: boolean, sharedMemory: boolean): void { - if (sharedMemory) { - // deno-fmt-ignore - blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; - this.#blocks = blocks; - } else { - this.#blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - } - - if (is224) { - this.#h0 = 0xc1059ed8; - this.#h1 = 0x367cd507; - this.#h2 = 0x3070dd17; - this.#h3 = 0xf70e5939; - this.#h4 = 0xffc00b31; - this.#h5 = 0x68581511; - this.#h6 = 0x64f98fa7; - this.#h7 = 0xbefa4fa4; - } else { - // 256 - this.#h0 = 0x6a09e667; - this.#h1 = 0xbb67ae85; - this.#h2 = 0x3c6ef372; - this.#h3 = 0xa54ff53a; - this.#h4 = 0x510e527f; - this.#h5 = 0x9b05688c; - this.#h6 = 0x1f83d9ab; - this.#h7 = 0x5be0cd19; - } - - this.#block = this.#start = this.#bytes = this.#hBytes = 0; - this.#finalized = this.#hashed = false; - this.#first = true; - this.#is224 = is224; - } - - /** Update hash - * - * @param message The message you want to hash. - */ - update(message: Message): this { - if (this.#finalized) { - return this; - } - - let msg: string | number[] | Uint8Array | undefined; - if (message instanceof ArrayBuffer) { - msg = new Uint8Array(message); - } else { - msg = message; - } - - let index = 0; - const length = msg.length; - const blocks = this.#blocks; - - while (index < length) { - let i: number; - if (this.#hashed) { - this.#hashed = false; - blocks[0] = this.#block; - // deno-fmt-ignore - blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; - } - - if (typeof msg !== "string") { - for (i = this.#start; index < length && i < 64; ++index) { - blocks[i >> 2] |= msg[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.#start; index < length && i < 64; ++index) { - let code = msg.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + - (((code & 0x3ff) << 10) | (msg.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - - this.#lastByteIndex = i; - this.#bytes += i - this.#start; - if (i >= 64) { - this.#block = blocks[16]; - this.#start = i - 64; - this.hash(); - this.#hashed = true; - } else { - this.#start = i; - } - } - if (this.#bytes > 4294967295) { - this.#hBytes += (this.#bytes / 4294967296) << 0; - this.#bytes = this.#bytes % 4294967296; - } - return this; - } - - protected finalize(): void { - if (this.#finalized) { - return; - } - this.#finalized = true; - const blocks = this.#blocks; - const i = this.#lastByteIndex; - blocks[16] = this.#block; - blocks[i >> 2] |= EXTRA[i & 3]; - this.#block = blocks[16]; - if (i >= 56) { - if (!this.#hashed) { - this.hash(); - } - blocks[0] = this.#block; - // deno-fmt-ignore - blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; - } - blocks[14] = (this.#hBytes << 3) | (this.#bytes >>> 29); - blocks[15] = this.#bytes << 3; - this.hash(); - } - - protected hash(): void { - let a = this.#h0; - let b = this.#h1; - let c = this.#h2; - let d = this.#h3; - let e = this.#h4; - let f = this.#h5; - let g = this.#h6; - let h = this.#h7; - const blocks = this.#blocks; - let s0: number; - let s1: number; - let maj: number; - let t1: number; - let t2: number; - let ch: number; - let ab: number; - let da: number; - let cd: number; - let bc: number; - - for (let j = 16; j < 64; ++j) { - // rightrotate - t1 = blocks[j - 15]; - s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3); - t1 = blocks[j - 2]; - s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ - (t1 >>> 10); - blocks[j] = (blocks[j - 16] + s0 + blocks[j - 7] + s1) << 0; - } - - bc = b & c; - for (let j = 0; j < 64; j += 4) { - if (this.#first) { - if (this.#is224) { - ab = 300032; - t1 = blocks[0] - 1413257819; - h = (t1 - 150054599) << 0; - d = (t1 + 24177077) << 0; - } else { - ab = 704751109; - t1 = blocks[0] - 210244248; - h = (t1 - 1521486534) << 0; - d = (t1 + 143694565) << 0; - } - this.#first = false; - } else { - s0 = ((a >>> 2) | (a << 30)) ^ - ((a >>> 13) | (a << 19)) ^ - ((a >>> 22) | (a << 10)); - s1 = ((e >>> 6) | (e << 26)) ^ - ((e >>> 11) | (e << 21)) ^ - ((e >>> 25) | (e << 7)); - ab = a & b; - maj = ab ^ (a & c) ^ bc; - ch = (e & f) ^ (~e & g); - t1 = h + s1 + ch + K[j] + blocks[j]; - t2 = s0 + maj; - h = (d + t1) << 0; - d = (t1 + t2) << 0; - } - s0 = ((d >>> 2) | (d << 30)) ^ - ((d >>> 13) | (d << 19)) ^ - ((d >>> 22) | (d << 10)); - s1 = ((h >>> 6) | (h << 26)) ^ - ((h >>> 11) | (h << 21)) ^ - ((h >>> 25) | (h << 7)); - da = d & a; - maj = da ^ (d & b) ^ ab; - ch = (h & e) ^ (~h & f); - t1 = g + s1 + ch + K[j + 1] + blocks[j + 1]; - t2 = s0 + maj; - g = (c + t1) << 0; - c = (t1 + t2) << 0; - s0 = ((c >>> 2) | (c << 30)) ^ - ((c >>> 13) | (c << 19)) ^ - ((c >>> 22) | (c << 10)); - s1 = ((g >>> 6) | (g << 26)) ^ - ((g >>> 11) | (g << 21)) ^ - ((g >>> 25) | (g << 7)); - cd = c & d; - maj = cd ^ (c & a) ^ da; - ch = (g & h) ^ (~g & e); - t1 = f + s1 + ch + K[j + 2] + blocks[j + 2]; - t2 = s0 + maj; - f = (b + t1) << 0; - b = (t1 + t2) << 0; - s0 = ((b >>> 2) | (b << 30)) ^ - ((b >>> 13) | (b << 19)) ^ - ((b >>> 22) | (b << 10)); - s1 = ((f >>> 6) | (f << 26)) ^ - ((f >>> 11) | (f << 21)) ^ - ((f >>> 25) | (f << 7)); - bc = b & c; - maj = bc ^ (b & d) ^ cd; - ch = (f & g) ^ (~f & h); - t1 = e + s1 + ch + K[j + 3] + blocks[j + 3]; - t2 = s0 + maj; - e = (a + t1) << 0; - a = (t1 + t2) << 0; - } - - this.#h0 = (this.#h0 + a) << 0; - this.#h1 = (this.#h1 + b) << 0; - this.#h2 = (this.#h2 + c) << 0; - this.#h3 = (this.#h3 + d) << 0; - this.#h4 = (this.#h4 + e) << 0; - this.#h5 = (this.#h5 + f) << 0; - this.#h6 = (this.#h6 + g) << 0; - this.#h7 = (this.#h7 + h) << 0; - } - - /** Return hash in hex string. */ - hex(): string { - this.finalize(); - - const h0 = this.#h0; - const h1 = this.#h1; - const h2 = this.#h2; - const h3 = this.#h3; - const h4 = this.#h4; - const h5 = this.#h5; - const h6 = this.#h6; - const h7 = this.#h7; - - let hex = HEX_CHARS[(h0 >> 28) & 0x0f] + - HEX_CHARS[(h0 >> 24) & 0x0f] + - HEX_CHARS[(h0 >> 20) & 0x0f] + - HEX_CHARS[(h0 >> 16) & 0x0f] + - HEX_CHARS[(h0 >> 12) & 0x0f] + - HEX_CHARS[(h0 >> 8) & 0x0f] + - HEX_CHARS[(h0 >> 4) & 0x0f] + - HEX_CHARS[h0 & 0x0f] + - HEX_CHARS[(h1 >> 28) & 0x0f] + - HEX_CHARS[(h1 >> 24) & 0x0f] + - HEX_CHARS[(h1 >> 20) & 0x0f] + - HEX_CHARS[(h1 >> 16) & 0x0f] + - HEX_CHARS[(h1 >> 12) & 0x0f] + - HEX_CHARS[(h1 >> 8) & 0x0f] + - HEX_CHARS[(h1 >> 4) & 0x0f] + - HEX_CHARS[h1 & 0x0f] + - HEX_CHARS[(h2 >> 28) & 0x0f] + - HEX_CHARS[(h2 >> 24) & 0x0f] + - HEX_CHARS[(h2 >> 20) & 0x0f] + - HEX_CHARS[(h2 >> 16) & 0x0f] + - HEX_CHARS[(h2 >> 12) & 0x0f] + - HEX_CHARS[(h2 >> 8) & 0x0f] + - HEX_CHARS[(h2 >> 4) & 0x0f] + - HEX_CHARS[h2 & 0x0f] + - HEX_CHARS[(h3 >> 28) & 0x0f] + - HEX_CHARS[(h3 >> 24) & 0x0f] + - HEX_CHARS[(h3 >> 20) & 0x0f] + - HEX_CHARS[(h3 >> 16) & 0x0f] + - HEX_CHARS[(h3 >> 12) & 0x0f] + - HEX_CHARS[(h3 >> 8) & 0x0f] + - HEX_CHARS[(h3 >> 4) & 0x0f] + - HEX_CHARS[h3 & 0x0f] + - HEX_CHARS[(h4 >> 28) & 0x0f] + - HEX_CHARS[(h4 >> 24) & 0x0f] + - HEX_CHARS[(h4 >> 20) & 0x0f] + - HEX_CHARS[(h4 >> 16) & 0x0f] + - HEX_CHARS[(h4 >> 12) & 0x0f] + - HEX_CHARS[(h4 >> 8) & 0x0f] + - HEX_CHARS[(h4 >> 4) & 0x0f] + - HEX_CHARS[h4 & 0x0f] + - HEX_CHARS[(h5 >> 28) & 0x0f] + - HEX_CHARS[(h5 >> 24) & 0x0f] + - HEX_CHARS[(h5 >> 20) & 0x0f] + - HEX_CHARS[(h5 >> 16) & 0x0f] + - HEX_CHARS[(h5 >> 12) & 0x0f] + - HEX_CHARS[(h5 >> 8) & 0x0f] + - HEX_CHARS[(h5 >> 4) & 0x0f] + - HEX_CHARS[h5 & 0x0f] + - HEX_CHARS[(h6 >> 28) & 0x0f] + - HEX_CHARS[(h6 >> 24) & 0x0f] + - HEX_CHARS[(h6 >> 20) & 0x0f] + - HEX_CHARS[(h6 >> 16) & 0x0f] + - HEX_CHARS[(h6 >> 12) & 0x0f] + - HEX_CHARS[(h6 >> 8) & 0x0f] + - HEX_CHARS[(h6 >> 4) & 0x0f] + - HEX_CHARS[h6 & 0x0f]; - if (!this.#is224) { - hex += HEX_CHARS[(h7 >> 28) & 0x0f] + - HEX_CHARS[(h7 >> 24) & 0x0f] + - HEX_CHARS[(h7 >> 20) & 0x0f] + - HEX_CHARS[(h7 >> 16) & 0x0f] + - HEX_CHARS[(h7 >> 12) & 0x0f] + - HEX_CHARS[(h7 >> 8) & 0x0f] + - HEX_CHARS[(h7 >> 4) & 0x0f] + - HEX_CHARS[h7 & 0x0f]; - } - return hex; - } - - /** Return hash in hex string. */ - toString(): string { - return this.hex(); - } - - /** Return hash in integer array. */ - digest(): number[] { - this.finalize(); - - const h0 = this.#h0; - const h1 = this.#h1; - const h2 = this.#h2; - const h3 = this.#h3; - const h4 = this.#h4; - const h5 = this.#h5; - const h6 = this.#h6; - const h7 = this.#h7; - - const arr = [ - (h0 >> 24) & 0xff, - (h0 >> 16) & 0xff, - (h0 >> 8) & 0xff, - h0 & 0xff, - (h1 >> 24) & 0xff, - (h1 >> 16) & 0xff, - (h1 >> 8) & 0xff, - h1 & 0xff, - (h2 >> 24) & 0xff, - (h2 >> 16) & 0xff, - (h2 >> 8) & 0xff, - h2 & 0xff, - (h3 >> 24) & 0xff, - (h3 >> 16) & 0xff, - (h3 >> 8) & 0xff, - h3 & 0xff, - (h4 >> 24) & 0xff, - (h4 >> 16) & 0xff, - (h4 >> 8) & 0xff, - h4 & 0xff, - (h5 >> 24) & 0xff, - (h5 >> 16) & 0xff, - (h5 >> 8) & 0xff, - h5 & 0xff, - (h6 >> 24) & 0xff, - (h6 >> 16) & 0xff, - (h6 >> 8) & 0xff, - h6 & 0xff, - ]; - if (!this.#is224) { - arr.push( - (h7 >> 24) & 0xff, - (h7 >> 16) & 0xff, - (h7 >> 8) & 0xff, - h7 & 0xff, - ); - } - return arr; - } - - /** Return hash in integer array. */ - array(): number[] { - return this.digest(); - } - - /** Return hash in ArrayBuffer. */ - arrayBuffer(): ArrayBuffer { - this.finalize(); - - const buffer = new ArrayBuffer(this.#is224 ? 28 : 32); - const dataView = new DataView(buffer); - dataView.setUint32(0, this.#h0); - dataView.setUint32(4, this.#h1); - dataView.setUint32(8, this.#h2); - dataView.setUint32(12, this.#h3); - dataView.setUint32(16, this.#h4); - dataView.setUint32(20, this.#h5); - dataView.setUint32(24, this.#h6); - if (!this.#is224) { - dataView.setUint32(28, this.#h7); - } - return buffer; - } -} - -export class HmacSha256 extends Sha256 { - #inner: boolean; - #is224: boolean; - #oKeyPad: number[]; - #sharedMemory: boolean; - - constructor(secretKey: Message, is224 = false, sharedMemory = false) { - super(is224, sharedMemory); - - let key: number[] | Uint8Array | undefined; - if (typeof secretKey === "string") { - const bytes: number[] = []; - const length = secretKey.length; - let index = 0; - for (let i = 0; i < length; ++i) { - let code = secretKey.charCodeAt(i); - if (code < 0x80) { - bytes[index++] = code; - } else if (code < 0x800) { - bytes[index++] = 0xc0 | (code >> 6); - bytes[index++] = 0x80 | (code & 0x3f); - } else if (code < 0xd800 || code >= 0xe000) { - bytes[index++] = 0xe0 | (code >> 12); - bytes[index++] = 0x80 | ((code >> 6) & 0x3f); - bytes[index++] = 0x80 | (code & 0x3f); - } else { - code = 0x10000 + - (((code & 0x3ff) << 10) | (secretKey.charCodeAt(++i) & 0x3ff)); - bytes[index++] = 0xf0 | (code >> 18); - bytes[index++] = 0x80 | ((code >> 12) & 0x3f); - bytes[index++] = 0x80 | ((code >> 6) & 0x3f); - bytes[index++] = 0x80 | (code & 0x3f); - } - } - key = bytes; - } else { - if (secretKey instanceof ArrayBuffer) { - key = new Uint8Array(secretKey); - } else { - key = secretKey; - } - } - - if (key.length > 64) { - key = new Sha256(is224, true).update(key).array(); - } - - const oKeyPad: number[] = []; - const iKeyPad: number[] = []; - for (let i = 0; i < 64; ++i) { - const b = key[i] || 0; - oKeyPad[i] = 0x5c ^ b; - iKeyPad[i] = 0x36 ^ b; - } - - this.update(iKeyPad); - this.#oKeyPad = oKeyPad; - this.#inner = true; - this.#is224 = is224; - this.#sharedMemory = sharedMemory; - } - - protected finalize(): void { - super.finalize(); - if (this.#inner) { - this.#inner = false; - const innerHash = this.array(); - super.init(this.#is224, this.#sharedMemory); - this.update(this.#oKeyPad); - this.update(innerHash); - super.finalize(); - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/23f4b2f19f08795e4cc4cbeda7d20befdc86cde0.ts b/crates/swc_bundler/tests/.cache/deno/23f4b2f19f08795e4cc4cbeda7d20befdc86cde0.ts deleted file mode 100644 index a1ff248aa44a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/23f4b2f19f08795e4cc4cbeda7d20befdc86cde0.ts +++ /dev/null @@ -1,109 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/getIntrospectionQuery.js - - -export function getIntrospectionQuery(options) { - const optionsWithDefault = { - descriptions: true, - directiveIsRepeatable: false, - schemaDescription: false, - ...options - }; - const descriptions = optionsWithDefault.descriptions ? 'description' : ''; - const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable ? 'isRepeatable' : ''; - const schemaDescription = optionsWithDefault.schemaDescription ? descriptions : ''; - return ` - query IntrospectionQuery { - __schema { - ${schemaDescription} - queryType { name } - mutationType { name } - subscriptionType { name } - types { - ...FullType - } - directives { - name - ${descriptions} - ${directiveIsRepeatable} - locations - args { - ...InputValue - } - } - } - } - - fragment FullType on __Type { - kind - name - ${descriptions} - fields(includeDeprecated: true) { - name - ${descriptions} - args { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - ${descriptions} - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - - fragment InputValue on __InputValue { - name - ${descriptions} - type { ...TypeRef } - defaultValue - } - - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } - `; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/24215edc904104698eb3a4674075d856ef5956aa.ts b/crates/swc_bundler/tests/.cache/deno/24215edc904104698eb3a4674075d856ef5956aa.ts deleted file mode 100644 index 5b783c79b6d9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/24215edc904104698eb3a4674075d856ef5956aa.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/nth.js - - -import _curry2 from './internal/_curry2.js'; -import _isString from './internal/_isString.js'; - - -/** - * Returns the nth element of the given list or string. If n is negative the - * element at index length + n is returned. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category List - * @sig Number -> [a] -> a | Undefined - * @sig Number -> String -> String - * @param {Number} offset - * @param {*} list - * @return {*} - * @example - * - * const list = ['foo', 'bar', 'baz', 'quux']; - * R.nth(1, list); //=> 'bar' - * R.nth(-1, list); //=> 'quux' - * R.nth(-99, list); //=> undefined - * - * R.nth(2, 'abc'); //=> 'c' - * R.nth(3, 'abc'); //=> '' - * @symb R.nth(-1, [a, b, c]) = c - * @symb R.nth(0, [a, b, c]) = a - * @symb R.nth(1, [a, b, c]) = b - */ -var nth = _curry2(function nth(offset, list) { - var idx = offset < 0 ? list.length + offset : offset; - return _isString(list) ? list.charAt(idx) : list[idx]; -}); -export default nth; diff --git a/crates/swc_bundler/tests/.cache/deno/24279622b88096044234fd988ade9c3f8b7f7789.ts b/crates/swc_bundler/tests/.cache/deno/24279622b88096044234fd988ade9c3f8b7f7789.ts deleted file mode 100644 index 7ea9459374c6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/24279622b88096044234fd988ade9c3f8b7f7789.ts +++ /dev/null @@ -1,60 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/x/lowerCase.ts - - -/** - * via: https://github.com/blakeembrey/lower-case - */ - -import { LanguageSpecific } from 'https://deno.land/x/case/types.ts'; - -/** - * Special language-specific overrides. - * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt - */ -const LANGUAGES: LanguageSpecific = { - tr: { - regexp: /\u0130|\u0049|\u0049\u0307/g, - map: { - İ: '\u0069', - I: '\u0131' - // İ: '\u0069' - } - }, - az: { - regexp: /[\u0130]/g, - map: { - İ: '\u0069', - I: '\u0131' - // İ: '\u0069' - } - }, - lt: { - regexp: /[\u0049\u004A\u012E\u00CC\u00CD\u0128]/g, - map: { - I: '\u0069\u0307', - J: '\u006A\u0307', - Į: '\u012F\u0307', - Ì: '\u0069\u0307\u0300', - Í: '\u0069\u0307\u0301', - Ĩ: '\u0069\u0307\u0303' - } - } -}; - -/** - * Lowercase a string. - * - * @param {String} str - * @return {String} - */ -export default function ( str: string, locale?: string ): string { - const lang = locale && LANGUAGES[ locale ]; - - str = str == null ? '' : String( str ); - - if ( lang ) { - str = str.replace( lang.regexp, ( m: string ): string => lang.map[ m ] ); - } - - return str.toLowerCase(); -} diff --git a/crates/swc_bundler/tests/.cache/deno/24485297d719ecfc501e841f12fab821d87d2b70.ts b/crates/swc_bundler/tests/.cache/deno/24485297d719ecfc501e841f12fab821d87d2b70.ts deleted file mode 100644 index b7150864e034..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/24485297d719ecfc501e841f12fab821d87d2b70.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/members/mod.ts - - -export * from "./guild_member.ts"; -export * from "./guild_members_chunk.ts"; -export * from "./guild_member_add.ts"; -export * from "./guild_member_remove.ts"; -export * from "./guild_member_update.ts"; -export * from "./list_guild_members.ts"; -export * from "./modify_current_user_nick.ts"; -export * from "./request_guild_members.ts"; -export * from "./search_guild_members.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/2453e4e427d8028ee0e560424008c732c2d30aaa.ts b/crates/swc_bundler/tests/.cache/deno/2453e4e427d8028ee0e560424008c732c2d30aaa.ts deleted file mode 100644 index 859ed209cc6d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2453e4e427d8028ee0e560424008c732c2d30aaa.ts +++ /dev/null @@ -1,390 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/path/glob.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -import { osType } from "../_util/os.ts"; -import { join, normalize } from "./mod.ts"; -import { SEP, SEP_PATTERN } from "./separator.ts"; - -export interface GlobOptions { - /** Extended glob syntax. - * See https://www.linuxjournal.com/content/bash-extended-globbing. Defaults - * to true. */ - extended?: boolean; - /** Globstar syntax. - * See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * If false, `**` is treated like `*`. Defaults to true. */ - globstar?: boolean; - /** Operating system. Defaults to the native OS. */ - os?: typeof Deno.build.os; -} - -export type GlobToRegExpOptions = GlobOptions; - -// deno-fmt-ignore -const regExpEscapeChars = ["!", "$", "(", ")", "*", "+", ".", "=", "?", "[", "\\", "^", "{", "|"]; -const rangeEscapeChars = ["-", "\\", "]"]; - -/** Convert a glob string to a regular expression. - * - * Tries to match bash glob expansion as closely as possible. - * - * Basic glob syntax: - * - `*` - Matches everything without leaving the path segment. - * - `{foo,bar}` - Matches `foo` or `bar`. - * - `[abcd]` - Matches `a`, `b`, `c` or `d`. - * - `[a-d]` - Matches `a`, `b`, `c` or `d`. - * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`. - * - `[[::]]` - Matches any character belonging to ``. - * - `[[:alnum:]]` - Matches any digit or letter. - * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`. - * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes - * for a complete list of supported character classes. - * - `\` - Escapes the next character for an `os` other than `"windows"`. - * - \` - Escapes the next character for `os` set to `"windows"`. - * - `/` - Path separator. - * - `\` - Additional path separator only for `os` set to `"windows"`. - * - * Extended syntax: - * - Requires `{ extended: true }`. - * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`. - * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same. - * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`. - * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`. - * - `!(foo|bar)` - Matches anything other than `{foo,bar}`. - * - See https://www.linuxjournal.com/content/bash-extended-globbing. - * - * Globstar syntax: - * - Requires `{ globstar: true }`. - * - `**` - Matches any number of any path segments. - * - Must comprise its entire path segment in the provided glob. - * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * - * Note the following properties: - * - The generated `RegExp` is anchored at both start and end. - * - Repeating and trailing separators are tolerated. Trailing separators in the - * provided glob have no meaning and are discarded. - * - Absolute globs will only match absolute paths, etc. - * - Empty globs will match nothing. - * - Any special glob syntax must be contained to one path segment. For example, - * `?(foo|bar/baz)` is invalid. The separator will take precendence and the - * first segment ends with an unclosed group. - * - If a path segment ends with unclosed groups or a dangling escape prefix, a - * parse error has occured. Every character for that segment is taken - * literally in this event. - * - * Limitations: - * - A negative group like `!(foo|bar)` will wrongly be converted to a negative - * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly - * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively, - * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if - * the group occurs not nested at the end of the segment. */ -export function globToRegExp( - glob: string, - { extended = true, globstar: globstarOption = true, os = osType }: - GlobToRegExpOptions = {}, -): RegExp { - if (glob == "") { - return /(?!)/; - } - - const sep = os == "windows" ? "(?:\\\\|/)+" : "/+"; - const sepMaybe = os == "windows" ? "(?:\\\\|/)*" : "/*"; - const seps = os == "windows" ? ["\\", "/"] : ["/"]; - const globstar = os == "windows" - ? "(?:[^\\\\/]*(?:\\\\|/|$)+)*" - : "(?:[^/]*(?:/|$)+)*"; - const wildcard = os == "windows" ? "[^\\\\/]*" : "[^/]*"; - const escapePrefix = os == "windows" ? "`" : "\\"; - - // Remove trailing separators. - let newLength = glob.length; - for (; newLength > 1 && seps.includes(glob[newLength - 1]); newLength--); - glob = glob.slice(0, newLength); - - let regExpString = ""; - - // Terminates correctly. Trust that `j` is incremented every iteration. - for (let j = 0; j < glob.length;) { - let segment = ""; - const groupStack = []; - let inRange = false; - let inEscape = false; - let endsWithSep = false; - let i = j; - - // Terminates with `i` at the non-inclusive end of the current segment. - for (; i < glob.length && !seps.includes(glob[i]); i++) { - if (inEscape) { - inEscape = false; - const escapeChars = inRange ? rangeEscapeChars : regExpEscapeChars; - segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - continue; - } - - if (glob[i] == escapePrefix) { - inEscape = true; - continue; - } - - if (glob[i] == "[") { - if (!inRange) { - inRange = true; - segment += "["; - if (glob[i + 1] == "!") { - i++; - segment += "^"; - } else if (glob[i + 1] == "^") { - i++; - segment += "\\^"; - } - continue; - } else if (glob[i + 1] == ":") { - let k = i + 1; - let value = ""; - while (glob[k + 1] != null && glob[k + 1] != ":") { - value += glob[k + 1]; - k++; - } - if (glob[k + 1] == ":" && glob[k + 2] == "]") { - i = k + 2; - if (value == "alnum") segment += "\\dA-Za-z"; - else if (value == "alpha") segment += "A-Za-z"; - else if (value == "ascii") segment += "\x00-\x7F"; - else if (value == "blank") segment += "\t "; - else if (value == "cntrl") segment += "\x00-\x1F\x7F"; - else if (value == "digit") segment += "\\d"; - else if (value == "graph") segment += "\x21-\x7E"; - else if (value == "lower") segment += "a-z"; - else if (value == "print") segment += "\x20-\x7E"; - else if (value == "punct") { - segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~"; - } else if (value == "space") segment += "\\s\v"; - else if (value == "upper") segment += "A-Z"; - else if (value == "word") segment += "\\w"; - else if (value == "xdigit") segment += "\\dA-Fa-f"; - continue; - } - } - } - - if (glob[i] == "]" && inRange) { - inRange = false; - segment += "]"; - continue; - } - - if (inRange) { - if (glob[i] == "\\") { - segment += `\\\\`; - } else { - segment += glob[i]; - } - continue; - } - - if ( - glob[i] == ")" && groupStack.length > 0 && - groupStack[groupStack.length - 1] != "BRACE" - ) { - segment += ")"; - const type = groupStack.pop()!; - if (type == "!") { - segment += wildcard; - } else if (type != "@") { - segment += type; - } - continue; - } - - if ( - glob[i] == "|" && groupStack.length > 0 && - groupStack[groupStack.length - 1] != "BRACE" - ) { - segment += "|"; - continue; - } - - if (glob[i] == "+" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("+"); - segment += "(?:"; - continue; - } - - if (glob[i] == "@" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("@"); - segment += "(?:"; - continue; - } - - if (glob[i] == "?") { - if (extended && glob[i + 1] == "(") { - i++; - groupStack.push("?"); - segment += "(?:"; - } else { - segment += "."; - } - continue; - } - - if (glob[i] == "!" && extended && glob[i + 1] == "(") { - i++; - groupStack.push("!"); - segment += "(?!"; - continue; - } - - if (glob[i] == "{") { - groupStack.push("BRACE"); - segment += "(?:"; - continue; - } - - if (glob[i] == "}" && groupStack[groupStack.length - 1] == "BRACE") { - groupStack.pop(); - segment += ")"; - continue; - } - - if (glob[i] == "," && groupStack[groupStack.length - 1] == "BRACE") { - segment += "|"; - continue; - } - - if (glob[i] == "*") { - if (extended && glob[i + 1] == "(") { - i++; - groupStack.push("*"); - segment += "(?:"; - } else { - const prevChar = glob[i - 1]; - let numStars = 1; - while (glob[i + 1] == "*") { - i++; - numStars++; - } - const nextChar = glob[i + 1]; - if ( - globstarOption && numStars == 2 && - [...seps, undefined].includes(prevChar) && - [...seps, undefined].includes(nextChar) - ) { - segment += globstar; - endsWithSep = true; - } else { - segment += wildcard; - } - } - continue; - } - - segment += regExpEscapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - } - - // Check for unclosed groups or a dangling backslash. - if (groupStack.length > 0 || inRange || inEscape) { - // Parse failure. Take all characters from this segment literally. - segment = ""; - for (const c of glob.slice(j, i)) { - segment += regExpEscapeChars.includes(c) ? `\\${c}` : c; - endsWithSep = false; - } - } - - regExpString += segment; - if (!endsWithSep) { - regExpString += i < glob.length ? sep : sepMaybe; - endsWithSep = true; - } - - // Terminates with `i` at the start of the next segment. - while (seps.includes(glob[i])) i++; - - // Check that the next value of `j` is indeed higher than the current value. - if (!(i > j)) { - throw new Error("Assertion failure: i > j (potential infinite loop)"); - } - j = i; - } - - regExpString = `^${regExpString}$`; - return new RegExp(regExpString); -} - -/** Test whether the given string is a glob */ -export function isGlob(str: string): boolean { - const chars: Record = { "{": "}", "(": ")", "[": "]" }; - const regex = - /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; - - if (str === "") { - return false; - } - - let match: RegExpExecArray | null; - - while ((match = regex.exec(str))) { - if (match[2]) return true; - let idx = match.index + match[0].length; - - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - const open = match[1]; - const close = open ? chars[open] : null; - if (open && close) { - const n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - - str = str.slice(idx); - } - - return false; -} - -/** Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. */ -export function normalizeGlob( - glob: string, - { globstar = false }: GlobOptions = {}, -): string { - if (glob.match(/\0/g)) { - throw new Error(`Glob contains invalid characters: "${glob}"`); - } - if (!globstar) { - return normalize(glob); - } - const s = SEP_PATTERN.source; - const badParentPattern = new RegExp( - `(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, - "g", - ); - return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); -} - -/** Like join(), but doesn't collapse "**\/.." when `globstar` is true. */ -export function joinGlobs( - globs: string[], - { extended = false, globstar = false }: GlobOptions = {}, -): string { - if (!globstar || globs.length == 0) { - return join(...globs); - } - if (globs.length === 0) return "."; - let joined: string | undefined; - for (const glob of globs) { - const path = glob; - if (path.length > 0) { - if (!joined) joined = path; - else joined += `${SEP}${path}`; - } - } - if (!joined) return "."; - return normalizeGlob(joined, { extended, globstar }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/24dddb52e5c4f8f5b0aa00d7f13efc5e08831eca.ts b/crates/swc_bundler/tests/.cache/deno/24dddb52e5c4f8f5b0aa00d7f13efc5e08831eca.ts deleted file mode 100644 index dc48dd46428a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/24dddb52e5c4f8f5b0aa00d7f13efc5e08831eca.ts +++ /dev/null @@ -1,120 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/path/_util.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -/** This module is browser compatible. */ - -import type { FormatInputPathObject } from "./_interface.ts"; -import { - CHAR_BACKWARD_SLASH, - CHAR_DOT, - CHAR_FORWARD_SLASH, - CHAR_LOWERCASE_A, - CHAR_LOWERCASE_Z, - CHAR_UPPERCASE_A, - CHAR_UPPERCASE_Z, -} from "./_constants.ts"; - -export function assertPath(path: string): void { - if (typeof path !== "string") { - throw new TypeError( - `Path must be a string. Received ${JSON.stringify(path)}`, - ); - } -} - -export function isPosixPathSeparator(code: number): boolean { - return code === CHAR_FORWARD_SLASH; -} - -export function isPathSeparator(code: number): boolean { - return isPosixPathSeparator(code) || code === CHAR_BACKWARD_SLASH; -} - -export function isWindowsDeviceRoot(code: number): boolean { - return ( - (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z) || - (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) - ); -} - -// Resolves . and .. elements in a path with directory names -export function normalizeString( - path: string, - allowAboveRoot: boolean, - separator: string, - isPathSeparator: (code: number) => boolean, -): string { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let code: number | undefined; - for (let i = 0, len = path.length; i <= len; ++i) { - if (i < len) code = path.charCodeAt(i); - else if (isPathSeparator(code!)) break; - else code = CHAR_FORWARD_SLASH; - - if (isPathSeparator(code!)) { - if (lastSlash === i - 1 || dots === 1) { - // NOOP - } else if (lastSlash !== i - 1 && dots === 2) { - if ( - res.length < 2 || - lastSegmentLength !== 2 || - res.charCodeAt(res.length - 1) !== CHAR_DOT || - res.charCodeAt(res.length - 2) !== CHAR_DOT - ) { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf(separator); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); - } - lastSlash = i; - dots = 0; - continue; - } else if (res.length === 2 || res.length === 1) { - res = ""; - lastSegmentLength = 0; - lastSlash = i; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - if (res.length > 0) res += `${separator}..`; - else res = ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) res += separator + path.slice(lastSlash + 1, i); - else res = path.slice(lastSlash + 1, i); - lastSegmentLength = i - lastSlash - 1; - } - lastSlash = i; - dots = 0; - } else if (code === CHAR_DOT && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} - -export function _format( - sep: string, - pathObject: FormatInputPathObject, -): string { - const dir: string | undefined = pathObject.dir || pathObject.root; - const base: string = pathObject.base || - (pathObject.name || "") + (pathObject.ext || ""); - if (!dir) return base; - if (dir === pathObject.root) return dir + base; - return dir + sep + base; -} diff --git a/crates/swc_bundler/tests/.cache/deno/24e74201c3948a0287228cb2a6c3c421a5caba31.ts b/crates/swc_bundler/tests/.cache/deno/24e74201c3948a0287228cb2a6c3c421a5caba31.ts deleted file mode 100644 index 6972f43f9cd2..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/24e74201c3948a0287228cb2a6c3c421a5caba31.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/channels/update_stage_instance.ts - - -import { rest } from "../../rest/rest.ts"; -import { Errors } from "../../types/discordeno/errors.ts"; -import type { StageInstance } from "../../types/channels/stage_instance.ts"; -import { endpoints } from "../../util/constants.ts"; -import { validateLength } from "../../util/validate_length.ts"; -import { cacheHandlers } from "../../cache.ts"; -import { requireBotChannelPermissions } from "../../util/permissions.ts"; -import { ChannelTypes } from "../../types/channels/channel_types.ts"; -import { snakelize } from "../../util/utils.ts"; - -/** Updates fields of an existing Stage instance. Requires the user to be a moderator of the Stage channel. */ -export async function updateStageInstance( - channelId: bigint, - data: Partial> = {} -) { - const channel = await cacheHandlers.get("channels", channelId); - - if (channel) { - if (channel.type !== ChannelTypes.GuildStageVoice) { - throw new Error(Errors.CHANNEL_NOT_STAGE_VOICE); - } - - await requireBotChannelPermissions(channel, ["MOVE_MEMBERS", "MUTE_MEMBERS", "MANAGE_CHANNELS"]); - } - - if ( - data?.topic && - !validateLength(data.topic, { - min: 1, - max: 120, - }) - ) { - throw new Error(Errors.INVALID_TOPIC_LENGTH); - } - - return await rest.runMethod("patch", endpoints.STAGE_INSTANCE(channelId), snakelize(data)); -} diff --git a/crates/swc_bundler/tests/.cache/deno/250a6730c15c7e1d94d5c0115a67ef935b7fde54.ts b/crates/swc_bundler/tests/.cache/deno/250a6730c15c7e1d94d5c0115a67ef935b7fde54.ts deleted file mode 100644 index 694ff66bcce2..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/250a6730c15c7e1d94d5c0115a67ef935b7fde54.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/channels/threads/thread_list_sync.ts - - -import { Channel } from "../channel.ts"; -import { ThreadMember } from "./thread_member.ts"; - -// TODO: add docs link -export interface ThreadListSync { - /** The id of the guild */ - guildId: string; - /** The parent channel ids whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channelIds that have no active threads as well, so you know to clear that data */ - channelIds?: string[]; - // TODO: check if need to omit - /** All active threads in the given channels that the current user can access */ - threads: Channel[]; - /** All thread member objects from the synced threads for the current user, indicating which threads the current user has been added to */ - members: ThreadMember[]; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2515a04cfb871afc51045e85a6b10d3247354723.ts b/crates/swc_bundler/tests/.cache/deno/2515a04cfb871afc51045e85a6b10d3247354723.ts deleted file mode 100644 index 73b6ee6af367..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2515a04cfb871afc51045e85a6b10d3247354723.ts +++ /dev/null @@ -1,324 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/util/permissions.ts - - -import { botId } from "../bot.ts"; -import { cacheHandlers } from "../cache.ts"; -import { DiscordenoChannel } from "../structures/channel.ts"; -import { DiscordenoGuild } from "../structures/guild.ts"; -import { DiscordenoMember } from "../structures/member.ts"; -import { DiscordenoRole } from "../structures/role.ts"; -import { Overwrite } from "../types/channels/overwrite.ts"; -import { Errors } from "../types/discordeno/errors.ts"; -import { DiscordBitwisePermissionFlags } from "../types/permissions/bitwise_permission_flags.ts"; -import type { PermissionStrings } from "../types/permissions/permission_strings.ts"; - -async function getCached(table: "guilds", key: bigint | DiscordenoGuild): Promise; -async function getCached(table: "channels", key: bigint | DiscordenoChannel): Promise; -async function getCached(table: "members", key: bigint | DiscordenoMember): Promise; -async function getCached( - table: "guilds" | "channels" | "members", - key: bigint | DiscordenoGuild | DiscordenoChannel | DiscordenoMember -) { - const cached = - typeof key === "bigint" - ? // @ts-ignore TS is wrong here - await cacheHandlers.get(table, key) - : key; - - return typeof cached === "bigint" ? undefined : cached; -} - -/** Calculates the permissions this member has in the given guild */ -export async function calculateBasePermissions( - guildOrId: bigint | DiscordenoGuild, - memberOrId: bigint | DiscordenoMember -) { - const guild = await getCached("guilds", guildOrId); - const member = await getCached("members", memberOrId); - - if (!guild || !member) return "8"; - - let permissions = 0n; - // Calculate the role permissions bits, @everyone role is not in memberRoleIds so we need to pass guildId manualy - permissions |= [...(member.guilds.get(guild.id)?.roles || []), guild.id] - .map((id) => guild.roles.get(id)?.permissions) - // Removes any edge case undefined - .filter((perm) => perm) - .reduce((bits, perms) => { - bits |= BigInt(perms); - return bits; - }, 0n); - - // If the memberId is equal to the guild ownerId he automatically has every permission so we add ADMINISTRATOR permission - if (guild.ownerId === member.id) permissions |= 8n; - // Return the members permission bits as a string - return permissions.toString(); -} - -/** Calculates the permissions this member has for the given Channel */ -export async function calculateChannelOverwrites( - channelOrId: bigint | DiscordenoChannel, - memberOrId: bigint | DiscordenoMember -) { - const channel = await getCached("channels", channelOrId); - - // This is a DM channel so return ADMINISTRATOR permission - if (!channel?.guildId) return "8"; - - const member = await getCached("members", memberOrId); - - if (!channel || !member) return "8"; - - // Get all the role permissions this member already has - let permissions = BigInt(await calculateBasePermissions(channel.guildId, member)); - - // First calculate @everyone overwrites since these have the lowest priority - const overwriteEveryone = channel.permissionOverwrites?.find((overwrite) => overwrite.id === channel.guildId); - if (overwriteEveryone) { - // First remove denied permissions since denied < allowed - permissions &= ~BigInt(overwriteEveryone.deny); - permissions |= BigInt(overwriteEveryone.allow); - } - - const overwrites = channel.permissionOverwrites; - - // In order to calculate the role permissions correctly we need to temporarily save the allowed and denied permissions - let allow = 0n; - let deny = 0n; - const memberRoles = member.guilds.get(channel.guildId)?.roles || []; - // Second calculate members role overwrites since these have middle priority - for (const overwrite of overwrites || []) { - if (!memberRoles.includes(overwrite.id)) continue; - - deny |= BigInt(overwrite.deny); - allow |= BigInt(overwrite.allow); - } - // After role overwrite calculate save allowed permissions first we remove denied permissions since "denied < allowed" - permissions &= ~deny; - permissions |= allow; - - // Third calculate member specific overwrites since these have the highest priority - const overwriteMember = overwrites?.find((overwrite) => overwrite.id === member.id); - if (overwriteMember) { - permissions &= ~BigInt(overwriteMember.deny); - permissions |= BigInt(overwriteMember.allow); - } - - return permissions.toString(); -} - -/** Checks if the given permission bits are matching the given permissions. `ADMINISTRATOR` always returns `true` */ -export function validatePermissions(permissionBits: string, permissions: PermissionStrings[]) { - if (BigInt(permissionBits) & 8n) return true; - - return permissions.every( - (permission) => - // Check if permission is in permissionBits - BigInt(permissionBits) & BigInt(DiscordBitwisePermissionFlags[permission]) - ); -} - -/** Checks if the given member has these permissions in the given guild */ -export async function hasGuildPermissions( - guild: bigint | DiscordenoGuild, - member: bigint | DiscordenoMember, - permissions: PermissionStrings[] -) { - // First we need the role permission bits this member has - const basePermissions = await calculateBasePermissions(guild, member); - // Second use the validatePermissions function to check if the member has every permission - return validatePermissions(basePermissions, permissions); -} - -/** Checks if the bot has these permissions in the given guild */ -export function botHasGuildPermissions(guild: bigint | DiscordenoGuild, permissions: PermissionStrings[]) { - // Since Bot is a normal member we can use the hasRolePermissions() function - return hasGuildPermissions(guild, botId, permissions); -} - -/** Checks if the given member has these permissions for the given channel */ -export async function hasChannelPermissions( - channel: bigint | DiscordenoChannel, - member: bigint | DiscordenoMember, - permissions: PermissionStrings[] -) { - // First we need the overwrite bits this member has - const channelOverwrites = await calculateChannelOverwrites(channel, member); - // Second use the validatePermissions function to check if the member has every permission - return validatePermissions(channelOverwrites, permissions); -} - -/** Checks if the bot has these permissions f0r the given channel */ -export function botHasChannelPermissions(channel: bigint | DiscordenoChannel, permissions: PermissionStrings[]) { - // Since Bot is a normal member we can use the hasRolePermissions() function - return hasChannelPermissions(channel, botId, permissions); -} - -/** Returns the permissions that are not in the given permissionBits */ -export function missingPermissions(permissionBits: string, permissions: PermissionStrings[]) { - if (BigInt(permissionBits) & 8n) return []; - - return permissions.filter( - (permission) => !(BigInt(permissionBits) & BigInt(DiscordBitwisePermissionFlags[permission])) - ); -} - -/** Get the missing Guild permissions this member has */ -export async function getMissingGuildPermissions( - guild: bigint | DiscordenoGuild, - member: bigint | DiscordenoMember, - permissions: PermissionStrings[] -) { - // First we need the role permission bits this member has - const permissionBits = await calculateBasePermissions(guild, member); - // Second return the members missing permissions - return missingPermissions(permissionBits, permissions); -} - -/** Get the missing Channel permissions this member has */ -export async function getMissingChannelPermissions( - channel: bigint | DiscordenoChannel, - member: bigint | DiscordenoMember, - permissions: PermissionStrings[] -) { - // First we need the role permissino bits this member has - const permissionBits = await calculateChannelOverwrites(channel, member); - // Second returnn the members missing permissions - return missingPermissions(permissionBits, permissions); -} - -/** Throws an error if this member has not all of the given permissions */ -export async function requireGuildPermissions( - guild: bigint | DiscordenoGuild, - member: bigint | DiscordenoMember, - permissions: PermissionStrings[] -) { - const missing = await getMissingGuildPermissions(guild, member, permissions); - if (missing.length) { - // If the member is missing a permission throw an Error - throw new Error(`Missing Permissions: ${missing.join(" & ")}`); - } -} - -/** Throws an error if the bot does not have all permissions */ -export function requireBotGuildPermissions(guild: bigint | DiscordenoGuild, permissions: PermissionStrings[]) { - // Since Bot is a normal member we can use the throwOnMissingGuildPermission() function - return requireGuildPermissions(guild, botId, permissions); -} - -/** Throws an error if this member has not all of the given permissions */ -export async function requireChannelPermissions( - channel: bigint | DiscordenoChannel, - member: bigint | DiscordenoMember, - permissions: PermissionStrings[] -) { - const missing = await getMissingChannelPermissions(channel, member, permissions); - if (missing.length) { - // If the member is missing a permission throw an Error - throw new Error(`Missing Permissions: ${missing.join(" & ")}`); - } -} - -/** Throws an error if the bot has not all of the given channel permissions */ -export function requireBotChannelPermissions(channel: bigint | DiscordenoChannel, permissions: PermissionStrings[]) { - // Since Bot is a normal member we can use the throwOnMissingChannelPermission() function - return requireChannelPermissions(channel, botId, permissions); -} - -/** This function converts a bitwise string to permission strings */ -export function calculatePermissions(permissionBits: string) { - return Object.keys(DiscordBitwisePermissionFlags).filter((permission) => { - // Since Object.keys() not only returns the permission names but also the bit values we need to return false if it is a Number - if (Number(permission)) return false; - // Check if permissionBits has this permission - return BigInt(permissionBits) & BigInt(DiscordBitwisePermissionFlags[permission as PermissionStrings]); - }) as PermissionStrings[]; -} - -/** This function converts an array of permissions into the bitwise string. */ -export function calculateBits(permissions: PermissionStrings[]) { - return permissions - .reduce((bits, perm) => { - bits |= BigInt(DiscordBitwisePermissionFlags[perm]); - return bits; - }, 0n) - .toString(); -} - -/** Internal function to check if the bot has the permissions to set these overwrites */ -export async function requireOverwritePermissions(guildOrId: bigint | DiscordenoGuild, overwrites: Overwrite[]) { - let requiredPerms: Set = new Set(["MANAGE_CHANNELS"]); - - overwrites?.forEach((overwrite) => { - overwrite.allow.forEach(requiredPerms.add, requiredPerms); - overwrite.deny.forEach(requiredPerms.add, requiredPerms); - }); - - // MANAGE_ROLES permission can only be set by administrators - if (requiredPerms.has("MANAGE_ROLES")) { - requiredPerms = new Set(["ADMINISTRATOR"]); - } - - await requireGuildPermissions(guildOrId, botId, [...requiredPerms]); -} - -/** Gets the highest role from the member in this guild */ -export async function highestRole(guildOrId: bigint | DiscordenoGuild, memberOrId: bigint | DiscordenoMember) { - const guild = await getCached("guilds", guildOrId); - - if (!guild) throw new Error(Errors.GUILD_NOT_FOUND); - - // Get the roles from the member - const memberRoles = (await getCached("members", memberOrId))?.guilds.get(guild.id)?.roles; - // This member has no roles so the highest one is the @everyone role - if (!memberRoles) return guild.roles.get(guild.id)!; - - let memberHighestRole: DiscordenoRole | undefined; - - for (const roleId of memberRoles) { - const role = guild.roles.get(roleId); - // Rare edge case handling if undefined - if (!role) continue; - - // If memberHighestRole is still undefined we want to assign the role, - // else we want to check if the current role position is higher than the current memberHighestRole - if ( - !memberHighestRole || - memberHighestRole.position < role.position || - memberHighestRole.position === role.position - ) { - memberHighestRole = role; - } - } - - // The member has at least one role so memberHighestRole must exist - return memberHighestRole!; -} - -/** Checks if the first role is higher than the second role */ -export async function higherRolePosition(guildOrId: bigint | DiscordenoGuild, roleId: bigint, otherRoleId: bigint) { - const guild = await getCached("guilds", guildOrId); - - if (!guild) return true; - - const role = guild.roles.get(roleId); - const otherRole = guild.roles.get(otherRoleId); - if (!role || !otherRole) throw new Error(Errors.ROLE_NOT_FOUND); - - // Rare edge case handling - if (role.position === otherRole.position) { - return role.id < otherRole.id; - } - - return role.position > otherRole.position; -} - -/** Checks if the member has a higher position than the given role */ -export async function isHigherPosition(guildOrId: bigint | DiscordenoGuild, memberId: bigint, compareRoleId: bigint) { - const guild = await getCached("guilds", guildOrId); - - if (!guild || guild.ownerId === memberId) return true; - - const memberHighestRole = await highestRole(guild, memberId); - return higherRolePosition(guild.id, memberHighestRole.id, compareRoleId); -} diff --git a/crates/swc_bundler/tests/.cache/deno/25191601e5fc11d54bc4340fc01f921f04b8eeff.ts b/crates/swc_bundler/tests/.cache/deno/25191601e5fc11d54bc4340fc01f921f04b8eeff.ts deleted file mode 100644 index e9905b25b11b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/25191601e5fc11d54bc4340fc01f921f04b8eeff.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/composeWith.js - - -import _curry2 from './internal/_curry2.js'; -import pipeWith from './pipeWith.js'; -import reverse from './reverse.js'; - - -/** - * Performs right-to-left function composition using transforming function. The last function may have - * any arity; the remaining functions must be unary. - * - * **Note:** The result of composeWith is not automatically curried. Transforming function is not used - * on the last argument. - * - * @func - * @memberOf R - * @since v0.26.0 - * @category Function - * @sig ((* -> *), [(y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)]) -> ((a, b, ..., n) -> z) - * @param {Function} transformer The transforming function - * @param {Array} functions The functions to compose - * @return {Function} - * @see R.compose, R.pipeWith - * @example - * - * const composeWhileNotNil = R.composeWith((f, res) => R.isNil(res) ? res : f(res)); - * - * composeWhileNotNil([R.inc, R.prop('age')])({age: 1}) //=> 2 - * composeWhileNotNil([R.inc, R.prop('age')])({}) //=> undefined - * - * @symb R.composeWith(f)([g, h, i])(...args) = f(g, f(h, i(...args))) - */ -var composeWith = _curry2(function composeWith(xf, list) { - return pipeWith.apply(this, [xf, reverse(list)]); -}); -export default composeWith; diff --git a/crates/swc_bundler/tests/.cache/deno/253fbaf75096c30a50e76b998acd4d4a19101a94.ts b/crates/swc_bundler/tests/.cache/deno/253fbaf75096c30a50e76b998acd4d4a19101a94.ts deleted file mode 100644 index a7aeb9cea993..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/253fbaf75096c30a50e76b998acd4d4a19101a94.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/std@0.80.0/encoding/_yaml/type/mod.ts - - -// Ported from js-yaml v3.13.1: -// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da -// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -export { binary } from "./binary.ts"; -export { bool } from "./bool.ts"; -export { float } from "./float.ts"; -export { int } from "./int.ts"; -export { map } from "./map.ts"; -export { merge } from "./merge.ts"; -export { nil } from "./nil.ts"; -export { omap } from "./omap.ts"; -export { pairs } from "./pairs.ts"; -export { seq } from "./seq.ts"; -export { set } from "./set.ts"; -export { str } from "./str.ts"; -export { timestamp } from "./timestamp.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/254cb219f9b8bf4d4bd27151b9c6b9451f5aa485.ts b/crates/swc_bundler/tests/.cache/deno/254cb219f9b8bf4d4bd27151b9c6b9451f5aa485.ts deleted file mode 100644 index 28abf790a2b5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/254cb219f9b8bf4d4bd27151b9c6b9451f5aa485.ts +++ /dev/null @@ -1,303 +0,0 @@ -// Loaded from https://deno.land/x/oak/response.ts - - -// Copyright 2018-2021 the oak authors. All rights reserved. MIT license. - -import { AsyncIterableReader } from "./async_iterable_reader.ts"; -import { contentType, Status } from "./deps.ts"; -import type { Request } from "./request.ts"; -import type { ServerResponse } from "./types.d.ts"; -import { encodeUrl, isHtml, isRedirectStatus } from "./util.ts"; - -type Body = - | string - | number - | bigint - | boolean - | symbol - // deno-lint-ignore ban-types - | object - | undefined - | null; -type BodyFunction = () => Body | Promise; - -/** A symbol that indicates to `response.redirect()` to attempt to redirect - * back to the request referrer. For example: - * - * ```ts - * import { Application, REDIRECT_BACK } from "https://deno.land/x/oak/mod.ts"; - * - * const app = new Application(); - * - * app.use((ctx) => { - * if (ctx.request.url.pathName === "/back") { - * ctx.response.redirect(REDIRECT_BACK, "/"); - * } - * }); - * - * await app.listen({ port: 80 }); - * ``` - */ -export const REDIRECT_BACK = Symbol("redirect backwards"); - -const BODY_TYPES = ["string", "number", "bigint", "boolean", "symbol"]; - -const encoder = new TextEncoder(); - -/** Guard for Async Iterables */ -// deno-lint-ignore no-explicit-any -function isAsyncIterable(value: unknown): value is AsyncIterable { - return typeof value === "object" && value !== null && - Symbol.asyncIterator in value && - // deno-lint-ignore no-explicit-any - typeof (value as any)[Symbol.asyncIterator] === "function"; -} - -/** Guard for `Deno.Reader`. */ -function isReader(value: unknown): value is Deno.Reader { - return typeof value === "object" && value !== null && "read" in value && - typeof (value as Record).read === "function"; -} - -function toUint8Array(body: Body): Uint8Array { - let bodyText: string; - if (BODY_TYPES.includes(typeof body)) { - bodyText = String(body); - } else { - bodyText = JSON.stringify(body); - } - return encoder.encode(bodyText); -} - -async function convertBody( - body: Body | BodyFunction, - type?: string, -): Promise<[Uint8Array | Deno.Reader | undefined, string | undefined]> { - let result: Uint8Array | Deno.Reader | undefined; - if (BODY_TYPES.includes(typeof body)) { - const bodyText = String(body); - result = encoder.encode(bodyText); - type = type ?? (isHtml(bodyText) ? "html" : "text/plain"); - } else if (body instanceof Uint8Array || isReader(body)) { - result = body; - } else if (isAsyncIterable(body)) { - result = new AsyncIterableReader(body, toUint8Array); - } else if (body && typeof body === "object") { - result = encoder.encode(JSON.stringify(body)); - type = type ?? "json"; - } else if (typeof body === "function") { - const result = body.call(null); - return convertBody(await result, type); - } else if (body) { - throw new TypeError("Response body was set but could not convert."); - } - return [result, type]; -} - -/** An interface to control what response will be sent when the middleware - * finishes processing the request. */ -export class Response { - #body?: Body | BodyFunction; - #headers = new Headers(); - #request: Request; - #resources: number[] = []; - #serverResponse?: ServerResponse; - #status?: Status; - #type?: string; - #writable = true; - - #getBody = async (): Promise => { - const [body, type] = await convertBody(this.body, this.type); - this.type = type; - return body; - }; - - #setContentType = (): void => { - if (this.type) { - const contentTypeString = contentType(this.type); - if (contentTypeString && !this.headers.has("Content-Type")) { - this.headers.append("Content-Type", contentTypeString); - } - } - }; - - /** The body of the response. The body will be automatically processed when - * the response is being sent and converted to a `Uint8Array` or a - * `Deno.Reader`. - * - * Automatic conversion to a `Deno.Reader` occurs for async iterables. */ - get body(): Body | BodyFunction { - return this.#body; - } - - /** The body of the response. The body will be automatically processed when - * the response is being sent and converted to a `Uint8Array` or a - * `Deno.Reader`. - * - * Automatic conversion to a `Deno.Reader` occurs for async iterables. */ - set body(value: Body | BodyFunction) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#body = value; - } - - /** Headers that will be returned in the response. */ - get headers(): Headers { - return this.#headers; - } - - /** Headers that will be returned in the response. */ - set headers(value: Headers) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#headers = value; - } - - /** The HTTP status of the response. If this has not been explicitly set, - * reading the value will return what would be the value of status if the - * response were sent at this point in processing the middleware. If the body - * has been set, the status will be `200 OK`. If a value for the body has - * not been set yet, the status will be `404 Not Found`. */ - get status(): Status { - if (this.#status) { - return this.#status; - } - const typeofbody = typeof this.body; - return this.body && - (BODY_TYPES.includes(typeofbody) || typeofbody === "object") - ? Status.OK - : Status.NotFound; - } - - /** The HTTP status of the response. If this has not been explicitly set, - * reading the value will return what would be the value of status if the - * response were sent at this point in processing the middleware. If the body - * has been set, the status will be `200 OK`. If a value for the body has - * not been set yet, the status will be `404 Not Found`. */ - set status(value: Status) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#status = value; - } - - /** The media type, or extension of the response. Setting this value will - * ensure an appropriate `Content-Type` header is added to the response. */ - get type(): string | undefined { - return this.#type; - } - /** The media type, or extension of the response. Setting this value will - * ensure an appropriate `Content-Type` header is added to the response. */ - set type(value: string | undefined) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#type = value; - } - - /** A read-only property which determines if the response is writable or not. - * Once the response has been processed, this value is set to `false`. */ - get writable(): boolean { - return this.#writable; - } - - constructor(request: Request) { - this.#request = request; - } - - /** Add a resource to the list of resources that will be closed when the - * request is destroyed. */ - addResource(rid: number): void { - this.#resources.push(rid); - } - - /** Release any resources that are being tracked by the response. */ - destroy(): void { - this.#writable = false; - this.#body = undefined; - this.#serverResponse = undefined; - for (const rid of this.#resources) { - Deno.close(rid); - } - } - - /** Sets the response to redirect to the supplied `url`. - * - * If the `.status` is not currently a redirect status, the status will be set - * to `302 Found`. - * - * The body will be set to a message indicating the redirection is occurring. - */ - redirect(url: string | URL): void; - /** Sets the response to redirect back to the referrer if available, with an - * optional `alt` URL if there is no referrer header on the request. If there - * is no referrer header, nor an `alt` parameter, the redirect is set to `/`. - * - * If the `.status` is not currently a redirect status, the status will be set - * to `302 Found`. - * - * The body will be set to a message indicating the redirection is occurring. - */ - redirect(url: typeof REDIRECT_BACK, alt?: string | URL): void; - redirect( - url: string | URL | typeof REDIRECT_BACK, - alt: string | URL = "/", - ): void { - if (url === REDIRECT_BACK) { - url = this.#request.headers.get("Referrer") ?? String(alt); - } else if (typeof url === "object") { - url = String(url); - } - this.headers.set("Location", encodeUrl(url)); - if (!this.status || !isRedirectStatus(this.status)) { - this.status = Status.Found; - } - - if (this.#request.accepts("html")) { - url = encodeURI(url); - this.type = "text/html; charset=utf-8"; - this.body = `Redirecting to ${url}.`; - return; - } - this.type = "text/plain; charset=utf-8"; - this.body = `Redirecting to ${url}.`; - } - - /** Take this response and convert it to the response used by the Deno net - * server. Calling this will set the response to not be writable. - * - * Most users will have no need to call this method. */ - async toServerResponse(): Promise { - if (this.#serverResponse) { - return this.#serverResponse; - } - // Process the body - const body = await this.#getBody(); - - // If there is a response type, set the content type header - this.#setContentType(); - - const { headers } = this; - - // If there is no body and no content type and no set length, then set the - // content length to 0 - if ( - !( - body || - headers.has("Content-Type") || - headers.has("Content-Length") - ) - ) { - headers.append("Content-Length", "0"); - } - - this.#writable = false; - return this.#serverResponse = { - status: this.#status ?? (body ? Status.OK : Status.NotFound), - body, - headers, - }; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/25ae65fc43783464c3514ac80a82a7c2b7e7b259.ts b/crates/swc_bundler/tests/.cache/deno/25ae65fc43783464c3514ac80a82a7c2b7e7b259.ts deleted file mode 100644 index d3b6efbfa657..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/25ae65fc43783464c3514ac80a82a7c2b7e7b259.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/identical.js - - -import _objectIs from './internal/_objectIs.js'; -import _curry2 from './internal/_curry2.js'; - - -/** - * Returns true if its arguments are identical, false otherwise. Values are - * identical if they reference the same memory. `NaN` is identical to `NaN`; - * `0` and `-0` are not identical. - * - * Note this is merely a curried version of ES6 `Object.is`. - * - * @func - * @memberOf R - * @since v0.15.0 - * @category Relation - * @sig a -> a -> Boolean - * @param {*} a - * @param {*} b - * @return {Boolean} - * @example - * - * const o = {}; - * R.identical(o, o); //=> true - * R.identical(1, 1); //=> true - * R.identical(1, '1'); //=> false - * R.identical([], []); //=> false - * R.identical(0, -0); //=> false - * R.identical(NaN, NaN); //=> true - */ -var identical = _curry2(_objectIs); -export default identical; diff --git a/crates/swc_bundler/tests/.cache/deno/25ba836406baf9db5b2076a960708a6a62d92933.ts b/crates/swc_bundler/tests/.cache/deno/25ba836406baf9db5b2076a960708a6a62d92933.ts deleted file mode 100644 index 18d5b91cf967..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/25ba836406baf9db5b2076a960708a6a62d92933.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/ws/send_shard_message.ts - - -import { DiscordenoShard, WebSocketRequest, ws } from "./ws.ts"; - -export function sendShardMessage(shard: number | DiscordenoShard, message: WebSocketRequest, highPriority = false) { - if (typeof shard === "number") shard = ws.shards.get(shard)!; - if (!shard) return; - - if (!highPriority) { - shard.queue.push(message); - } else { - shard.queue.unshift(message); - } - - ws.processQueue(shard.id); -} diff --git a/crates/swc_bundler/tests/.cache/deno/25fdad3e38f78ead83d999722d4e4bb25a8c59e4.ts b/crates/swc_bundler/tests/.cache/deno/25fdad3e38f78ead83d999722d4e4bb25a8c59e4.ts deleted file mode 100644 index e9620a53f7f5..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/25fdad3e38f78ead83d999722d4e4bb25a8c59e4.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/webhooks/webhook.ts - - -import { Channel } from "../channels/channel.ts"; -import { Guild } from "../guilds/guild.ts"; -import { User } from "../users/user.ts"; -import { DiscordWebhookTypes } from "./discord_webhook_types.ts"; - -/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */ -export type Webhook = IncomingWebhook | ApplicationWebhook; - -export interface IncomingWebhook { - /** The id of the webhook */ - id: string; - /** The type of the webhook */ - type: DiscordWebhookTypes; - /** The guild id this webhook is for */ - guildId?: string; - /** The channel id this webhook is for */ - channelId: string; - /** The user this webhook was created by (not returned when getting a webhook with its token) */ - user?: User; - /** The default name of the webhook */ - name: string | null; - /** The default user avatar hash of the webhook */ - avatar: string | null; - /** The secure token of the webhook (returned for Incomming Webhooks) */ - token?: string; - /** The bot/OAuth2 application that created this webhook */ - applicationId: string | null; - /** The guild of the channel that this webhook is following (returned for Channel Follower Webhooks) */ - sourceGuild?: Partial; - /** The channel that this webhook is following (returned for Channel Follower Webhooks) */ - sourceChannel?: Partial; - /** The url used for executing the webhook (returned by the webhooks OAuth2 flow) */ - url?: string; -} - -export interface ApplicationWebhook extends Omit { - type: DiscordWebhookTypes.Application; - guildId?: string | null; - channelId?: string | null; -} diff --git a/crates/swc_bundler/tests/.cache/deno/26011cfcdccf2c97ce392f5122ffdf185e7c86c6.ts b/crates/swc_bundler/tests/.cache/deno/26011cfcdccf2c97ce392f5122ffdf185e7c86c6.ts deleted file mode 100644 index dee987490d3a..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/26011cfcdccf2c97ce392f5122ffdf185e7c86c6.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Loaded from https://deno.land/x/mysql/src/util.ts - - -export function xor(a: Uint8Array, b: Uint8Array): Uint8Array { - return a.map((byte, index) => { - return byte ^ b[index]; - }); -} diff --git a/crates/swc_bundler/tests/.cache/deno/2611e46d39df5923363309b9adb4c81731694129.ts b/crates/swc_bundler/tests/.cache/deno/2611e46d39df5923363309b9adb4c81731694129.ts deleted file mode 100644 index 4e1aff851403..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2611e46d39df5923363309b9adb4c81731694129.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Loaded from https://deno.land/std@0.81.0/_util/os.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -export const osType = (() => { - if (globalThis.Deno != null) { - return Deno.build.os; - } - - // deno-lint-ignore no-explicit-any - const navigator = (globalThis as any).navigator; - if (navigator?.appVersion?.includes?.("Win") ?? false) { - return "windows"; - } - - return "linux"; -})(); - -export const isWindows = osType === "windows"; diff --git a/crates/swc_bundler/tests/.cache/deno/26229dc3fa7de5f57e16c6d1cf5aa281c6692c78.ts b/crates/swc_bundler/tests/.cache/deno/26229dc3fa7de5f57e16c6d1cf5aa281c6692c78.ts deleted file mode 100644 index 6a778a94fdec..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/26229dc3fa7de5f57e16c6d1cf5aa281c6692c78.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isDivisibleBy.ts - - -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; -// @ts-ignore allowing typedoc to build -import { toFloat } from '../helpers/toFloat.ts'; - -export const isDivisibleBy = (str: string, num: string) => { - assertString(str); - - return toFloat(str) % parseInt(num, 10) === 0; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/264c6f8a074a064dbf16fe3f4c24d50065a9611e.ts b/crates/swc_bundler/tests/.cache/deno/264c6f8a074a064dbf16fe3f4c24d50065a9611e.ts deleted file mode 100644 index 0da5e24c65ff..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/264c6f8a074a064dbf16fe3f4c24d50065a9611e.ts +++ /dev/null @@ -1,60 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/internal/_indexOf.js - - -import equals from '../equals.js'; - - -export default function _indexOf(list, a, idx) { - var inf, item; - // Array.prototype.indexOf doesn't exist below IE9 - if (typeof list.indexOf === 'function') { - switch (typeof a) { - case 'number': - if (a === 0) { - // manually crawl the list to distinguish between +0 and -0 - inf = 1 / a; - while (idx < list.length) { - item = list[idx]; - if (item === 0 && 1 / item === inf) { - return idx; - } - idx += 1; - } - return -1; - } else if (a !== a) { - // NaN - while (idx < list.length) { - item = list[idx]; - if (typeof item === 'number' && item !== item) { - return idx; - } - idx += 1; - } - return -1; - } - // non-zero numbers can utilise Set - return list.indexOf(a, idx); - - // all these types can utilise Set - case 'string': - case 'boolean': - case 'function': - case 'undefined': - return list.indexOf(a, idx); - - case 'object': - if (a === null) { - // null can utilise Set - return list.indexOf(a, idx); - } - } - } - // anything else not covered above, defer to R.equals - while (idx < list.length) { - if (equals(list[idx], a)) { - return idx; - } - idx += 1; - } - return -1; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2661a946a5032d7f962249e461492beeaf3d511f.ts b/crates/swc_bundler/tests/.cache/deno/2661a946a5032d7f962249e461492beeaf3d511f.ts deleted file mode 100644 index 78c5b9d11cf9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2661a946a5032d7f962249e461492beeaf3d511f.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isSemVer.ts - - -// @ts-ignore allowing typedoc to build -import { multilineRegexp } from '../helpers/multilineRegex.ts'; -// @ts-ignore allowing typedoc to build -import { assertString } from '../helpers/assertString.ts'; - -/** - * Regular Expression to match - * semantic versioning (SemVer) - * built from multi-line, multi-parts regexp - * Reference: https://semver.org/ - */ -/** - * @ignore - */ -const semanticVersioningRegex = multilineRegexp([ - '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', - '(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))', - '?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$', -]); - -export const isSemVer = (str: string) => { - assertString(str); - - return semanticVersioningRegex.test(str); -}; diff --git a/crates/swc_bundler/tests/.cache/deno/267696912a4da95cd9837b87c73e1f24e1c55ca0.ts b/crates/swc_bundler/tests/.cache/deno/267696912a4da95cd9837b87c73e1f24e1c55ca0.ts deleted file mode 100644 index 5ba69a783767..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/267696912a4da95cd9837b87c73e1f24e1c55ca0.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/discovery/valid_discovery_term.ts - - -import { rest } from "../../rest/rest.ts"; -import type { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts"; -import { endpoints } from "../../util/constants.ts"; - -export async function validDiscoveryTerm(term: string) { - const result = await rest.runMethod("get", endpoints.DISCOVERY_VALID_TERM, { term }); - - return result.valid; -} diff --git a/crates/swc_bundler/tests/.cache/deno/26b8c843f930aaf5bbb72a9d59265db102137c78.ts b/crates/swc_bundler/tests/.cache/deno/26b8c843f930aaf5bbb72a9d59265db102137c78.ts deleted file mode 100644 index 9082b874b144..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/26b8c843f930aaf5bbb72a9d59265db102137c78.ts +++ /dev/null @@ -1,1561 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/zlib/zlib/inflate.ts - - -import adler32 from "./adler32.ts"; -import { crc32 } from "./crc32.ts"; -import inflate_fast from "./inffast.ts"; -import inflate_table from "./inftrees.ts"; -import type ZStream from "./zstream.ts"; - -const CODES = 0; -const LENS = 1; -const DISTS = 2; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - -/* Allowed flush values; see deflate() and inflate() below for details */ -//const Z_NO_FLUSH = 0; -//const Z_PARTIAL_FLUSH = 1; -//const Z_SYNC_FLUSH = 2; -//const Z_FULL_FLUSH = 3; -const Z_FINISH = 4; -const Z_BLOCK = 5; -const Z_TREES = 6; - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -const Z_OK = 0; -const Z_STREAM_END = 1; -const Z_NEED_DICT = 2; -//const Z_ERRNO = -1; -const Z_STREAM_ERROR = -2; -const Z_DATA_ERROR = -3; -const Z_MEM_ERROR = -4; -const Z_BUF_ERROR = -5; -//const Z_VERSION_ERROR = -6; - -/* The deflate compression method */ -const Z_DEFLATED = 8; - -/* STATES ====================================================================*/ -/* ===========================================================================*/ - -const HEAD = 1; /* i: waiting for magic header */ -const FLAGS = 2; /* i: waiting for method and flags (gzip) */ -const TIME = 3; /* i: waiting for modification time (gzip) */ -const OS = 4; /* i: waiting for extra flags and operating system (gzip) */ -const EXLEN = 5; /* i: waiting for extra length (gzip) */ -const EXTRA = 6; /* i: waiting for extra bytes (gzip) */ -const NAME = 7; /* i: waiting for end of file name (gzip) */ -const COMMENT = 8; /* i: waiting for end of comment (gzip) */ -const HCRC = 9; /* i: waiting for header crc (gzip) */ -const DICTID = 10; /* i: waiting for dictionary check value */ -const DICT = 11; /* waiting for inflateSetDictionary() call */ -const TYPE = 12; /* i: waiting for type bits, including last-flag bit */ -const TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ -const STORED = 14; /* i: waiting for stored size (length and complement) */ -const COPY_ = 15; /* i/o: same as COPY below, but only first time in */ -const COPY = 16; /* i/o: waiting for input or output to copy stored block */ -const TABLE = 17; /* i: waiting for dynamic block table lengths */ -const LENLENS = 18; /* i: waiting for code length code lengths */ -const CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ -const LEN_ = 20; /* i: same as LEN below, but only first time in */ -const LEN = 21; /* i: waiting for length/lit/eob code */ -const LENEXT = 22; /* i: waiting for length extra bits */ -const DIST = 23; /* i: waiting for distance code */ -const DISTEXT = 24; /* i: waiting for distance extra bits */ -const MATCH = 25; /* o: waiting for output space to copy string */ -const LIT = 26; /* o: waiting for output space to write literal */ -const CHECK = 27; /* i: waiting for 32-bit check value */ -const LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ -const DONE = 29; /* finished check, done -- remain here until reset */ -const BAD = 30; /* got a data error -- remain here until reset */ -const MEM = 31; /* got an inflate() memory error -- remain here until reset */ -const SYNC = 32; /* looking for synchronization bytes to restart inflate() */ - -/* ===========================================================================*/ - -const ENOUGH_LENS = 852; -const ENOUGH_DISTS = 592; -//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -const MAX_WBITS = 15; -/* 32K LZ77 window */ -const DEF_WBITS = MAX_WBITS; - -function zswap32(q: number) { - return (((q >>> 24) & 0xff) + - ((q >>> 8) & 0xff00) + - ((q & 0xff00) << 8) + - ((q & 0xff) << 24)); -} - -export class InflateState { - mode = 0; /* current inflate mode */ - last = false; /* true if processing last block */ - wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - havedict = false; /* true if dictionary provided */ - flags = 0; /* gzip header method and flags (0 if zlib) */ - dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ - check = 0; /* protected copy of check value */ - total = 0; /* protected copy of output count */ - // TODO: may be {} - head = null; /* where to save gzip header information */ - - /* sliding window */ - wbits = 0; /* log base 2 of requested window size */ - wsize = 0; /* window size or zero if not using window */ - whave = 0; /* valid bytes in the window */ - wnext = 0; /* window write index */ - window = null; /* allocated sliding window, if needed */ - - /* bit accumulator */ - hold = 0; /* input bit accumulator */ - bits = 0; /* number of bits in "in" */ - - /* for string and stored block copying */ - length = 0; /* literal or length of data to copy */ - offset = 0; /* distance back to copy string from */ - - /* for table and code decoding */ - extra = 0; /* extra bits needed */ - - /* fixed and dynamic code tables */ - lencode = null; /* starting table for length/literal codes */ - distcode = null; /* starting table for distance codes */ - lenbits = 0; /* index bits for lencode */ - distbits = 0; /* index bits for distcode */ - - /* dynamic table building */ - ncode = 0; /* number of code length code lengths */ - nlen = 0; /* number of length code lengths */ - ndist = 0; /* number of distance code lengths */ - have = 0; /* number of code lengths in lens[] */ - next = null; /* next available space in codes[] */ - - lens = new Uint16Array(320); /* temporary storage for code lengths */ - work = new Uint16Array(288); /* work area for code table building */ - - /* - because we don't have pointers in js, we use lencode and distcode directly - as buffers so we don't need codes - */ - //codes = new Uint32Array(ENOUGH); /* space for code tables */ - lendyn = null; /* dynamic table for length/literal codes (JS specific) */ - distdyn = null; /* dynamic table for distance codes (JS specific) */ - sane = 0; /* if false, allow invalid distance too far */ - back = 0; /* bits back of last unprocessed length/lit */ - was = 0; /* initial length of match */ -} - -export function inflateResetKeep(strm: ZStream) { - let state; - - if (!strm || !strm.state) return Z_STREAM_ERROR; - state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ""; /*Z_NULL*/ - if (state.wrap) { - /* to support ill-conceived Java test suite */ - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.dmax = 32768; - state.head = null /*Z_NULL*/; - state.hold = 0; - state.bits = 0; - //state.lencode = state.distcode = state.next = state.codes; - state.lencode = state.lendyn = new Uint32Array(ENOUGH_LENS); - state.distcode = state.distdyn = new Uint32Array(ENOUGH_DISTS); - - state.sane = 1; - state.back = -1; - //Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -export function inflateReset(strm: ZStream) { - let state; - - if (!strm || !strm.state) return Z_STREAM_ERROR; - state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); -} - -export function inflateReset2(strm: any, windowBits: any) { - let wrap; - let state; - - /* get the state */ - if (!strm || !strm.state) return Z_STREAM_ERROR; - state = strm.state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else { - wrap = (windowBits >> 4) + 1; - if (windowBits < 48) { - windowBits &= 15; - } - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - - /* update state and reset the rest of it */ - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); -} - -export function inflateInit2(strm: ZStream, windowBits: any) { - let ret; - let state; - - if (!strm) return Z_STREAM_ERROR; - //strm.msg = Z_NULL; /* in case we return an error */ - - state = new InflateState(); - - //if (state === Z_NULL) return Z_MEM_ERROR; - //Tracev((stderr, "inflate: allocated\n")); - strm.state = state; - state.window = null /*Z_NULL*/; - ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null /*Z_NULL*/; - } - return ret; -} - -export function inflateInit(strm: ZStream) { - return inflateInit2(strm, DEF_WBITS); -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -let virgin = true; - -let lenfix: any, distfix: any; // We have no pointers in JS, so keep tables separate - -function fixedtables(state: any) { - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - let sym; - - lenfix = new Uint32Array(512); - distfix = new Uint32Array(32); - - /* literal/length table */ - sym = 0; - while (sym < 144) state.lens[sym++] = 8; - while (sym < 256) state.lens[sym++] = 9; - while (sym < 280) state.lens[sym++] = 7; - while (sym < 288) state.lens[sym++] = 8; - - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - - /* distance table */ - sym = 0; - while (sym < 32) state.lens[sym++] = 5; - - inflate_table( - DISTS, - state.lens, - 0, - 32, - distfix, - 0, - state.work, - { bits: 5 }, - ); - - /* do this just once */ - virgin = false; - } - - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; -} - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -function updatewindow(strm: ZStream, src: any, end: any, copy: any) { - let dist; - let state = strm.state; - - /* if it hasn't been done already, allocate space for the window */ - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - - state.window = new Uint8Array(state.wsize); - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state.wsize) { - state.window.set(src.subarray(end - state.wsize, end), 0); - state.wnext = 0; - state.whave = state.wsize; - } else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - //zmemcpy(state->window + state->wnext, end - copy, dist); - state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext); - copy -= dist; - if (copy) { - //zmemcpy(state->window, end - copy, copy); - state.window.set(src.subarray(end - copy, end), 0); - state.wnext = copy; - state.whave = state.wsize; - } else { - state.wnext += dist; - if (state.wnext === state.wsize) state.wnext = 0; - if (state.whave < state.wsize) state.whave += dist; - } - } - return 0; -} - -export function inflate(strm: ZStream, flush: any) { - let state; - let input: Uint8Array, output: Uint8Array; // input/output buffers - let next; /* next input INDEX */ - let put; /* next output INDEX */ - let have, left; /* available input and output */ - let hold; /* bit buffer */ - let bits; /* bits in bit buffer */ - let _in, _out; /* save starting available input and output */ - let copy; /* number of stored or match bytes to copy */ - let from; /* where to copy match bytes from */ - let from_source; - let here = 0; /* current decoding table entry */ - let here_bits, here_op, here_val; // paked "here" denormalized (JS specific) - //let last; /* parent table entry */ - let last_bits, last_op, last_val; // paked "last" denormalized (JS specific) - let len; /* length to copy for repeats, bits to drop */ - let ret; /* return code */ - let hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */ - let opts; - - let n; // temporary let for NEED_BITS - - let order = /* permutation of code lengths */ - [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; - - if ( - !strm || !strm.state || !strm.output || - (!strm.input && strm.avail_in !== 0) - ) { - return Z_STREAM_ERROR; - } - - state = strm.state; - if (state.mode === TYPE) state.mode = TYPEDO; /* skip check */ - - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input as Uint8Array; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - _in = have; - _out = left; - ret = Z_OK; - - inf_leave: - // goto emulation - for (;;) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - //=== NEEDBITS(16); - while (bits < 16) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((state.wrap & 2) && hold === 0x8b1f) { - /* gzip header */ - state.check = 0 /*crc32(0L, Z_NULL, 0)*/; - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = FLAGS; - break; - } - state.flags = 0; /* expect zlib header */ - if (state.head) { - state.head.done = false; - } - if ( - !(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 0xff) /*BITS(8)*/ << 8) + (hold >> 8)) % 31 - ) { - strm.msg = "incorrect header check"; - state.mode = BAD; - break; - } - if ((hold & 0x0f) /*BITS(4)*/ !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - len = (hold & 0x0f) /*BITS(4)*/ + 8; - if (state.wbits === 0) { - state.wbits = len; - } else if (len > state.wbits) { - strm.msg = "invalid window size"; - state.mode = BAD; - break; - } - state.dmax = 1 << len; - //Tracev((stderr, "inflate: zlib header ok\n")); - strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/; - state.mode = hold & 0x200 ? DICTID : TYPE; - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - break; - case FLAGS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.flags = hold; - if ((state.flags & 0xff) !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - if (state.flags & 0xe000) { - strm.msg = "unknown header flags set"; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = ((hold >> 8) & 1); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = TIME; - /* falls through */ - case TIME: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.time = hold; - } - if (state.flags & 0x0200) { - //=== CRC4(state.check, hold) - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - hbuf[2] = (hold >>> 16) & 0xff; - hbuf[3] = (hold >>> 24) & 0xff; - state.check = crc32(state.check, hbuf, 4, 0); - //=== - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = OS; - /* falls through */ - case OS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.xflags = (hold & 0xff); - state.head.os = (hold >> 8); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = EXLEN; - /* falls through */ - case EXLEN: - if (state.flags & 0x0400) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } else if (state.head) { - state.head.extra = null /*Z_NULL*/; - } - state.mode = EXTRA; - /* falls through */ - case EXTRA: - if (state.flags & 0x0400) { - copy = state.length; - if (copy > have) copy = have; - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - // Use untyped array for more convenient processing later - state.head.extra = new Array(state.head.extra_len); - } - // extra field is limited to 65536 bytes - // - no need for additional size check - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - state.head.extra.set(input.subarray(next, next + copy), len); - //zmemcpy(state.head.extra + len, next, - // len + copy > state.head.extra_max ? - // state.head.extra_max - len : copy); - } - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) break inf_leave; - } - state.length = 0; - state.mode = NAME; - /* falls through */ - case NAME: - if (state.flags & 0x0800) { - if (have === 0) break inf_leave; - copy = 0; - do { - // TODO: 2 or 1 bytes? - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if ( - state.head && len && - (state.length < 65536 /*state.head.name_max*/) - ) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy < have); - - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) break inf_leave; - } else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - /* falls through */ - case COMMENT: - if (state.flags & 0x1000) { - if (have === 0) break inf_leave; - copy = 0; - do { - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if ( - state.head && len && - (state.length < 65536 /*state.head.comm_max*/) - ) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) break inf_leave; - } else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - /* falls through */ - case HCRC: - if (state.flags & 0x0200) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.check & 0xffff)) { - strm.msg = "header crc mismatch"; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - if (state.head) { - state.head.hcrc = ((state.flags >> 9) & 1); - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - strm.adler = state.check = zswap32(hold); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = DICT; - /* falls through */ - case DICT: - if (state.havedict === 0) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - return Z_NEED_DICT; - } - strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/; - state.mode = TYPE; - /* falls through */ - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) break inf_leave; - /* falls through */ - case TYPEDO: - if (state.last) { - //--- BYTEBITS() ---// - hold >>>= bits & 7; - bits -= bits & 7; - //---// - state.mode = CHECK; - break; - } - //=== NEEDBITS(3); */ - while (bits < 3) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.last = (hold & 0x01) /*BITS(1)*/; - //--- DROPBITS(1) ---// - hold >>>= 1; - bits -= 1; - //---// - - switch ((hold & 0x03) /*BITS(2)*/) { - case 0:/* stored block */ - //Tracev((stderr, "inflate: stored block%s\n", - // state.last ? " (last)" : "")); - state.mode = STORED; - break; - case 1:/* fixed block */ - fixedtables(state); - //Tracev((stderr, "inflate: fixed codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = LEN_; /* decode codes */ - if (flush === Z_TREES) { - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break inf_leave; - } - break; - case 2:/* dynamic block */ - //Tracev((stderr, "inflate: dynamic codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = TABLE; - break; - case 3: - strm.msg = "invalid block type"; - state.mode = BAD; - } - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break; - case STORED: - //--- BYTEBITS() ---// /* go to byte boundary */ - hold >>>= bits & 7; - bits -= bits & 7; - //---// - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { - strm.msg = "invalid stored block lengths"; - state.mode = BAD; - break; - } - state.length = hold & 0xffff; - //Tracev((stderr, "inflate: stored length %u\n", - // state.length)); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = COPY_; - if (flush === Z_TREES) break inf_leave; - /* falls through */ - case COPY_: - state.mode = COPY; - /* falls through */ - case COPY: - copy = state.length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy === 0) break inf_leave; - //--- zmemcpy(put, next, copy); --- - output.set(input.subarray(next, next + copy), put); - //---// - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - //Tracev((stderr, "inflate: stored end\n")); - state.mode = TYPE; - break; - case TABLE: - //=== NEEDBITS(14); */ - while (bits < 14) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.nlen = (hold & 0x1f) /*BITS(5)*/ + 257; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ndist = (hold & 0x1f) /*BITS(5)*/ + 1; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ncode = (hold & 0x0f) /*BITS(4)*/ + 4; - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - //#ifndef PKZIP_BUG_WORKAROUND - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = "too many length or distance symbols"; - state.mode = BAD; - break; - } - //#endif - //Tracev((stderr, "inflate: table sizes ok\n")); - state.have = 0; - state.mode = LENLENS; - /* falls through */ - case LENLENS: - while (state.have < state.ncode) { - //=== NEEDBITS(3); - while (bits < 3) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.lens[order[state.have++]] = (hold & 0x07); //BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - // We have separate tables & no pointers. 2 commented lines below not needed. - //state.next = state.codes; - //state.lencode = state.next; - // Switch to use dynamic table - state.lencode = state.lendyn; - state.lenbits = 7; - - opts = { bits: state.lenbits }; - ret = inflate_table( - CODES, - state.lens, - 0, - 19, - state.lencode, - 0, - state.work, - opts, - ); - state.lenbits = opts.bits; - - if (ret) { - strm.msg = "invalid code lengths set"; - state.mode = BAD; - break; - } - //Tracev((stderr, "inflate: code lengths ok\n")); - state.have = 0; - state.mode = CODELENS; - /* falls through */ - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (;;) { - here = state - .lencode[ - hold & ((1 << state.lenbits) - 1) - ]; /*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) break; - //--- PULLBYTE() ---// - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_val < 16) { - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.lens[state.have++] = here_val; - } else { - if (here_val === 16) { - //=== NEEDBITS(here.bits + 2); - n = here_bits + 2; - while (bits < n) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - if (state.have === 0) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 0x03); //BITS(2); - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - } else if (here_val === 17) { - //=== NEEDBITS(here.bits + 3); - n = here_bits + 3; - while (bits < n) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 3 + (hold & 0x07); //BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } else { - //=== NEEDBITS(here.bits + 7); - n = here_bits + 7; - while (bits < n) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 11 + (hold & 0x7f); //BITS(7); - //--- DROPBITS(7) ---// - hold >>>= 7; - bits -= 7; - //---// - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - - /* handle error breaks in while */ - if (state.mode === BAD) break; - - /* check for end-of-block code (better have one) */ - if (state.lens[256] === 0) { - strm.msg = "invalid code -- missing end-of-block"; - state.mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state.lenbits = 9; - - opts = { bits: state.lenbits }; - ret = inflate_table( - LENS, - state.lens, - 0, - state.nlen, - state.lencode, - 0, - state.work, - opts, - ); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.lenbits = opts.bits; - // state.lencode = state.next; - - if (ret) { - strm.msg = "invalid literal/lengths set"; - state.mode = BAD; - break; - } - - state.distbits = 6; - //state.distcode.copy(state.codes); - // Switch to use dynamic table - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table( - DISTS, - state.lens, - state.nlen, - state.ndist, - state.distcode, - 0, - state.work, - opts, - ); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.distbits = opts.bits; - // state.distcode = state.next; - - if (ret) { - strm.msg = "invalid distances set"; - state.mode = BAD; - break; - } - //Tracev((stderr, 'inflate: codes ok\n')); - state.mode = LEN_; - if (flush === Z_TREES) break inf_leave; - /* falls through */ - case LEN_: - state.mode = LEN; - /* falls through */ - case LEN: - if (have >= 6 && left >= 258) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - inflate_fast(strm, _out); - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input as Uint8Array; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (;;) { - here = state - .lencode[ - hold & ((1 << state.lenbits) - 1) - ]; /*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if (here_bits <= bits) break; - //--- PULLBYTE() ---// - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_op && (here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.lencode[ - last_val + - ((hold & - ((1 << (last_bits + last_op)) - - 1)) /*BITS(last.bits + last.op)*/ >> last_bits) - ]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) break; - //--- PULLBYTE() ---// - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - state.mode = LIT; - break; - } - if (here_op & 32) { - //Tracevv((stderr, "inflate: end of block\n")); - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = "invalid literal/length code"; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - /* falls through */ - case LENEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length += hold & ((1 << state.extra) - 1) /*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //Tracevv((stderr, "inflate: length %u\n", state.length)); - state.was = state.length; - state.mode = DIST; - /* falls through */ - case DIST: - for (;;) { - here = state - .distcode[ - hold & ((1 << state.distbits) - 1) - ]; /*BITS(state.distbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) break; - //--- PULLBYTE() ---// - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if ((here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.distcode[ - last_val + - ((hold & - ((1 << (last_bits + last_op)) - - 1)) /*BITS(last.bits + last.op)*/ >> last_bits) - ]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) break; - //--- PULLBYTE() ---// - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - if (here_op & 64) { - strm.msg = "invalid distance code"; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = (here_op) & 15; - state.mode = DISTEXT; - /* falls through */ - case DISTEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.offset += hold & ((1 << state.extra) - 1) /*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //#ifdef INFLATE_STRICT - if (state.offset > state.dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; - } - //#endif - //Tracevv((stderr, "inflate: distance %u\n", state.offset)); - state.mode = MATCH; - /* falls through */ - case MATCH: - if (left === 0) break inf_leave; - copy = _out - left; - if (state.offset > copy) { - /* copy from window */ - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; - } - // (!) This block is disabled in zlib defaults, - // don't enable it for binary compatibility - //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - // Trace((stderr, "inflate.c too far\n")); - // copy -= state.whave; - // if (copy > state.length) { copy = state.length; } - // if (copy > left) { copy = left; } - // left -= copy; - // state.length -= copy; - // do { - // output[put++] = 0; - // } while (--copy); - // if (state.length === 0) { state.mode = LEN; } - // break; - //#endif - } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; - } else { - from = state.wnext - copy; - } - if (copy > state.length) copy = state.length; - from_source = state.window; - } else { - /* copy from output */ - from_source = output; - from = put - state.offset; - copy = state.length; - } - if (copy > left) copy = left; - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) state.mode = LEN; - break; - case LIT: - if (left === 0) break inf_leave; - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) break inf_leave; - have--; - // Use '|' instead of '+' to make sure that result is signed - hold |= input[next++] << bits; - bits += 8; - } - //===// - _out -= left; - strm.total_out += _out; - state.total += _out; - if (_out) { - strm.adler = state.check = - /*UPDATE(state.check, put - _out, _out);*/ - (state.flags - ? crc32(state.check, output, _out, put - _out) - : adler32(state.check, output, _out, put - _out)); - } - _out = left; - // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too - if ((state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = "incorrect data check"; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: check matches trailer\n")); - } - state.mode = LENGTH; - /* falls through */ - case LENGTH: - if (state.wrap && state.flags) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) break inf_leave; - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.total & 0xffffffff)) { - strm.msg = "incorrect length check"; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: length matches trailer\n")); - } - state.mode = DONE; - /* falls through */ - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - /* falls through */ - default: - return Z_STREAM_ERROR; - } - } - - // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - - if ( - state.wsize || (_out !== strm.avail_out && state.mode < BAD && - (state.mode < CHECK || flush !== Z_FINISH)) - ) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; - } - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap && _out) { - strm.adler = state - .check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - (state.flags - ? crc32(state.check, output, _out, strm.next_out - _out) - : adler32(state.check, output, _out, strm.next_out - _out)); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + - (state.mode === TYPE ? 128 : 0) + - (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; - } - return ret; -} - -export function inflateEnd(strm: ZStream) { - if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { - return Z_STREAM_ERROR; - } - - let state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK; -} - -export function inflateGetHeader(strm: ZStream, head: any) { - let state; - - /* check state */ - if (!strm || !strm.state) return Z_STREAM_ERROR; - state = strm.state; - if ((state.wrap & 2) === 0) return Z_STREAM_ERROR; - - /* save header structure */ - state.head = head; - head.done = false; - return Z_OK; -} - -export function inflateSetDictionary(strm: ZStream, dictionary: any) { - let dictLength = dictionary.length; - - let state; - let dictid; - let ret; - - /* check state */ - if ( - !strm /* == Z_NULL */ || !strm.state /* == Z_NULL */ - ) { - return Z_STREAM_ERROR; - } - state = strm.state; - - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; - } - - /* check for correct dictionary identifier */ - if (state.mode === DICT) { - dictid = 1; /* adler32(0, null, 0)*/ - /* dictid = adler32(dictid, dictionary, dictLength); */ - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; - } - } - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; - } - state.havedict = 1; - // Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} diff --git a/crates/swc_bundler/tests/.cache/deno/26bccda9ee4e0cfb178dc0f6e701669feded9f28.ts b/crates/swc_bundler/tests/.cache/deno/26bccda9ee4e0cfb178dc0f6e701669feded9f28.ts deleted file mode 100644 index 71231f91b9d8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/26bccda9ee4e0cfb178dc0f6e701669feded9f28.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/channels/follow_channel.ts - - -import { rest } from "../../rest/rest.ts"; -import type { FollowedChannel } from "../../types/channels/followed_channel.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotChannelPermissions } from "../../util/permissions.ts"; - -/** Follow a News Channel to send messages to a target channel. Requires the `MANAGE_WEBHOOKS` permission in the target channel. Returns the webhook id. */ -export async function followChannel(sourceChannelId: bigint, targetChannelId: bigint) { - await requireBotChannelPermissions(targetChannelId, ["MANAGE_WEBHOOKS"]); - - const data = await rest.runMethod("post", endpoints.CHANNEL_FOLLOW(sourceChannelId), { - webhook_channel_id: targetChannelId, - }); - - return data.webhookId; -} diff --git a/crates/swc_bundler/tests/.cache/deno/26ca9cf6769ad9debd3359b877e6586b462778ad.ts b/crates/swc_bundler/tests/.cache/deno/26ca9cf6769ad9debd3359b877e6586b462778ad.ts deleted file mode 100644 index 23f97fde89af..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/26ca9cf6769ad9debd3359b877e6586b462778ad.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/guild_ban_remove.ts - - -import { User } from "../users/user.ts"; - -/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove */ -export interface GuildBanRemove { - /** id of the guild */ - guildId: string; - /** The unbanned user */ - user: User; -} diff --git a/crates/swc_bundler/tests/.cache/deno/27462e170380c6afdec6fd4a7bcf61d114bb0d3a.ts b/crates/swc_bundler/tests/.cache/deno/27462e170380c6afdec6fd4a7bcf61d114bb0d3a.ts deleted file mode 100644 index aed5a10517b6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/27462e170380c6afdec6fd4a7bcf61d114bb0d3a.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/of.js - - -import _curry1 from './internal/_curry1.js'; -import _of from './internal/_of.js'; - - -/** - * Returns a singleton array containing the value provided. - * - * Note this `of` is different from the ES6 `of`; See - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of - * - * @func - * @memberOf R - * @since v0.3.0 - * @category Function - * @sig a -> [a] - * @param {*} x any value - * @return {Array} An array wrapping `x`. - * @example - * - * R.of(null); //=> [null] - * R.of([42]); //=> [[42]] - */ -var of = _curry1(_of); -export default of; diff --git a/crates/swc_bundler/tests/.cache/deno/27641063817a82fd723ecc0f8be06d7cd7d4c4e1.ts b/crates/swc_bundler/tests/.cache/deno/27641063817a82fd723ecc0f8be06d7cd7d4c4e1.ts deleted file mode 100644 index ded3d39f2cbf..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/27641063817a82fd723ecc0f8be06d7cd7d4c4e1.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/rest/check_rate_limits.ts - - -import { rest } from "./rest.ts"; - -/** Check the rate limits for a url or a bucket. */ -export function checkRateLimits(url: string) { - const ratelimited = rest.ratelimitedPaths.get(url); - const global = rest.ratelimitedPaths.get("global"); - const now = Date.now(); - - if (ratelimited && now < ratelimited.resetTimestamp) { - return ratelimited.resetTimestamp - now; - } - if (global && now < global.resetTimestamp) { - return global.resetTimestamp - now; - } - - return false; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2797931a766244d071d3dc12230f5d999252faf1.ts b/crates/swc_bundler/tests/.cache/deno/2797931a766244d071d3dc12230f5d999252faf1.ts deleted file mode 100644 index 51465a827603..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2797931a766244d071d3dc12230f5d999252faf1.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/embeds/embed_provider.ts - - -export type DiscordEmbedProvider = EmbedProvider; -export interface EmbedProvider { - /** Name of provider */ - name?: string; - /** Url of provider */ - url?: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/27a5693556028e1da430db5f6660ce5827aaa105.ts b/crates/swc_bundler/tests/.cache/deno/27a5693556028e1da430db5f6660ce5827aaa105.ts deleted file mode 100644 index 7525939bb2b3..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/27a5693556028e1da430db5f6660ce5827aaa105.ts +++ /dev/null @@ -1,92 +0,0 @@ -// Loaded from https://deno.land/x/crc32@v0.2.0/mod.ts - - -export function crc32(arr: Uint8Array | string): string { - if (typeof arr === "string") { - arr = new TextEncoder().encode(arr); - } - let crc = -1, i, j, l, temp, poly = 0xEDB88320; - - for (i = 0, l = arr.length; i < l; i += 1) { - temp = (crc ^ arr[i]) & 0xff; - for (j = 0; j < 8; j += 1) { - if ((temp & 1) === 1) { - temp = (temp >>> 1) ^ poly; - } else { - temp = (temp >>> 1); - } - } - crc = (crc >>> 8) ^ temp; - } - - return numberToHex(crc ^ -1); -} - -export class Crc32Stream { - private bytes: number[] = []; - private poly = 0xEDB88320; - private crc = 0 ^ -1; - private encoder = new TextEncoder(); - #crc32: string = ""; - - constructor() { - this.reset(); - } - - get crc32(): string { - return this.#crc32; - } - - reset(): void { - this.#crc32 = ""; - this.crc = 0 ^ -1; - - for (let n = 0; n < 256; n += 1) { - let c = n; - for (let k = 0; k < 8; k += 1) { - if (c & 1) { - c = this.poly ^ (c >>> 1); - } else { - c = c >>> 1; - } - } - this.bytes[n] = c >>> 0; - } - } - - append(arr: Uint8Array | string): string { - if (typeof arr === "string") { - arr = this.encoder.encode(arr); - } - - let crc = this.crc; - - for (let i = 0, l = arr.length; i < l; i += 1) { - crc = (crc >>> 8) ^ this.bytes[(crc ^ arr[i]) & 0xff]; - } - - this.crc = crc; - this.#crc32 = numberToHex(crc ^ -1); - return this.#crc32; - } -} - -export function numberToHex(n: number): string { - return (n >>> 0).toString(16); -} - -export function hexToUint8Array(str: string): Uint8Array { - if (str.length === 0 || str.length % 2 !== 0) { - throw new Error(`The string "${str}" is not valid hex.`); - } - return new Uint8Array( - str.match(/.{1,2}/g)!.map((byte) => parseInt(byte, 16)), - ); -} - -export function uint8ArrayToHex(bytes: Uint8Array): string { - return bytes.reduce( - (str, byte) => str + byte.toString(16).padStart(2, "0"), - "", - ); -} diff --git a/crates/swc_bundler/tests/.cache/deno/27dc4d2dd7eb352391ca33475abe6dd1dfadb61c.ts b/crates/swc_bundler/tests/.cache/deno/27dc4d2dd7eb352391ca33475abe6dd1dfadb61c.ts deleted file mode 100644 index b523830c3e5d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/27dc4d2dd7eb352391ca33475abe6dd1dfadb61c.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Loaded from https://deno.land/x/bytes_formater@v1.4.0/format.ts - - -import { green } from "./deps.ts"; - -export function format(data: ArrayBufferView) { - const bytes = new Uint8Array(data.buffer); - let out = " +-------------------------------------------------+\n"; - out += ` |${ - green(" 0 1 2 3 4 5 6 7 8 9 a b c d e f ") - }|\n`; - out += - "+--------+-------------------------------------------------+----------------+\n"; - - const lineCount = Math.ceil(bytes.length / 16); - - for (let line = 0; line < lineCount; line++) { - const start = line * 16; - const addr = start.toString(16).padStart(8, "0"); - const lineBytes = bytes.slice(start, start + 16); - - out += `|${green(addr)}| `; - - lineBytes.forEach( - (byte) => (out += byte.toString(16).padStart(2, "0") + " "), - ); - - if (lineBytes.length < 16) { - out += " ".repeat(16 - lineBytes.length); - } - - out += "|"; - - lineBytes.forEach(function (byte) { - return (out += byte > 31 && byte < 127 - ? green(String.fromCharCode(byte)) - : "."); - }); - - if (lineBytes.length < 16) { - out += " ".repeat(16 - lineBytes.length); - } - - out += "|\n"; - } - out += - "+--------+-------------------------------------------------+----------------+"; - return out; -} diff --git a/crates/swc_bundler/tests/.cache/deno/27e585629f2edc542d9103600a9f4b46e97cd38b.ts b/crates/swc_bundler/tests/.cache/deno/27e585629f2edc542d9103600a9f4b46e97cd38b.ts deleted file mode 100644 index 0fc0353c955c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/27e585629f2edc542d9103600a9f4b46e97cd38b.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/lte.js - - -import _curry2 from './internal/_curry2.js'; - - -/** - * Returns `true` if the first argument is less than or equal to the second; - * `false` otherwise. - * - * @func - * @memberOf R - * @since v0.1.0 - * @category Relation - * @sig Ord a => a -> a -> Boolean - * @param {Number} a - * @param {Number} b - * @return {Boolean} - * @see R.gte - * @example - * - * R.lte(2, 1); //=> false - * R.lte(2, 2); //=> true - * R.lte(2, 3); //=> true - * R.lte('a', 'z'); //=> true - * R.lte('z', 'a'); //=> false - */ -var lte = _curry2(function lte(a, b) { return a <= b; }); -export default lte; diff --git a/crates/swc_bundler/tests/.cache/deno/27e68e7896365acf65e2f7d3748c899d59dad587.ts b/crates/swc_bundler/tests/.cache/deno/27e68e7896365acf65e2f7d3748c899d59dad587.ts deleted file mode 100644 index 5fd4464c7be6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/27e68e7896365acf65e2f7d3748c899d59dad587.ts +++ /dev/null @@ -1,185 +0,0 @@ -// Loaded from https://deno.land/x/oak/context.ts - - -// Copyright 2018-2021 the oak authors. All rights reserved. MIT license. - -import type { Application, State } from "./application.ts"; -import { Cookies } from "./cookies.ts"; -import { acceptable, acceptWebSocket, WebSocket } from "./deps.ts"; -import { createHttpError } from "./httpError.ts"; -import type { KeyStack } from "./keyStack.ts"; -import { Request } from "./request.ts"; -import { Response } from "./response.ts"; -import { send, SendOptions } from "./send.ts"; -import { - ServerSentEventTarget, - ServerSentEventTargetOptions, -} from "./server_sent_event.ts"; -import type { ErrorStatus, ServerRequest } from "./types.d.ts"; - -export interface ContextSendOptions extends SendOptions { - /** The filename to send, which will be resolved based on the other options. - * If this property is omitted, the current context's `.request.url.pathname` - * will be used. */ - path?: string; -} - -/** Provides context about the current request and response to middleware - * functions. */ -// deno-lint-ignore no-explicit-any -export class Context> { - #socket?: WebSocket; - #sse?: ServerSentEventTarget; - - /** A reference to the current application. */ - app: Application; - - /** An object which allows access to cookies, mediating both the request and - * response. */ - cookies: Cookies; - - /** Is `true` if the current connection is upgradeable to a web socket. - * Otherwise the value is `false`. Use `.upgrade()` to upgrade the connection - * and return the web socket. */ - get isUpgradable(): boolean { - return acceptable(this.request); - } - - /** Determines if the request should be responded to. If `false` when the - * middleware completes processing, the response will not be sent back to the - * requestor. Typically this is used if the middleware will take over low - * level processing of requests and responses, for example if using web - * sockets. This automatically gets set to `false` when the context is - * upgraded to a web socket via the `.upgrade()` method. - * - * The default is `true`. */ - respond: boolean; - - /** An object which contains information about the current request. */ - request: Request; - - /** An object which contains information about the response that will be sent - * when the middleware finishes processing. */ - response: Response; - - /** If the the current context has been upgraded, then this will be set to - * with the web socket, otherwise it is `undefined`. */ - get socket(): WebSocket | undefined { - return this.#socket; - } - - /** The object to pass state to front-end views. This can be typed by - * supplying the generic state argument when creating a new app. For - * example: - * - * ```ts - * const app = new Application<{ foo: string }>(); - * ``` - * - * Or can be contextually inferred based on setting an initial state object: - * - * ```ts - * const app = new Application({ state: { foo: "bar" } }); - * ``` - */ - state: S; - - constructor( - app: Application, - serverRequest: ServerRequest, - secure = false, - ) { - this.app = app; - this.state = app.state; - this.request = new Request(serverRequest, app.proxy, secure); - this.respond = true; - this.response = new Response(this.request); - this.cookies = new Cookies(this.request, this.response, { - keys: this.app.keys as KeyStack | undefined, - secure: this.request.secure, - }); - } - - /** Asserts the condition and if the condition fails, creates an HTTP error - * with the provided status (which defaults to `500`). The error status by - * default will be set on the `.response.status`. - */ - assert( - // deno-lint-ignore no-explicit-any - condition: any, - errorStatus: ErrorStatus = 500, - message?: string, - props?: Record, - ): asserts condition { - if (condition) { - return; - } - const err = createHttpError(errorStatus, message); - if (props) { - Object.assign(err, props); - } - throw err; - } - - /** Asynchronously fulfill a response with a file from the local file - * system. - * - * If the `options.path` is not supplied, the file to be sent will default - * to this `.request.url.pathname`. - * - * Requires Deno read permission. */ - send(options: ContextSendOptions): Promise { - const { path = this.request.url.pathname, ...sendOptions } = options; - return send(this, path, sendOptions); - } - - /** Convert the connection to stream events, returning an event target for - * sending server sent events. Events dispatched on the returned target will - * be sent to the client and be available in the client's `EventSource` that - * initiated the connection. - * - * This will set `.respond` to `false`. */ - sendEvents(options?: ServerSentEventTargetOptions): ServerSentEventTarget { - if (this.#sse) { - return this.#sse; - } - this.respond = false; - return this.#sse = new ServerSentEventTarget( - this.app, - this.request.serverRequest, - options, - ); - } - - /** Create and throw an HTTP Error, which can be used to pass status - * information which can be caught by other middleware to send more - * meaningful error messages back to the client. The passed error status will - * be set on the `.response.status` by default as well. - */ - throw( - errorStatus: ErrorStatus, - message?: string, - props?: Record, - ): never { - const err = createHttpError(errorStatus, message); - if (props) { - Object.assign(err, props); - } - throw err; - } - - /** Take the current request and upgrade it to a web socket, resolving with - * the web socket object. This will set `.respond` to `false`. */ - async upgrade(): Promise { - if (this.#socket) { - return this.#socket; - } - const { conn, r: bufReader, w: bufWriter, headers } = - this.request.serverRequest; - this.#socket = await acceptWebSocket( - { conn, bufReader, bufWriter, headers }, - ); - this.respond = false; - return this.#socket; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/27e92fa1ee8580ba9ac4ecb4ee98d941111687ac.ts b/crates/swc_bundler/tests/.cache/deno/27e92fa1ee8580ba9ac4ecb4ee98d941111687ac.ts deleted file mode 100644 index 0da095abb24e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/27e92fa1ee8580ba9ac4ecb4ee98d941111687ac.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Loaded from https://deno.land/std@0.73.0/_util/has_own_property.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -/** - * Determines whether an object has a property with the specified name. - * Avoid calling prototype builtin `hasOwnProperty` for two reasons: - * - * 1. `hasOwnProperty` is defined on the object as something else: - * - * const options = { - * ending: 'utf8', - * hasOwnProperty: 'foo' - * }; - * options.hasOwnProperty('ending') // throws a TypeError - * - * 2. The object doesn't inherit from `Object.prototype`: - * - * const options = Object.create(null); - * options.ending = 'utf8'; - * options.hasOwnProperty('ending'); // throws a TypeError - * - * @param obj A Object. - * @param v A property name. - * @see https://eslint.org/docs/rules/no-prototype-builtins - */ -export function hasOwnProperty(obj: T, v: PropertyKey): boolean { - if (obj == null) { - return false; - } - return Object.prototype.hasOwnProperty.call(obj, v); -} diff --git a/crates/swc_bundler/tests/.cache/deno/280a12d7344b3f78c7ed991e74dd33dca76b6144.ts b/crates/swc_bundler/tests/.cache/deno/280a12d7344b3f78c7ed991e74dd33dca76b6144.ts deleted file mode 100644 index 83aba6435c1b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/280a12d7344b3f78c7ed991e74dd33dca76b6144.ts +++ /dev/null @@ -1,305 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/gzip/gzip.ts - - -import { crc32 } from "../deps.ts"; -/** very fast */ -import { deflateRaw, inflateRaw } from "../zlib/mod.ts"; -/** slow */ -// import { deflateRaw, inflateRaw } from "../deflate/mod.ts"; - -// magic numbers marking this file as GZIP -const ID1 = 0x1F; -const ID2 = 0x8B; - -const compressionMethods = { - "deflate": 8, -}; -const possibleFlags = { - "FTEXT": 0x01, - "FHCRC": 0x02, - "FEXTRA": 0x04, - "FNAME": 0x08, - "FCOMMENT": 0x10, -}; -// const osMap = { -// "fat": 0, // FAT file system (DOS, OS/2, NT) + PKZIPW 2.50 VFAT, NTFS -// "amiga": 1, // Amiga -// "vmz": 2, // VMS (VAX or Alpha AXP) -// "unix": 3, // Unix -// "vm/cms": 4, // VM/CMS -// "atari": 5, // Atari -// "hpfs": 6, // HPFS file system (OS/2, NT 3.x) -// "macintosh": 7, // Macintosh -// "z-system": 8, // Z-System -// "cplm": 9, // CP/M -// "tops-20": 10, // TOPS-20 -// "ntfs": 11, // NTFS file system (NT) -// "qdos": 12, // SMS/QDOS -// "acorn": 13, // Acorn RISC OS -// "vfat": 14, // VFAT file system (Win95, NT) -// "vms": 15, // MVS (code also taken for PRIMOS) -// "beos": 16, // BeOS (BeBox or PowerMac) -// "tandem": 17, // Tandem/NSK -// "theos": 18, // THEOS -// }; -const os = { - "darwin": 3, - "linux": 3, - "windows": 0, -}; - -const osCode = os[Deno.build.os] ?? 255; -export const DEFAULT_LEVEL = 6; - -function putByte(n: number, arr: number[]) { - arr.push(n & 0xFF); -} - -// LSB first -function putShort(n: number, arr: number[]) { - arr.push(n & 0xFF); - arr.push(n >>> 8); -} - -// LSB first -export function putLong(n: number, arr: number[]) { - putShort(n & 0xffff, arr); - putShort(n >>> 16, arr); -} - -function putString(s: string, arr: number[]) { - for (let i = 0, len = s.length; i < len; i += 1) { - putByte(s.charCodeAt(i), arr); - } -} - -function readByte(arr: number[]): number { - return arr.shift()!; -} - -function readShort(arr: number[]) { - return arr.shift()! | (arr.shift()! << 8); -} - -function readLong(arr: number[]) { - let n1 = readShort(arr); - let n2 = readShort(arr); - - // JavaScript can't handle bits in the position 32 - // we'll emulate this by removing the left-most bit (if it exists) - // and add it back in via multiplication, which does work - if (n2 > 32768) { - n2 -= 32768; - - return ((n2 << 16) | n1) + 32768 * Math.pow(2, 16); - } - - return (n2 << 16) | n1; -} - -function readString(arr: number[]) { - const charArr = []; - - // turn all bytes into chars until the terminating null - while (arr[0] !== 0) { - charArr.push(String.fromCharCode(arr.shift()!)); - } - - // throw away terminating null - arr.shift(); - - // join all characters into a cohesive string - return charArr.join(""); -} - -function readBytes(arr: number[], n: number) { - const ret = []; - for (let i = 0; i < n; i += 1) { - ret.push(arr.shift()); - } - return ret; -} - -interface Options { - level?: number; - timestamp?: number; - name?: string; -} - -export function getHeader( - options: Options = {}, -): Uint8Array { - let flags: number = 0; - let level: number = options.level ?? DEFAULT_LEVEL; - const out: number[] = []; - - putByte(ID1, out); - putByte(ID2, out); - - putByte(compressionMethods["deflate"], out); - - if (options.name) { - flags |= possibleFlags["FNAME"]; - } - - putByte(flags, out); - putLong(options.timestamp ?? Math.floor(Date.now() / 1000), out); - - // put deflate args (extra flags) - if (level === 1) { - // fastest algorithm - putByte(4, out); - } else if (level === 9) { - // maximum compression (fastest algorithm) - putByte(2, out); - } else { - putByte(0, out); - } - - // OS identifier - putByte(osCode, out); - - if (options.name) { - // ignore the directory part - putString(options.name.substring(options.name.lastIndexOf("/") + 1), out); - - // terminating null - putByte(0, out); - } - - return new Uint8Array(out); -} - -export function gzip( - bytes: Uint8Array, - options: Options = {}, -): Uint8Array { - let flags: number = 0; - let level: number = options.level ?? DEFAULT_LEVEL; - const out: number[] = []; - - putByte(ID1, out); - putByte(ID2, out); - - putByte(compressionMethods["deflate"], out); - - if (options.name) { - flags |= possibleFlags["FNAME"]; - } - - putByte(flags, out); - putLong(options.timestamp ?? Math.floor(Date.now() / 1000), out); - - // put deflate args (extra flags) - if (level === 1) { - // fastest algorithm - putByte(4, out); - } else if (level === 9) { - // maximum compression (fastest algorithm) - putByte(2, out); - } else { - putByte(0, out); - } - - // OS identifier - putByte(osCode, out); - - if (options.name) { - // ignore the directory part - putString(options.name.substring(options.name.lastIndexOf("/") + 1), out); - - // terminating null - putByte(0, out); - } - - deflateRaw(bytes).forEach(function (byte) { - putByte(byte, out); - }); - // import { deflateRaw, inflateRaw } from "../deflate/mod.ts"; - // deflateRaw(bytes, level).forEach(function (byte) { - // putByte(byte, out); - // }); - - putLong(parseInt(crc32(bytes), 16), out); - putLong(bytes.length, out); - - return new Uint8Array(out); -} - -export function gunzip(bytes: Uint8Array): Uint8Array { - const arr = Array.from(bytes); - - checkHeader(arr); - - // give deflate everything but the last 8 bytes - // the last 8 bytes are for the CRC32 checksum and filesize - let res: Uint8Array = inflateRaw( - new Uint8Array(arr.splice(0, arr.length - 8)), - ); - - // if (flags & possibleFlags["FTEXT"]) { - // res = Array.prototype.map.call(res, function (byte) { - // return String.fromCharCode(byte); - // }).join(""); - // } - - let crc: number = readLong(arr) >>> 0; - if (crc !== parseInt(crc32(res), 16)) { - throw "Checksum does not match"; - } - - let size: number = readLong(arr); - if (size !== res.length) { - throw "Size of decompressed file not correct"; - } - - return res; -} - -export function checkHeader(arr: number[]) { - // check the first two bytes for the magic numbers - if (readByte(arr) !== ID1 || readByte(arr) !== ID2) { - throw "Not a GZIP file"; - } - if (readByte(arr) !== 8) { - throw "Unsupported compression method"; - } - - let flags: number = readByte(arr); - readLong(arr); // mtime - readByte(arr); // xFlags - readByte(arr); // os, throw away - - // just throw away the bytes for now - if (flags & possibleFlags["FEXTRA"]) { - let t: number = readShort(arr); - readBytes(arr, t); - } - - // just throw away for now - if (flags & possibleFlags["FNAME"]) { - readString(arr); - } - - // just throw away for now - if (flags & possibleFlags["FCOMMENT"]) { - readString(arr); - } - - // just throw away for now - if (flags & possibleFlags["FHCRC"]) { - readShort(arr); - } -} - -export function checkTail(arr: number[]) { - const tail = arr.splice(arr.length - 8); - - let crc32: number = readLong(tail) >>> 0; - let size: number = readLong(tail); - - return { - crc32, - size, - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2848eaf794b78a575c19794382c82958390f8f78.ts b/crates/swc_bundler/tests/.cache/deno/2848eaf794b78a575c19794382c82958390f8f78.ts deleted file mode 100644 index c31516914326..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2848eaf794b78a575c19794382c82958390f8f78.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Loaded from https://deno.land/x/validasaur/src/rules/either.ts - - -import type { Validity, Rule } from "../types.ts"; -import type { ValidationUtils } from "../interfaces.ts"; -import { invalid } from "../utils.ts"; -import { validateValue } from "../validate.ts"; - -export function either( - ruleSets: (Rule | Rule[])[], - errorCode: string = "either", -): Rule { - return async function eitherRule( - value: any, - utils: ValidationUtils, - ): Promise { - for (const ruleSet of ruleSets) { - const errs = await validateValue( - value, - ruleSet instanceof Array ? ruleSet : [ruleSet], - utils, - ); - - if (errs.length === 0) { - return undefined; - } - } - - return invalid(errorCode, { value }); - }; -} diff --git a/crates/swc_bundler/tests/.cache/deno/28bd60dc23fe1221d19c06b781ac2bfe434e61e3.ts b/crates/swc_bundler/tests/.cache/deno/28bd60dc23fe1221d19c06b781ac2bfe434e61e3.ts deleted file mode 100644 index b9eea9f9652d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/28bd60dc23fe1221d19c06b781ac2bfe434e61e3.ts +++ /dev/null @@ -1,278 +0,0 @@ -// Loaded from https://deno.land/x/oak@v6.3.1/response.ts - - -// Copyright 2018-2020 the oak authors. All rights reserved. MIT license. - -import { contentType, Status } from "./deps.ts"; -import type { Request } from "./request.ts"; -import type { ServerResponse } from "./types.d.ts"; -import { encodeUrl, isHtml, isRedirectStatus } from "./util.ts"; - -type Body = - | string - | number - | bigint - | boolean - | symbol - // deno-lint-ignore ban-types - | object - | undefined - | null; -type BodyFunction = () => Body | Promise; - -/** A symbol that indicates to `response.redirect()` to attempt to redirect - * back to the request referrer. For example: - * - * ```ts - * import { Application, REDIRECT_BACK } from "https://deno.land/x/oak/mod.ts"; - * - * const app = new Application(); - * - * app.use((ctx) => { - * if (ctx.request.url.pathName === "/back") { - * ctx.response.redirect(REDIRECT_BACK, "/"); - * } - * }); - * - * await app.listen({ port: 80 }); - * ``` - */ -export const REDIRECT_BACK = Symbol("redirect backwards"); - -const BODY_TYPES = ["string", "number", "bigint", "boolean", "symbol"]; - -const encoder = new TextEncoder(); - -/** Guard for `Deno.Reader`. */ -// deno-lint-ignore no-explicit-any -function isReader(value: any): value is Deno.Reader { - return value && typeof value === "object" && "read" in value && - typeof value.read === "function"; -} - -async function convertBody( - body: Body | BodyFunction, - type?: string, -): Promise<[Uint8Array | Deno.Reader | undefined, string | undefined]> { - let result: Uint8Array | Deno.Reader | undefined; - if (BODY_TYPES.includes(typeof body)) { - const bodyText = String(body); - result = encoder.encode(bodyText); - type = type ?? (isHtml(bodyText) ? "html" : "text/plain"); - } else if (body instanceof Uint8Array || isReader(body)) { - result = body; - } else if (body && typeof body === "object") { - result = encoder.encode(JSON.stringify(body)); - type = type ?? "json"; - } else if (typeof body === "function") { - const result = body.call(null); - return convertBody(await result, type); - } else if (body) { - throw new TypeError("Response body was set but could not convert."); - } - return [result, type]; -} - -/** An interface to control what response will be sent when the middleware - * finishes processing the request. */ -export class Response { - #body?: Body | BodyFunction; - #headers = new Headers(); - #request: Request; - #resources: number[] = []; - #serverResponse?: ServerResponse; - #status?: Status; - #type?: string; - #writable = true; - - #getBody = async (): Promise => { - const [body, type] = await convertBody(this.body, this.type); - this.type = type; - return body; - }; - - #setContentType = (): void => { - if (this.type) { - const contentTypeString = contentType(this.type); - if (contentTypeString && !this.headers.has("Content-Type")) { - this.headers.append("Content-Type", contentTypeString); - } - } - }; - - /** The body of the response. The body will be automatically processed when - * the response is being sent and converted to a `Uint8Array` or a - * `Deno.Reader`. */ - get body(): Body | BodyFunction { - return this.#body; - } - - /** The body of the response. The body will be automatically processed when - * the response is being sent and converted to a `Uint8Array` or a - * `Deno.Reader`. */ - set body(value: Body | BodyFunction) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#body = value; - } - - /** Headers that will be returned in the response. */ - get headers(): Headers { - return this.#headers; - } - - /** Headers that will be returned in the response. */ - set headers(value: Headers) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#headers = value; - } - - /** The HTTP status of the response. If this has not been explicitly set, - * reading the value will return what would be the value of status if the - * response were sent at this point in processing the middleware. If the body - * has been set, the status will be `200 OK`. If a value for the body has - * not been set yet, the status will be `404 Not Found`. */ - get status(): Status { - if (this.#status) { - return this.#status; - } - const typeofbody = typeof this.body; - return this.body && - (BODY_TYPES.includes(typeofbody) || typeofbody === "object") - ? Status.OK - : Status.NotFound; - } - - /** The HTTP status of the response. If this has not been explicitly set, - * reading the value will return what would be the value of status if the - * response were sent at this point in processing the middleware. If the body - * has been set, the status will be `200 OK`. If a value for the body has - * not been set yet, the status will be `404 Not Found`. */ - set status(value: Status) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#status = value; - } - - /** The media type, or extension of the response. Setting this value will - * ensure an appropriate `Content-Type` header is added to the response. */ - get type(): string | undefined { - return this.#type; - } - /** The media type, or extension of the response. Setting this value will - * ensure an appropriate `Content-Type` header is added to the response. */ - set type(value: string | undefined) { - if (!this.#writable) { - throw new Error("The response is not writable."); - } - this.#type = value; - } - - /** A read-only property which determines if the response is writable or not. - * Once the response has been processed, this value is set to `false`. */ - get writable(): boolean { - return this.#writable; - } - - constructor(request: Request) { - this.#request = request; - } - - /** Add a resource to the list of resources that will be closed when the - * request is destroyed. */ - addResource(rid: number): void { - this.#resources.push(rid); - } - - /** Release any resources that are being tracked by the response. */ - destroy(): void { - this.#writable = false; - this.#body = undefined; - this.#serverResponse = undefined; - for (const rid of this.#resources) { - Deno.close(rid); - } - } - - /** Sets the response to redirect to the supplied `url`. - * - * If the `.status` is not currently a redirect status, the status will be set - * to `302 Found`. - * - * The body will be set to a message indicating the redirection is occurring. - */ - redirect(url: string | URL): void; - /** Sets the response to redirect back to the referrer if available, with an - * optional `alt` URL if there is no referrer header on the request. If there - * is no referrer header, nor an `alt` parameter, the redirect is set to `/`. - * - * If the `.status` is not currently a redirect status, the status will be set - * to `302 Found`. - * - * The body will be set to a message indicating the redirection is occurring. - */ - redirect(url: typeof REDIRECT_BACK, alt?: string | URL): void; - redirect( - url: string | URL | typeof REDIRECT_BACK, - alt: string | URL = "/", - ): void { - if (url === REDIRECT_BACK) { - url = this.#request.headers.get("Referrer") ?? String(alt); - } else if (typeof url === "object") { - url = String(url); - } - this.headers.set("Location", encodeUrl(url)); - if (!this.status || !isRedirectStatus(this.status)) { - this.status = Status.Found; - } - - if (this.#request.accepts("html")) { - url = encodeURI(url); - this.type = "text/html; charset=utf-8"; - this.body = `Redirecting to ${url}.`; - return; - } - this.type = "text/plain; charset=utf-8"; - this.body = `Redirecting to ${url}.`; - } - - /** Take this response and convert it to the response used by the Deno net - * server. Calling this will set the response to not be writable. - * - * Most users will have no need to call this method. */ - async toServerResponse(): Promise { - if (this.#serverResponse) { - return this.#serverResponse; - } - // Process the body - const body = await this.#getBody(); - - // If there is a response type, set the content type header - this.#setContentType(); - - const { headers } = this; - - // If there is no body and no content type and no set length, then set the - // content length to 0 - if ( - !( - body || - headers.has("Content-Type") || - headers.has("Content-Length") - ) - ) { - headers.append("Content-Length", "0"); - } - - this.#writable = false; - return this.#serverResponse = { - status: this.#status ?? (body ? Status.OK : Status.NotFound), - body, - headers, - }; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/28c2ca9507c5f5fbcb07467e2ae1f9ed35f2b91b.ts b/crates/swc_bundler/tests/.cache/deno/28c2ca9507c5f5fbcb07467e2ae1f9ed35f2b91b.ts deleted file mode 100644 index 6a8a24f72952..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/28c2ca9507c5f5fbcb07467e2ae1f9ed35f2b91b.ts +++ /dev/null @@ -1,332 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/zlib/zlib/inffast.ts - - -// See state defs from inflate.js -const BAD = 30; /* got a data error -- remain here until reset */ -const TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state.mode === LEN - strm.avail_in >= 6 - strm.avail_out >= 258 - start >= strm.avail_out - state.bits < 8 - - On return, state.mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm.avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm.avail_out >= 258 for each loop to avoid checking for - output space. - */ -export default function inflate_fast(strm: any, start: number) { - let state; - let _in; /* local strm.input */ - let last; /* have enough input while in < last */ - let _out; /* local strm.output */ - let beg; /* inflate()'s initial strm.output */ - let end; /* while out < end, enough space available */ - //#ifdef INFLATE_STRICT - let dmax; /* maximum distance from zlib header */ - //#endif - let wsize; /* window size or zero if not using window */ - let whave; /* valid bytes in the window */ - let wnext; /* window write index */ - // Use `s_window` instead `window`, avoid conflict with instrumentation tools - let s_window; /* allocated sliding window, if wsize != 0 */ - let hold; /* local strm.hold */ - let bits; /* local strm.bits */ - let lcode; /* local strm.lencode */ - let dcode; /* local strm.distcode */ - let lmask; /* mask for first level of length codes */ - let dmask; /* mask for first level of distance codes */ - let here; /* retrieved table entry */ - let op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - let len; /* match length, unused bytes */ - let dist; /* match distance */ - let from; /* where to copy match from */ - let from_source; - - let input, output; // JS specific, because we have no pointers - - /* copy state to local variables */ - state = strm.state; - //here = state.here; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); - //#ifdef INFLATE_STRICT - dmax = state.dmax; - //#endif - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - - here = lcode[hold & lmask]; - - dolen: - for (;;) { // Goto emulation - op = here >>> 24 /*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff /*here.op*/; - if (op === 0) { - /* literal */ - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - output[_out++] = here & 0xffff /*here.val*/; - } else if (op & 16) { - /* length base */ - len = here & 0xffff /*here.val*/; - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & ((1 << op) - 1); - hold >>>= op; - bits -= op; - } - //Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - - dodist: - for (;;) { // goto emulation - op = here >>> 24 /*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff /*here.op*/; - - if (op & 16) { - /* distance base */ - dist = here & 0xffff /*here.val*/; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & ((1 << op) - 1); - //#ifdef INFLATE_STRICT - if (dist > dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break top; - } - //#endif - hold >>>= op; - bits -= op; - //Tracevv((stderr, "inflate: distance %u\n", dist)); - op = _out - beg; /* max distance in output */ - if (dist > op) { - /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break top; - } - - // (!) This block is disabled in zlib defaults, - // don't enable it for binary compatibility - //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - // if (len <= op - whave) { - // do { - // output[_out++] = 0; - // } while (--len); - // continue top; - // } - // len -= op - whave; - // do { - // output[_out++] = 0; - // } while (--op > whave); - // if (op === 0) { - // from = _out - dist; - // do { - // output[_out++] = output[from++]; - // } while (--len); - // continue top; - // } - //#endif - } - from = 0; // window index - from_source = s_window; - if (wnext === 0) { - /* very common case */ - from += wsize - op; - if (op < len) { - /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } else if (wnext < op) { - /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { - /* some from end of window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { - /* some from start of window */ - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - } else { - /* contiguous in window */ - from += wnext - op; - if (op < len) { - /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } else { - from = _out - dist; /* copy direct from output */ - do { - /* minimum length is three */ - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } else if ((op & 64) === 0) { - /* 2nd level distance code */ - here = - dcode[(here & 0xffff) /*here.val*/ + (hold & ((1 << op) - 1))]; - continue dodist; - } else { - strm.msg = "invalid distance code"; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } else if ((op & 64) === 0) { - /* 2nd level length code */ - here = lcode[(here & 0xffff) /*here.val*/ + (hold & ((1 << op) - 1))]; - continue dolen; - } else if (op & 32) { - /* end-of-block */ - //Tracevv((stderr, "inflate: end of block\n")); - state.mode = TYPE; - break top; - } else { - strm.msg = "invalid literal/length code"; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } while (_in < last && _out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - - /* update state and return */ - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); - strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); - state.hold = hold; - state.bits = bits; - return; -} diff --git a/crates/swc_bundler/tests/.cache/deno/28c92ae545e5e5ba5a1df5a7918d590089ce701d.ts b/crates/swc_bundler/tests/.cache/deno/28c92ae545e5e5ba5a1df5a7918d590089ce701d.ts deleted file mode 100644 index a0cdbb9bf170..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/28c92ae545e5e5ba5a1df5a7918d590089ce701d.ts +++ /dev/null @@ -1,955 +0,0 @@ -// Loaded from https://deno.land/std@0.77.0/path/win32.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -/** This module is browser compatible. */ - -import type { FormatInputPathObject, ParsedPath } from "./_interface.ts"; -import { - CHAR_BACKWARD_SLASH, - CHAR_COLON, - CHAR_DOT, - CHAR_QUESTION_MARK, -} from "./_constants.ts"; - -import { - _format, - assertPath, - isPathSeparator, - isWindowsDeviceRoot, - normalizeString, -} from "./_util.ts"; -import { assert } from "../_util/assert.ts"; - -export const sep = "\\"; -export const delimiter = ";"; - -export function resolve(...pathSegments: string[]): string { - let resolvedDevice = ""; - let resolvedTail = ""; - let resolvedAbsolute = false; - - for (let i = pathSegments.length - 1; i >= -1; i--) { - let path: string; - if (i >= 0) { - path = pathSegments[i]; - } else if (!resolvedDevice) { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a drive-letter-less path without a CWD."); - } - path = Deno.cwd(); - } else { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a relative path without a CWD."); - } - // Windows has the concept of drive-specific current working - // directories. If we've resolved a drive letter but not yet an - // absolute path, get cwd for that drive, or the process cwd if - // the drive cwd is not available. We're sure the device is not - // a UNC path at this points, because UNC paths are always absolute. - path = Deno.env.get(`=${resolvedDevice}`) || Deno.cwd(); - - // Verify that a cwd was found and that it actually points - // to our drive. If not, default to the drive's root. - if ( - path === undefined || - path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\` - ) { - path = `${resolvedDevice}\\`; - } - } - - assertPath(path); - - const len = path.length; - - // Skip empty entries - if (len === 0) continue; - - let rootEnd = 0; - let device = ""; - let isAbsolute = false; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - // If we started with a separator, we know we at least have an - // absolute path of some kind (UNC or otherwise) - isAbsolute = true; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - device = `\\\\${firstPart}\\${path.slice(last)}`; - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator - rootEnd = 1; - isAbsolute = true; - } - - if ( - device.length > 0 && - resolvedDevice.length > 0 && - device.toLowerCase() !== resolvedDevice.toLowerCase() - ) { - // This path points to another device so it is not applicable - continue; - } - - if (resolvedDevice.length === 0 && device.length > 0) { - resolvedDevice = device; - } - if (!resolvedAbsolute) { - resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`; - resolvedAbsolute = isAbsolute; - } - - if (resolvedAbsolute && resolvedDevice.length > 0) break; - } - - // At this point the path should be resolved to a full absolute path, - // but handle relative paths to be safe (might happen when process.cwd() - // fails) - - // Normalize the tail path - resolvedTail = normalizeString( - resolvedTail, - !resolvedAbsolute, - "\\", - isPathSeparator, - ); - - return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || "."; -} - -export function normalize(path: string): string { - assertPath(path); - const len = path.length; - if (len === 0) return "."; - let rootEnd = 0; - let device: string | undefined; - let isAbsolute = false; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - // If we started with a separator, we know we at least have an absolute - // path of some kind (UNC or otherwise) - isAbsolute = true; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - // Return the normalized version of the UNC root since there - // is nothing left to process - - return `\\\\${firstPart}\\${path.slice(last)}\\`; - } else if (j !== last) { - // We matched a UNC root with leftovers - - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid unnecessary - // work - return "\\"; - } - - let tail: string; - if (rootEnd < len) { - tail = normalizeString( - path.slice(rootEnd), - !isAbsolute, - "\\", - isPathSeparator, - ); - } else { - tail = ""; - } - if (tail.length === 0 && !isAbsolute) tail = "."; - if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) { - tail += "\\"; - } - if (device === undefined) { - if (isAbsolute) { - if (tail.length > 0) return `\\${tail}`; - else return "\\"; - } else if (tail.length > 0) { - return tail; - } else { - return ""; - } - } else if (isAbsolute) { - if (tail.length > 0) return `${device}\\${tail}`; - else return `${device}\\`; - } else if (tail.length > 0) { - return device + tail; - } else { - return device; - } -} - -export function isAbsolute(path: string): boolean { - assertPath(path); - const len = path.length; - if (len === 0) return false; - - const code = path.charCodeAt(0); - if (isPathSeparator(code)) { - return true; - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (len > 2 && path.charCodeAt(1) === CHAR_COLON) { - if (isPathSeparator(path.charCodeAt(2))) return true; - } - } - return false; -} - -export function join(...paths: string[]): string { - const pathsCount = paths.length; - if (pathsCount === 0) return "."; - - let joined: string | undefined; - let firstPart: string | null = null; - for (let i = 0; i < pathsCount; ++i) { - const path = paths[i]; - assertPath(path); - if (path.length > 0) { - if (joined === undefined) joined = firstPart = path; - else joined += `\\${path}`; - } - } - - if (joined === undefined) return "."; - - // Make sure that the joined path doesn't start with two slashes, because - // normalize() will mistake it for an UNC path then. - // - // This step is skipped when it is very clear that the user actually - // intended to point at an UNC path. This is assumed when the first - // non-empty string arguments starts with exactly two slashes followed by - // at least one more non-slash character. - // - // Note that for normalize() to treat a path as an UNC path it needs to - // have at least 2 components, so we don't filter for that here. - // This means that the user can use join to construct UNC paths from - // a server name and a share name; for example: - // path.join('//server', 'share') -> '\\\\server\\share\\') - let needsReplace = true; - let slashCount = 0; - assert(firstPart != null); - if (isPathSeparator(firstPart.charCodeAt(0))) { - ++slashCount; - const firstLen = firstPart.length; - if (firstLen > 1) { - if (isPathSeparator(firstPart.charCodeAt(1))) { - ++slashCount; - if (firstLen > 2) { - if (isPathSeparator(firstPart.charCodeAt(2))) ++slashCount; - else { - // We matched a UNC path in the first part - needsReplace = false; - } - } - } - } - } - if (needsReplace) { - // Find any more consecutive slashes we need to replace - for (; slashCount < joined.length; ++slashCount) { - if (!isPathSeparator(joined.charCodeAt(slashCount))) break; - } - - // Replace the slashes if needed - if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`; - } - - return normalize(joined); -} - -// It will solve the relative path from `from` to `to`, for instance: -// from = 'C:\\orandea\\test\\aaa' -// to = 'C:\\orandea\\impl\\bbb' -// The output of the function should be: '..\\..\\impl\\bbb' -export function relative(from: string, to: string): string { - assertPath(from); - assertPath(to); - - if (from === to) return ""; - - const fromOrig = resolve(from); - const toOrig = resolve(to); - - if (fromOrig === toOrig) return ""; - - from = fromOrig.toLowerCase(); - to = toOrig.toLowerCase(); - - if (from === to) return ""; - - // Trim any leading backslashes - let fromStart = 0; - let fromEnd = from.length; - for (; fromStart < fromEnd; ++fromStart) { - if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for (; fromEnd - 1 > fromStart; --fromEnd) { - if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const fromLen = fromEnd - fromStart; - - // Trim any leading backslashes - let toStart = 0; - let toEnd = to.length; - for (; toStart < toEnd; ++toStart) { - if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for (; toEnd - 1 > toStart; --toEnd) { - if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const toLen = toEnd - toStart; - - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for (; i <= length; ++i) { - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `from` is the exact base path for `to`. - // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz' - return toOrig.slice(toStart + i + 1); - } else if (i === 2) { - // We get here if `from` is the device root. - // For example: from='C:\\'; to='C:\\foo' - return toOrig.slice(toStart + i); - } - } - if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `to` is the exact base path for `from`. - // For example: from='C:\\foo\\bar'; to='C:\\foo' - lastCommonSep = i; - } else if (i === 2) { - // We get here if `to` is the device root. - // For example: from='C:\\foo\\bar'; to='C:\\' - lastCommonSep = 3; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (fromCode === CHAR_BACKWARD_SLASH) lastCommonSep = i; - } - - // We found a mismatch before the first common path separator was seen, so - // return the original `to`. - if (i !== length && lastCommonSep === -1) { - return toOrig; - } - - let out = ""; - if (lastCommonSep === -1) lastCommonSep = 0; - // Generate the relative path based on the path difference between `to` and - // `from` - for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { - if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) { - if (out.length === 0) out += ".."; - else out += "\\.."; - } - } - - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) { - return out + toOrig.slice(toStart + lastCommonSep, toEnd); - } else { - toStart += lastCommonSep; - if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart; - return toOrig.slice(toStart, toEnd); - } -} - -export function toNamespacedPath(path: string): string { - // Note: this will *probably* throw somewhere. - if (typeof path !== "string") return path; - if (path.length === 0) return ""; - - const resolvedPath = resolve(path); - - if (resolvedPath.length >= 3) { - if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) { - // Possible UNC root - - if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) { - const code = resolvedPath.charCodeAt(2); - if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { - // Matched non-long UNC root, convert the path to a long UNC path - return `\\\\?\\UNC\\${resolvedPath.slice(2)}`; - } - } - } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) { - // Possible device root - - if ( - resolvedPath.charCodeAt(1) === CHAR_COLON && - resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH - ) { - // Matched device root, convert the path to a long UNC path - return `\\\\?\\${resolvedPath}`; - } - } - } - - return path; -} - -export function dirname(path: string): string { - assertPath(path); - const len = path.length; - if (len === 0) return "."; - let rootEnd = -1; - let end = -1; - let matchedSlash = true; - let offset = 0; - const code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - rootEnd = offset = 1; - - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - return path; - } - if (j !== last) { - // We matched a UNC root with leftovers - - // Offset by 1 to include the separator after the UNC root to - // treat it as a "normal root" on top of a (UNC) root - rootEnd = offset = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = offset = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) rootEnd = offset = 3; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - return path; - } - - for (let i = len - 1; i >= offset; --i) { - if (isPathSeparator(path.charCodeAt(i))) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) { - if (rootEnd === -1) return "."; - else end = rootEnd; - } - return path.slice(0, end); -} - -export function basename(path: string, ext = ""): string { - if (ext !== undefined && typeof ext !== "string") { - throw new TypeError('"ext" argument must be a string'); - } - - assertPath(path); - - let start = 0; - let end = -1; - let matchedSlash = true; - let i: number; - - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - if (path.length >= 2) { - const drive = path.charCodeAt(0); - if (isWindowsDeviceRoot(drive)) { - if (path.charCodeAt(1) === CHAR_COLON) start = 2; - } - } - - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { - if (ext.length === path.length && ext === path) return ""; - let extIdx = ext.length - 1; - let firstNonSlashEnd = -1; - for (i = path.length - 1; i >= start; --i) { - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else { - if (firstNonSlashEnd === -1) { - // We saw the first non-path separator, remember this index in case - // we need it if the extension ends up not matching - matchedSlash = false; - firstNonSlashEnd = i + 1; - } - if (extIdx >= 0) { - // Try to match the explicit extension - if (code === ext.charCodeAt(extIdx)) { - if (--extIdx === -1) { - // We matched the extension, so mark this as the end of our path - // component - end = i; - } - } else { - // Extension does not match, so our result is the entire path - // component - extIdx = -1; - end = firstNonSlashEnd; - } - } - } - } - - if (start === end) end = firstNonSlashEnd; - else if (end === -1) end = path.length; - return path.slice(start, end); - } else { - for (i = path.length - 1; i >= start; --i) { - if (isPathSeparator(path.charCodeAt(i))) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ""; - return path.slice(start, end); - } -} - -export function extname(path: string): string { - assertPath(path); - let start = 0; - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - - if ( - path.length >= 2 && - path.charCodeAt(1) === CHAR_COLON && - isWindowsDeviceRoot(path.charCodeAt(0)) - ) { - start = startPart = 2; - } - - for (let i = path.length - 1; i >= start; --i) { - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - return ""; - } - return path.slice(startDot, end); -} - -export function format(pathObject: FormatInputPathObject): string { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError( - `The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`, - ); - } - return _format("\\", pathObject); -} - -export function parse(path: string): ParsedPath { - assertPath(path); - - const ret: ParsedPath = { root: "", dir: "", base: "", ext: "", name: "" }; - - const len = path.length; - if (len === 0) return ret; - - let rootEnd = 0; - let code = path.charCodeAt(0); - - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - - rootEnd = 1; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for (; j < len; ++j) { - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for (; j < len; ++j) { - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - - rootEnd = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - if (len === 3) { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - rootEnd = 3; - } - } else { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - - if (rootEnd > 0) ret.root = path.slice(0, rootEnd); - - let startDot = -1; - let startPart = rootEnd; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Get non-dir info - for (; i >= rootEnd; --i) { - code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - if (end !== -1) { - ret.base = ret.name = path.slice(startPart, end); - } - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - ret.ext = path.slice(startDot, end); - } - - // If the directory is the root, use the entire root as the `dir` including - // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the - // trailing slash (`C:\abc\def` -> `C:\abc`). - if (startPart > 0 && startPart !== rootEnd) { - ret.dir = path.slice(0, startPart - 1); - } else ret.dir = ret.root; - - return ret; -} - -/** Converts a file URL to a path string. - * - * fromFileUrl("file:///home/foo"); // "\\home\\foo" - * fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo" - * fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo" - */ -export function fromFileUrl(url: string | URL): string { - url = url instanceof URL ? url : new URL(url); - if (url.protocol != "file:") { - throw new TypeError("Must be a file URL."); - } - let path = decodeURIComponent( - url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25"), - ).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); - if (url.hostname != "") { - // Note: The `URL` implementation guarantees that the drive letter and - // hostname are mutually exclusive. Otherwise it would not have been valid - // to append the hostname and path like this. - path = `\\\\${url.hostname}${path}`; - } - return path; -} - -/** Converts a path string to a file URL. - * - * toFileUrl("\\home\\foo"); // new URL("file:///home/foo") - * toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo") - * toFileUrl("\\\\localhost\\home\\foo"); // new URL("file://localhost/home/foo") - */ -export function toFileUrl(path: string): URL { - if (!isAbsolute(path)) { - throw new TypeError("Must be an absolute path."); - } - const [, hostname, pathname] = path.match( - /^(?:[/\\]{2}([^/\\]+)(?=[/\\][^/\\]))?(.*)/, - )!; - const url = new URL("file:///"); - url.pathname = pathname.replace(/%/g, "%25"); - if (hostname != null) { - url.hostname = hostname; - if (!url.hostname) { - throw new TypeError("Invalid hostname."); - } - } - return url; -} diff --git a/crates/swc_bundler/tests/.cache/deno/28ddc10bea9c284f99a9d0069dfe0114eba5e3a8.ts b/crates/swc_bundler/tests/.cache/deno/28ddc10bea9c284f99a9d0069dfe0114eba5e3a8.ts deleted file mode 100644 index 1e5bee6f6b04..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/28ddc10bea9c284f99a9d0069dfe0114eba5e3a8.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/command/commands/help.ts - - -import { IFlags } from '../../flags/lib/types.ts'; -import { Command } from '../lib/command.ts'; -import { CommandType } from '../types/command.ts'; - -/** - * Generates well formatted and colored help output for specified command. - */ -export class HelpCommand extends Command { - - public constructor( cmd?: Command ) { - super(); - this.type( 'command', new CommandType() ) - .arguments( '[command:command]' ) - .description( 'Show this help or the help of a sub-command.' ) - .action( ( flags: IFlags, name?: string ) => { - if ( !cmd ) { - cmd = name ? this.getGlobalParent()?.getBaseCommand( name ) : this.getGlobalParent(); - } - if ( !cmd ) { - throw new Error( `Failed to generate help for command '${ name }'. Command not found.` ); - } - cmd.help(); - Deno.exit( 0 ); - } ); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/28de55c65e4113976616b3871cff5973c733e391.ts b/crates/swc_bundler/tests/.cache/deno/28de55c65e4113976616b3871cff5973c733e391.ts deleted file mode 100644 index 181f576fad87..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/28de55c65e4113976616b3871cff5973c733e391.ts +++ /dev/null @@ -1,127 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/coerceInputValue.js - - -import arrayFrom from '../polyfills/arrayFrom.js'; -import objectValues from '../polyfills/objectValues.js'; -import inspect from '../jsutils/inspect.js'; -import invariant from '../jsutils/invariant.js'; -import didYouMean from '../jsutils/didYouMean.js'; -import isObjectLike from '../jsutils/isObjectLike.js'; -import isCollection from '../jsutils/isCollection.js'; -import suggestionList from '../jsutils/suggestionList.js'; -import printPathArray from '../jsutils/printPathArray.js'; -import { addPath, pathToArray } from '../jsutils/Path.js'; -import { GraphQLError } from '../error/GraphQLError.js'; -import { isLeafType, isInputObjectType, isListType, isNonNullType } from '../type/definition.js'; - -/** - * Coerces a JavaScript value given a GraphQL Input Type. - */ -export function coerceInputValue(inputValue, type, onError = defaultOnError) { - return coerceInputValueImpl(inputValue, type, onError); -} - -function defaultOnError(path, invalidValue, error) { - let errorPrefix = 'Invalid value ' + inspect(invalidValue); - - if (path.length > 0) { - errorPrefix += ` at "value${printPathArray(path)}"`; - } - - error.message = errorPrefix + ': ' + error.message; - throw error; -} - -function coerceInputValueImpl(inputValue, type, onError, path) { - if (isNonNullType(type)) { - if (inputValue != null) { - return coerceInputValueImpl(inputValue, type.ofType, onError, path); - } - - onError(pathToArray(path), inputValue, new GraphQLError(`Expected non-nullable type "${inspect(type)}" not to be null.`)); - return; - } - - if (inputValue == null) { - // Explicitly return the value null. - return null; - } - - if (isListType(type)) { - const itemType = type.ofType; - - if (isCollection(inputValue)) { - return arrayFrom(inputValue, (itemValue, index) => { - const itemPath = addPath(path, index); - return coerceInputValueImpl(itemValue, itemType, onError, itemPath); - }); - } // Lists accept a non-list value as a list of one. - - - return [coerceInputValueImpl(inputValue, itemType, onError, path)]; - } - - if (isInputObjectType(type)) { - if (!isObjectLike(inputValue)) { - onError(pathToArray(path), inputValue, new GraphQLError(`Expected type "${type.name}" to be an object.`)); - return; - } - - const coercedValue = {}; - const fieldDefs = type.getFields(); - - for (const field of objectValues(fieldDefs)) { - const fieldValue = inputValue[field.name]; - - if (fieldValue === undefined) { - if (field.defaultValue !== undefined) { - coercedValue[field.name] = field.defaultValue; - } else if (isNonNullType(field.type)) { - const typeStr = inspect(field.type); - onError(pathToArray(path), inputValue, new GraphQLError(`Field "${field.name}" of required type "${typeStr}" was not provided.`)); - } - - continue; - } - - coercedValue[field.name] = coerceInputValueImpl(fieldValue, field.type, onError, addPath(path, field.name)); - } // Ensure every provided field is defined. - - - for (const fieldName of Object.keys(inputValue)) { - if (!fieldDefs[fieldName]) { - const suggestions = suggestionList(fieldName, Object.keys(type.getFields())); - onError(pathToArray(path), inputValue, new GraphQLError(`Field "${fieldName}" is not defined by type "${type.name}".` + didYouMean(suggestions))); - } - } - - return coercedValue; - } - - if (isLeafType(type)) { - let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), - // which can throw to indicate failure. If it throws, maintain a reference - // to the original error. - - try { - parseResult = type.parseValue(inputValue); - } catch (error) { - if (error instanceof GraphQLError) { - onError(pathToArray(path), inputValue, error); - } else { - onError(pathToArray(path), inputValue, new GraphQLError(`Expected type "${type.name}". ` + error.message, undefined, undefined, undefined, undefined, error)); - } - - return; - } - - if (parseResult === undefined) { - onError(pathToArray(path), inputValue, new GraphQLError(`Expected type "${type.name}".`)); - } - - return parseResult; - } // Not reachable. All possible input types have been considered. - - - invariant(false, 'Unexpected input type: ' + inspect(type)); -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/28ebe74c8ba8647b93eddd04e0a232d66fc0d316.ts b/crates/swc_bundler/tests/.cache/deno/28ebe74c8ba8647b93eddd04e0a232d66fc0d316.ts deleted file mode 100644 index 885d9d8e319d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/28ebe74c8ba8647b93eddd04e0a232d66fc0d316.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Loaded from https://deno.land/std@0.69.0/http/mod.ts - - -export * from "./cookie.ts"; -export * from "./http_status.ts"; -export * from "./server.ts"; diff --git a/crates/swc_bundler/tests/.cache/deno/28f30a5497a7979341eebb9564b5c63c8a7ae66f.ts b/crates/swc_bundler/tests/.cache/deno/28f30a5497a7979341eebb9564b5c63c8a7ae66f.ts deleted file mode 100644 index 20db70db46e4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/28f30a5497a7979341eebb9564b5c63c8a7ae66f.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/std@0.104.0/path/common.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -import { SEP } from "./separator.ts"; - -/** Determines the common path from a set of paths, using an optional separator, - * which defaults to the OS default separator. - * - * import { common } from "https://deno.land/std/path/mod.ts"; - * const p = common([ - * "./deno/std/path/mod.ts", - * "./deno/std/fs/mod.ts", - * ]); - * console.log(p); // "./deno/std/" - * - */ -export function common(paths: string[], sep = SEP): string { - const [first = "", ...remaining] = paths; - if (first === "" || remaining.length === 0) { - return first.substring(0, first.lastIndexOf(sep) + 1); - } - const parts = first.split(sep); - - let endOfPrefix = parts.length; - for (const path of remaining) { - const compare = path.split(sep); - for (let i = 0; i < endOfPrefix; i++) { - if (compare[i] !== parts[i]) { - endOfPrefix = i; - } - } - - if (endOfPrefix === 0) { - return ""; - } - } - const prefix = parts.slice(0, endOfPrefix).join(sep); - return prefix.endsWith(sep) ? prefix : `${prefix}${sep}`; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2912a85a196c595e5785799639a6de461b24d928.ts b/crates/swc_bundler/tests/.cache/deno/2912a85a196c595e5785799639a6de461b24d928.ts deleted file mode 100644 index 28a0f6125290..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2912a85a196c595e5785799639a6de461b24d928.ts +++ /dev/null @@ -1,200 +0,0 @@ -// Loaded from https://deno.land/std@0.84.0/http/http_status.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -/** HTTP status codes */ -export enum Status { - /** RFC 7231, 6.2.1 */ - Continue = 100, - /** RFC 7231, 6.2.2 */ - SwitchingProtocols = 101, - /** RFC 2518, 10.1 */ - Processing = 102, - /** RFC 8297 **/ - EarlyHints = 103, - /** RFC 7231, 6.3.1 */ - OK = 200, - /** RFC 7231, 6.3.2 */ - Created = 201, - /** RFC 7231, 6.3.3 */ - Accepted = 202, - /** RFC 7231, 6.3.4 */ - NonAuthoritativeInfo = 203, - /** RFC 7231, 6.3.5 */ - NoContent = 204, - /** RFC 7231, 6.3.6 */ - ResetContent = 205, - /** RFC 7233, 4.1 */ - PartialContent = 206, - /** RFC 4918, 11.1 */ - MultiStatus = 207, - /** RFC 5842, 7.1 */ - AlreadyReported = 208, - /** RFC 3229, 10.4.1 */ - IMUsed = 226, - - /** RFC 7231, 6.4.1 */ - MultipleChoices = 300, - /** RFC 7231, 6.4.2 */ - MovedPermanently = 301, - /** RFC 7231, 6.4.3 */ - Found = 302, - /** RFC 7231, 6.4.4 */ - SeeOther = 303, - /** RFC 7232, 4.1 */ - NotModified = 304, - /** RFC 7231, 6.4.5 */ - UseProxy = 305, - /** RFC 7231, 6.4.7 */ - TemporaryRedirect = 307, - /** RFC 7538, 3 */ - PermanentRedirect = 308, - - /** RFC 7231, 6.5.1 */ - BadRequest = 400, - /** RFC 7235, 3.1 */ - Unauthorized = 401, - /** RFC 7231, 6.5.2 */ - PaymentRequired = 402, - /** RFC 7231, 6.5.3 */ - Forbidden = 403, - /** RFC 7231, 6.5.4 */ - NotFound = 404, - /** RFC 7231, 6.5.5 */ - MethodNotAllowed = 405, - /** RFC 7231, 6.5.6 */ - NotAcceptable = 406, - /** RFC 7235, 3.2 */ - ProxyAuthRequired = 407, - /** RFC 7231, 6.5.7 */ - RequestTimeout = 408, - /** RFC 7231, 6.5.8 */ - Conflict = 409, - /** RFC 7231, 6.5.9 */ - Gone = 410, - /** RFC 7231, 6.5.10 */ - LengthRequired = 411, - /** RFC 7232, 4.2 */ - PreconditionFailed = 412, - /** RFC 7231, 6.5.11 */ - RequestEntityTooLarge = 413, - /** RFC 7231, 6.5.12 */ - RequestURITooLong = 414, - /** RFC 7231, 6.5.13 */ - UnsupportedMediaType = 415, - /** RFC 7233, 4.4 */ - RequestedRangeNotSatisfiable = 416, - /** RFC 7231, 6.5.14 */ - ExpectationFailed = 417, - /** RFC 7168, 2.3.3 */ - Teapot = 418, - /** RFC 7540, 9.1.2 */ - MisdirectedRequest = 421, - /** RFC 4918, 11.2 */ - UnprocessableEntity = 422, - /** RFC 4918, 11.3 */ - Locked = 423, - /** RFC 4918, 11.4 */ - FailedDependency = 424, - /** RFC 8470, 5.2 */ - TooEarly = 425, - /** RFC 7231, 6.5.15 */ - UpgradeRequired = 426, - /** RFC 6585, 3 */ - PreconditionRequired = 428, - /** RFC 6585, 4 */ - TooManyRequests = 429, - /** RFC 6585, 5 */ - RequestHeaderFieldsTooLarge = 431, - /** RFC 7725, 3 */ - UnavailableForLegalReasons = 451, - - /** RFC 7231, 6.6.1 */ - InternalServerError = 500, - /** RFC 7231, 6.6.2 */ - NotImplemented = 501, - /** RFC 7231, 6.6.3 */ - BadGateway = 502, - /** RFC 7231, 6.6.4 */ - ServiceUnavailable = 503, - /** RFC 7231, 6.6.5 */ - GatewayTimeout = 504, - /** RFC 7231, 6.6.6 */ - HTTPVersionNotSupported = 505, - /** RFC 2295, 8.1 */ - VariantAlsoNegotiates = 506, - /** RFC 4918, 11.5 */ - InsufficientStorage = 507, - /** RFC 5842, 7.2 */ - LoopDetected = 508, - /** RFC 2774, 7 */ - NotExtended = 510, - /** RFC 6585, 6 */ - NetworkAuthenticationRequired = 511, -} - -export const STATUS_TEXT = new Map([ - [Status.Continue, "Continue"], - [Status.SwitchingProtocols, "Switching Protocols"], - [Status.Processing, "Processing"], - [Status.EarlyHints, "Early Hints"], - [Status.OK, "OK"], - [Status.Created, "Created"], - [Status.Accepted, "Accepted"], - [Status.NonAuthoritativeInfo, "Non-Authoritative Information"], - [Status.NoContent, "No Content"], - [Status.ResetContent, "Reset Content"], - [Status.PartialContent, "Partial Content"], - [Status.MultiStatus, "Multi-Status"], - [Status.AlreadyReported, "Already Reported"], - [Status.IMUsed, "IM Used"], - [Status.MultipleChoices, "Multiple Choices"], - [Status.MovedPermanently, "Moved Permanently"], - [Status.Found, "Found"], - [Status.SeeOther, "See Other"], - [Status.NotModified, "Not Modified"], - [Status.UseProxy, "Use Proxy"], - [Status.TemporaryRedirect, "Temporary Redirect"], - [Status.PermanentRedirect, "Permanent Redirect"], - [Status.BadRequest, "Bad Request"], - [Status.Unauthorized, "Unauthorized"], - [Status.PaymentRequired, "Payment Required"], - [Status.Forbidden, "Forbidden"], - [Status.NotFound, "Not Found"], - [Status.MethodNotAllowed, "Method Not Allowed"], - [Status.NotAcceptable, "Not Acceptable"], - [Status.ProxyAuthRequired, "Proxy Authentication Required"], - [Status.RequestTimeout, "Request Timeout"], - [Status.Conflict, "Conflict"], - [Status.Gone, "Gone"], - [Status.LengthRequired, "Length Required"], - [Status.PreconditionFailed, "Precondition Failed"], - [Status.RequestEntityTooLarge, "Request Entity Too Large"], - [Status.RequestURITooLong, "Request URI Too Long"], - [Status.UnsupportedMediaType, "Unsupported Media Type"], - [Status.RequestedRangeNotSatisfiable, "Requested Range Not Satisfiable"], - [Status.ExpectationFailed, "Expectation Failed"], - [Status.Teapot, "I'm a teapot"], - [Status.MisdirectedRequest, "Misdirected Request"], - [Status.UnprocessableEntity, "Unprocessable Entity"], - [Status.Locked, "Locked"], - [Status.FailedDependency, "Failed Dependency"], - [Status.TooEarly, "Too Early"], - [Status.UpgradeRequired, "Upgrade Required"], - [Status.PreconditionRequired, "Precondition Required"], - [Status.TooManyRequests, "Too Many Requests"], - [Status.RequestHeaderFieldsTooLarge, "Request Header Fields Too Large"], - [Status.UnavailableForLegalReasons, "Unavailable For Legal Reasons"], - [Status.InternalServerError, "Internal Server Error"], - [Status.NotImplemented, "Not Implemented"], - [Status.BadGateway, "Bad Gateway"], - [Status.ServiceUnavailable, "Service Unavailable"], - [Status.GatewayTimeout, "Gateway Timeout"], - [Status.HTTPVersionNotSupported, "HTTP Version Not Supported"], - [Status.VariantAlsoNegotiates, "Variant Also Negotiates"], - [Status.InsufficientStorage, "Insufficient Storage"], - [Status.LoopDetected, "Loop Detected"], - [Status.NotExtended, "Not Extended"], - [Status.NetworkAuthenticationRequired, "Network Authentication Required"], -]); diff --git a/crates/swc_bundler/tests/.cache/deno/2912a8bc48f5fdbaf35bfdd037b4c4ae1490c4b2.ts b/crates/swc_bundler/tests/.cache/deno/2912a8bc48f5fdbaf35bfdd037b4c4ae1490c4b2.ts deleted file mode 100644 index 2f864719c2c9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2912a8bc48f5fdbaf35bfdd037b4c4ae1490c4b2.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/emojis/emoji.ts - - -import { User } from "../users/user.ts"; - -/** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */ -export interface Emoji { - /** Emoji id */ - id: string | null; - /** Emoji name (can only be null in reaction emoji objects) */ - name: string | null; - /** Roles allowed to use this emoji */ - roles?: string[]; - /** User that created this emoji */ - user?: User; - /** Whether this emoji must be wrapped in colons */ - requireColons?: boolean; - /** Whether this emoji is managed */ - managed?: boolean; - /** Whether this emoji is animated */ - animated?: boolean; - /** Whether this emoji can be used, may be false due to loss of Server Boosts */ - available?: boolean; -} diff --git a/crates/swc_bundler/tests/.cache/deno/294a64a54f41d7b8bc5f18f4793c7afe95baec6f.ts b/crates/swc_bundler/tests/.cache/deno/294a64a54f41d7b8bc5f18f4793c7afe95baec6f.ts deleted file mode 100644 index 44b72680c143..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/294a64a54f41d7b8bc5f18f4793c7afe95baec6f.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/guilds/create_guild_ban.ts - - -/** https://discord.com/developers/docs/resources/guild#create-guild-ban */ -export interface CreateGuildBan { - /** Number of days to delete messages for (0-7) */ - deleteMessageDays?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; - /** Reason for the ban */ - reason?: string; -} diff --git a/crates/swc_bundler/tests/.cache/deno/298ac5cb1f292fbd1e88d1cb6f8a6a2f92620f4b.ts b/crates/swc_bundler/tests/.cache/deno/298ac5cb1f292fbd1e88d1cb6f8a6a2f92620f4b.ts deleted file mode 100644 index 16c86060b700..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/298ac5cb1f292fbd1e88d1cb6f8a6a2f92620f4b.ts +++ /dev/null @@ -1,721 +0,0 @@ -// Loaded from https://deno.land/std@0.84.0/io/bufio.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -// Based on https://github.com/golang/go/blob/891682/src/bufio/bufio.go -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -type Reader = Deno.Reader; -type Writer = Deno.Writer; -type WriterSync = Deno.WriterSync; -import { copy } from "../bytes/mod.ts"; -import { assert } from "../_util/assert.ts"; - -const DEFAULT_BUF_SIZE = 4096; -const MIN_BUF_SIZE = 16; -const MAX_CONSECUTIVE_EMPTY_READS = 100; -const CR = "\r".charCodeAt(0); -const LF = "\n".charCodeAt(0); - -export class BufferFullError extends Error { - name = "BufferFullError"; - constructor(public partial: Uint8Array) { - super("Buffer full"); - } -} - -export class PartialReadError extends Deno.errors.UnexpectedEof { - name = "PartialReadError"; - partial?: Uint8Array; - constructor() { - super("Encountered UnexpectedEof, data only partially read"); - } -} - -/** Result type returned by of BufReader.readLine(). */ -export interface ReadLineResult { - line: Uint8Array; - more: boolean; -} - -/** BufReader implements buffering for a Reader object. */ -export class BufReader implements Reader { - private buf!: Uint8Array; - private rd!: Reader; // Reader provided by caller. - private r = 0; // buf read position. - private w = 0; // buf write position. - private eof = false; - // private lastByte: number; - // private lastCharSize: number; - - /** return new BufReader unless r is BufReader */ - static create(r: Reader, size: number = DEFAULT_BUF_SIZE): BufReader { - return r instanceof BufReader ? r : new BufReader(r, size); - } - - constructor(rd: Reader, size: number = DEFAULT_BUF_SIZE) { - if (size < MIN_BUF_SIZE) { - size = MIN_BUF_SIZE; - } - this._reset(new Uint8Array(size), rd); - } - - /** Returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - buffered(): number { - return this.w - this.r; - } - - // Reads a new chunk into the buffer. - private async _fill(): Promise { - // Slide existing data to beginning. - if (this.r > 0) { - this.buf.copyWithin(0, this.r, this.w); - this.w -= this.r; - this.r = 0; - } - - if (this.w >= this.buf.byteLength) { - throw Error("bufio: tried to fill full buffer"); - } - - // Read new data: try a limited number of times. - for (let i = MAX_CONSECUTIVE_EMPTY_READS; i > 0; i--) { - const rr = await this.rd.read(this.buf.subarray(this.w)); - if (rr === null) { - this.eof = true; - return; - } - assert(rr >= 0, "negative read"); - this.w += rr; - if (rr > 0) { - return; - } - } - - throw new Error( - `No progress after ${MAX_CONSECUTIVE_EMPTY_READS} read() calls`, - ); - } - - /** Discards any buffered data, resets all state, and switches - * the buffered reader to read from r. - */ - reset(r: Reader): void { - this._reset(this.buf, r); - } - - private _reset(buf: Uint8Array, rd: Reader): void { - this.buf = buf; - this.rd = rd; - this.eof = false; - // this.lastByte = -1; - // this.lastCharSize = -1; - } - - /** reads data into p. - * It returns the number of bytes read into p. - * The bytes are taken from at most one Read on the underlying Reader, - * hence n may be less than len(p). - * To read exactly len(p) bytes, use io.ReadFull(b, p). - */ - async read(p: Uint8Array): Promise { - let rr: number | null = p.byteLength; - if (p.byteLength === 0) return rr; - - if (this.r === this.w) { - if (p.byteLength >= this.buf.byteLength) { - // Large read, empty buffer. - // Read directly into p to avoid copy. - const rr = await this.rd.read(p); - const nread = rr ?? 0; - assert(nread >= 0, "negative read"); - // if (rr.nread > 0) { - // this.lastByte = p[rr.nread - 1]; - // this.lastCharSize = -1; - // } - return rr; - } - - // One read. - // Do not use this.fill, which will loop. - this.r = 0; - this.w = 0; - rr = await this.rd.read(this.buf); - if (rr === 0 || rr === null) return rr; - assert(rr >= 0, "negative read"); - this.w += rr; - } - - // copy as much as we can - const copied = copy(this.buf.subarray(this.r, this.w), p, 0); - this.r += copied; - // this.lastByte = this.buf[this.r - 1]; - // this.lastCharSize = -1; - return copied; - } - - /** reads exactly `p.length` bytes into `p`. - * - * If successful, `p` is returned. - * - * If the end of the underlying stream has been reached, and there are no more - * bytes available in the buffer, `readFull()` returns `null` instead. - * - * An error is thrown if some bytes could be read, but not enough to fill `p` - * entirely before the underlying stream reported an error or EOF. Any error - * thrown will have a `partial` property that indicates the slice of the - * buffer that has been successfully filled with data. - * - * Ported from https://golang.org/pkg/io/#ReadFull - */ - async readFull(p: Uint8Array): Promise { - let bytesRead = 0; - while (bytesRead < p.length) { - try { - const rr = await this.read(p.subarray(bytesRead)); - if (rr === null) { - if (bytesRead === 0) { - return null; - } else { - throw new PartialReadError(); - } - } - bytesRead += rr; - } catch (err) { - err.partial = p.subarray(0, bytesRead); - throw err; - } - } - return p; - } - - /** Returns the next byte [0, 255] or `null`. */ - async readByte(): Promise { - while (this.r === this.w) { - if (this.eof) return null; - await this._fill(); // buffer is empty. - } - const c = this.buf[this.r]; - this.r++; - // this.lastByte = c; - return c; - } - - /** readString() reads until the first occurrence of delim in the input, - * returning a string containing the data up to and including the delimiter. - * If ReadString encounters an error before finding a delimiter, - * it returns the data read before the error and the error itself - * (often `null`). - * ReadString returns err != nil if and only if the returned data does not end - * in delim. - * For simple uses, a Scanner may be more convenient. - */ - async readString(delim: string): Promise { - if (delim.length !== 1) { - throw new Error("Delimiter should be a single character"); - } - const buffer = await this.readSlice(delim.charCodeAt(0)); - if (buffer === null) return null; - return new TextDecoder().decode(buffer); - } - - /** `readLine()` is a low-level line-reading primitive. Most callers should - * use `readString('\n')` instead or use a Scanner. - * - * `readLine()` tries to return a single line, not including the end-of-line - * bytes. If the line was too long for the buffer then `more` is set and the - * beginning of the line is returned. The rest of the line will be returned - * from future calls. `more` will be false when returning the last fragment - * of the line. The returned buffer is only valid until the next call to - * `readLine()`. - * - * The text returned from ReadLine does not include the line end ("\r\n" or - * "\n"). - * - * When the end of the underlying stream is reached, the final bytes in the - * stream are returned. No indication or error is given if the input ends - * without a final line end. When there are no more trailing bytes to read, - * `readLine()` returns `null`. - * - * Calling `unreadByte()` after `readLine()` will always unread the last byte - * read (possibly a character belonging to the line end) even if that byte is - * not part of the line returned by `readLine()`. - */ - async readLine(): Promise { - let line: Uint8Array | null; - - try { - line = await this.readSlice(LF); - } catch (err) { - let { partial } = err; - assert( - partial instanceof Uint8Array, - "bufio: caught error from `readSlice()` without `partial` property", - ); - - // Don't throw if `readSlice()` failed with `BufferFullError`, instead we - // just return whatever is available and set the `more` flag. - if (!(err instanceof BufferFullError)) { - throw err; - } - - // Handle the case where "\r\n" straddles the buffer. - if ( - !this.eof && - partial.byteLength > 0 && - partial[partial.byteLength - 1] === CR - ) { - // Put the '\r' back on buf and drop it from line. - // Let the next call to ReadLine check for "\r\n". - assert(this.r > 0, "bufio: tried to rewind past start of buffer"); - this.r--; - partial = partial.subarray(0, partial.byteLength - 1); - } - - return { line: partial, more: !this.eof }; - } - - if (line === null) { - return null; - } - - if (line.byteLength === 0) { - return { line, more: false }; - } - - if (line[line.byteLength - 1] == LF) { - let drop = 1; - if (line.byteLength > 1 && line[line.byteLength - 2] === CR) { - drop = 2; - } - line = line.subarray(0, line.byteLength - drop); - } - return { line, more: false }; - } - - /** `readSlice()` reads until the first occurrence of `delim` in the input, - * returning a slice pointing at the bytes in the buffer. The bytes stop - * being valid at the next read. - * - * If `readSlice()` encounters an error before finding a delimiter, or the - * buffer fills without finding a delimiter, it throws an error with a - * `partial` property that contains the entire buffer. - * - * If `readSlice()` encounters the end of the underlying stream and there are - * any bytes left in the buffer, the rest of the buffer is returned. In other - * words, EOF is always treated as a delimiter. Once the buffer is empty, - * it returns `null`. - * - * Because the data returned from `readSlice()` will be overwritten by the - * next I/O operation, most clients should use `readString()` instead. - */ - async readSlice(delim: number): Promise { - let s = 0; // search start index - let slice: Uint8Array | undefined; - - while (true) { - // Search buffer. - let i = this.buf.subarray(this.r + s, this.w).indexOf(delim); - if (i >= 0) { - i += s; - slice = this.buf.subarray(this.r, this.r + i + 1); - this.r += i + 1; - break; - } - - // EOF? - if (this.eof) { - if (this.r === this.w) { - return null; - } - slice = this.buf.subarray(this.r, this.w); - this.r = this.w; - break; - } - - // Buffer full? - if (this.buffered() >= this.buf.byteLength) { - this.r = this.w; - // #4521 The internal buffer should not be reused across reads because it causes corruption of data. - const oldbuf = this.buf; - const newbuf = this.buf.slice(0); - this.buf = newbuf; - throw new BufferFullError(oldbuf); - } - - s = this.w - this.r; // do not rescan area we scanned before - - // Buffer is not full. - try { - await this._fill(); - } catch (err) { - err.partial = slice; - throw err; - } - } - - // Handle last byte, if any. - // const i = slice.byteLength - 1; - // if (i >= 0) { - // this.lastByte = slice[i]; - // this.lastCharSize = -1 - // } - - return slice; - } - - /** `peek()` returns the next `n` bytes without advancing the reader. The - * bytes stop being valid at the next read call. - * - * When the end of the underlying stream is reached, but there are unread - * bytes left in the buffer, those bytes are returned. If there are no bytes - * left in the buffer, it returns `null`. - * - * If an error is encountered before `n` bytes are available, `peek()` throws - * an error with the `partial` property set to a slice of the buffer that - * contains the bytes that were available before the error occurred. - */ - async peek(n: number): Promise { - if (n < 0) { - throw Error("negative count"); - } - - let avail = this.w - this.r; - while (avail < n && avail < this.buf.byteLength && !this.eof) { - try { - await this._fill(); - } catch (err) { - err.partial = this.buf.subarray(this.r, this.w); - throw err; - } - avail = this.w - this.r; - } - - if (avail === 0 && this.eof) { - return null; - } else if (avail < n && this.eof) { - return this.buf.subarray(this.r, this.r + avail); - } else if (avail < n) { - throw new BufferFullError(this.buf.subarray(this.r, this.w)); - } - - return this.buf.subarray(this.r, this.r + n); - } -} - -abstract class AbstractBufBase { - buf!: Uint8Array; - usedBufferBytes = 0; - err: Error | null = null; - - /** Size returns the size of the underlying buffer in bytes. */ - size(): number { - return this.buf.byteLength; - } - - /** Returns how many bytes are unused in the buffer. */ - available(): number { - return this.buf.byteLength - this.usedBufferBytes; - } - - /** buffered returns the number of bytes that have been written into the - * current buffer. - */ - buffered(): number { - return this.usedBufferBytes; - } -} - -/** BufWriter implements buffering for an deno.Writer object. - * If an error occurs writing to a Writer, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.Writer. - */ -export class BufWriter extends AbstractBufBase implements Writer { - /** return new BufWriter unless writer is BufWriter */ - static create(writer: Writer, size: number = DEFAULT_BUF_SIZE): BufWriter { - return writer instanceof BufWriter ? writer : new BufWriter(writer, size); - } - - constructor(private writer: Writer, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: Writer): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.Writer. */ - async flush(): Promise { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - await Deno.writeAll( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - async write(data: Uint8Array): Promise { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = await this.writer.write(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - await this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** BufWriterSync implements buffering for a deno.WriterSync object. - * If an error occurs writing to a WriterSync, no more data will be - * accepted and all subsequent writes, and flush(), will return the error. - * After all data has been written, the client should call the - * flush() method to guarantee all data has been forwarded to - * the underlying deno.WriterSync. - */ -export class BufWriterSync extends AbstractBufBase implements WriterSync { - /** return new BufWriterSync unless writer is BufWriterSync */ - static create( - writer: WriterSync, - size: number = DEFAULT_BUF_SIZE, - ): BufWriterSync { - return writer instanceof BufWriterSync - ? writer - : new BufWriterSync(writer, size); - } - - constructor(private writer: WriterSync, size: number = DEFAULT_BUF_SIZE) { - super(); - if (size <= 0) { - size = DEFAULT_BUF_SIZE; - } - this.buf = new Uint8Array(size); - } - - /** Discards any unflushed buffered data, clears any error, and - * resets buffer to write its output to w. - */ - reset(w: WriterSync): void { - this.err = null; - this.usedBufferBytes = 0; - this.writer = w; - } - - /** Flush writes any buffered data to the underlying io.WriterSync. */ - flush(): void { - if (this.err !== null) throw this.err; - if (this.usedBufferBytes === 0) return; - - try { - Deno.writeAllSync( - this.writer, - this.buf.subarray(0, this.usedBufferBytes), - ); - } catch (e) { - this.err = e; - throw e; - } - - this.buf = new Uint8Array(this.buf.length); - this.usedBufferBytes = 0; - } - - /** Writes the contents of `data` into the buffer. If the contents won't fully - * fit into the buffer, those bytes that can are copied into the buffer, the - * buffer is the flushed to the writer and the remaining bytes are copied into - * the now empty buffer. - * - * @return the number of bytes written to the buffer. - */ - writeSync(data: Uint8Array): number { - if (this.err !== null) throw this.err; - if (data.length === 0) return 0; - - let totalBytesWritten = 0; - let numBytesWritten = 0; - while (data.byteLength > this.available()) { - if (this.buffered() === 0) { - // Large write, empty buffer. - // Write directly from data to avoid copy. - try { - numBytesWritten = this.writer.writeSync(data); - } catch (e) { - this.err = e; - throw e; - } - } else { - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - this.flush(); - } - totalBytesWritten += numBytesWritten; - data = data.subarray(numBytesWritten); - } - - numBytesWritten = copy(data, this.buf, this.usedBufferBytes); - this.usedBufferBytes += numBytesWritten; - totalBytesWritten += numBytesWritten; - return totalBytesWritten; - } -} - -/** Generate longest proper prefix which is also suffix array. */ -function createLPS(pat: Uint8Array): Uint8Array { - const lps = new Uint8Array(pat.length); - lps[0] = 0; - let prefixEnd = 0; - let i = 1; - while (i < lps.length) { - if (pat[i] == pat[prefixEnd]) { - prefixEnd++; - lps[i] = prefixEnd; - i++; - } else if (prefixEnd === 0) { - lps[i] = 0; - i++; - } else { - prefixEnd = pat[prefixEnd - 1]; - } - } - return lps; -} - -/** Read delimited bytes from a Reader. */ -export async function* readDelim( - reader: Reader, - delim: Uint8Array, -): AsyncIterableIterator { - // Avoid unicode problems - const delimLen = delim.length; - const delimLPS = createLPS(delim); - - let inputBuffer = new Deno.Buffer(); - const inspectArr = new Uint8Array(Math.max(1024, delimLen + 1)); - - // Modified KMP - let inspectIndex = 0; - let matchIndex = 0; - while (true) { - const result = await reader.read(inspectArr); - if (result === null) { - // Yield last chunk. - yield inputBuffer.bytes(); - return; - } - if ((result as number) < 0) { - // Discard all remaining and silently fail. - return; - } - const sliceRead = inspectArr.subarray(0, result as number); - await Deno.writeAll(inputBuffer, sliceRead); - - let sliceToProcess = inputBuffer.bytes(); - while (inspectIndex < sliceToProcess.length) { - if (sliceToProcess[inspectIndex] === delim[matchIndex]) { - inspectIndex++; - matchIndex++; - if (matchIndex === delimLen) { - // Full match - const matchEnd = inspectIndex - delimLen; - const readyBytes = sliceToProcess.subarray(0, matchEnd); - // Copy - const pendingBytes = sliceToProcess.slice(inspectIndex); - yield readyBytes; - // Reset match, different from KMP. - sliceToProcess = pendingBytes; - inspectIndex = 0; - matchIndex = 0; - } - } else { - if (matchIndex === 0) { - inspectIndex++; - } else { - matchIndex = delimLPS[matchIndex - 1]; - } - } - } - // Keep inspectIndex and matchIndex. - inputBuffer = new Deno.Buffer(sliceToProcess); - } -} - -/** Read delimited strings from a Reader. */ -export async function* readStringDelim( - reader: Reader, - delim: string, -): AsyncIterableIterator { - const encoder = new TextEncoder(); - const decoder = new TextDecoder(); - for await (const chunk of readDelim(reader, encoder.encode(delim))) { - yield decoder.decode(chunk); - } -} - -/** Read strings line-by-line from a Reader. */ -export async function* readLines( - reader: Reader, -): AsyncIterableIterator { - for await (let chunk of readStringDelim(reader, "\n")) { - // Finding a CR at the end of the line is evidence of a - // "\r\n" at the end of the line. The "\r" part should be - // removed too. - if (chunk.endsWith("\r")) { - chunk = chunk.slice(0, -1); - } - yield chunk; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/29e96043b98c596a88a9ecb45fc25c9e62e292d0.ts b/crates/swc_bundler/tests/.cache/deno/29e96043b98c596a88a9ecb45fc25c9e62e292d0.ts deleted file mode 100644 index c6ef006a926c..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/29e96043b98c596a88a9ecb45fc25c9e62e292d0.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/intersperse.js - - -import _checkForMethod from './internal/_checkForMethod.js'; -import _curry2 from './internal/_curry2.js'; - - -/** - * Creates a new list with the separator interposed between elements. - * - * Dispatches to the `intersperse` method of the second argument, if present. - * - * @func - * @memberOf R - * @since v0.14.0 - * @category List - * @sig a -> [a] -> [a] - * @param {*} separator The element to add to the list. - * @param {Array} list The list to be interposed. - * @return {Array} The new list. - * @example - * - * R.intersperse('a', ['b', 'n', 'n', 's']); //=> ['b', 'a', 'n', 'a', 'n', 'a', 's'] - */ -var intersperse = _curry2(_checkForMethod('intersperse', function intersperse(separator, list) { - var out = []; - var idx = 0; - var length = list.length; - while (idx < length) { - if (idx === length - 1) { - out.push(list[idx]); - } else { - out.push(list[idx], separator); - } - idx += 1; - } - return out; -})); -export default intersperse; diff --git a/crates/swc_bundler/tests/.cache/deno/29fb2fe171192a3a2955dbd76d5cccf928f1b6b8.ts b/crates/swc_bundler/tests/.cache/deno/29fb2fe171192a3a2955dbd76d5cccf928f1b6b8.ts deleted file mode 100644 index dc7bb17d5ce6..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/29fb2fe171192a3a2955dbd76d5cccf928f1b6b8.ts +++ /dev/null @@ -1,510 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/path/posix.ts - - -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. - -import type { FormatInputPathObject, ParsedPath } from "./_interface.ts"; -import { CHAR_DOT, CHAR_FORWARD_SLASH } from "./_constants.ts"; - -import { - _format, - assertPath, - encodeWhitespace, - isPosixPathSeparator, - normalizeString, -} from "./_util.ts"; - -export const sep = "/"; -export const delimiter = ":"; - -// path.resolve([from ...], to) -/** - * Resolves `pathSegments` into an absolute path. - * @param pathSegments an array of path segments - */ -export function resolve(...pathSegments: string[]): string { - let resolvedPath = ""; - let resolvedAbsolute = false; - - for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - let path: string; - - if (i >= 0) path = pathSegments[i]; - else { - if (globalThis.Deno == null) { - throw new TypeError("Resolved a relative path without a CWD."); - } - path = Deno.cwd(); - } - - assertPath(path); - - // Skip empty entries - if (path.length === 0) { - continue; - } - - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeString( - resolvedPath, - !resolvedAbsolute, - "/", - isPosixPathSeparator, - ); - - if (resolvedAbsolute) { - if (resolvedPath.length > 0) return `/${resolvedPath}`; - else return "/"; - } else if (resolvedPath.length > 0) return resolvedPath; - else return "."; -} - -/** - * Normalize the `path`, resolving `'..'` and `'.'` segments. - * @param path to be normalized - */ -export function normalize(path: string): string { - assertPath(path); - - if (path.length === 0) return "."; - - const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - const trailingSeparator = - path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH; - - // Normalize the path - path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator); - - if (path.length === 0 && !isAbsolute) path = "."; - if (path.length > 0 && trailingSeparator) path += "/"; - - if (isAbsolute) return `/${path}`; - return path; -} - -/** - * Verifies whether provided path is absolute - * @param path to be verified as absolute - */ -export function isAbsolute(path: string): boolean { - assertPath(path); - return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH; -} - -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * @param paths to be joined and normalized - */ -export function join(...paths: string[]): string { - if (paths.length === 0) return "."; - let joined: string | undefined; - for (let i = 0, len = paths.length; i < len; ++i) { - const path = paths[i]; - assertPath(path); - if (path.length > 0) { - if (!joined) joined = path; - else joined += `/${path}`; - } - } - if (!joined) return "."; - return normalize(joined); -} - -/** - * Return the relative path from `from` to `to` based on current working directory. - * @param from path in current working directory - * @param to path in current working directory - */ -export function relative(from: string, to: string): string { - assertPath(from); - assertPath(to); - - if (from === to) return ""; - - from = resolve(from); - to = resolve(to); - - if (from === to) return ""; - - // Trim any leading backslashes - let fromStart = 1; - const fromEnd = from.length; - for (; fromStart < fromEnd; ++fromStart) { - if (from.charCodeAt(fromStart) !== CHAR_FORWARD_SLASH) break; - } - const fromLen = fromEnd - fromStart; - - // Trim any leading backslashes - let toStart = 1; - const toEnd = to.length; - for (; toStart < toEnd; ++toStart) { - if (to.charCodeAt(toStart) !== CHAR_FORWARD_SLASH) break; - } - const toLen = toEnd - toStart; - - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for (; i <= length; ++i) { - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) { - // We get here if `from` is the exact base path for `to`. - // For example: from='/foo/bar'; to='/foo/bar/baz' - return to.slice(toStart + i + 1); - } else if (i === 0) { - // We get here if `from` is the root - // For example: from='/'; to='/foo' - return to.slice(toStart + i); - } - } else if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) { - // We get here if `to` is the exact base path for `from`. - // For example: from='/foo/bar/baz'; to='/foo/bar' - lastCommonSep = i; - } else if (i === 0) { - // We get here if `to` is the root. - // For example: from='/foo'; to='/' - lastCommonSep = 0; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (fromCode === CHAR_FORWARD_SLASH) lastCommonSep = i; - } - - let out = ""; - // Generate the relative path based on the path difference between `to` - // and `from` - for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { - if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) { - if (out.length === 0) out += ".."; - else out += "/.."; - } - } - - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) return out + to.slice(toStart + lastCommonSep); - else { - toStart += lastCommonSep; - if (to.charCodeAt(toStart) === CHAR_FORWARD_SLASH) ++toStart; - return to.slice(toStart); - } -} - -/** - * Resolves path to a namespace path - * @param path to resolve to namespace - */ -export function toNamespacedPath(path: string): string { - // Non-op on posix systems - return path; -} - -/** - * Return the directory name of a `path`. - * @param path to determine name for - */ -export function dirname(path: string): string { - assertPath(path); - if (path.length === 0) return "."; - const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - let end = -1; - let matchedSlash = true; - for (let i = path.length - 1; i >= 1; --i) { - if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) return hasRoot ? "/" : "."; - if (hasRoot && end === 1) return "//"; - return path.slice(0, end); -} - -/** - * Return the last portion of a `path`. Trailing directory separators are ignored. - * @param path to process - * @param ext of path directory - */ -export function basename(path: string, ext = ""): string { - if (ext !== undefined && typeof ext !== "string") { - throw new TypeError('"ext" argument must be a string'); - } - assertPath(path); - - let start = 0; - let end = -1; - let matchedSlash = true; - let i: number; - - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { - if (ext.length === path.length && ext === path) return ""; - let extIdx = ext.length - 1; - let firstNonSlashEnd = -1; - for (i = path.length - 1; i >= 0; --i) { - const code = path.charCodeAt(i); - if (code === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else { - if (firstNonSlashEnd === -1) { - // We saw the first non-path separator, remember this index in case - // we need it if the extension ends up not matching - matchedSlash = false; - firstNonSlashEnd = i + 1; - } - if (extIdx >= 0) { - // Try to match the explicit extension - if (code === ext.charCodeAt(extIdx)) { - if (--extIdx === -1) { - // We matched the extension, so mark this as the end of our path - // component - end = i; - } - } else { - // Extension does not match, so our result is the entire path - // component - extIdx = -1; - end = firstNonSlashEnd; - } - } - } - } - - if (start === end) end = firstNonSlashEnd; - else if (end === -1) end = path.length; - return path.slice(start, end); - } else { - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ""; - return path.slice(start, end); - } -} - -/** - * Return the extension of the `path`. - * @param path with extension - */ -export function extname(path: string): string { - assertPath(path); - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - for (let i = path.length - 1; i >= 0; --i) { - const code = path.charCodeAt(i); - if (code === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - return ""; - } - return path.slice(startDot, end); -} - -/** - * Generate a path from `FormatInputPathObject` object. - * @param pathObject with path - */ -export function format(pathObject: FormatInputPathObject): string { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError( - `The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`, - ); - } - return _format("/", pathObject); -} - -/** - * Return a `ParsedPath` object of the `path`. - * @param path to process - */ -export function parse(path: string): ParsedPath { - assertPath(path); - - const ret: ParsedPath = { root: "", dir: "", base: "", ext: "", name: "" }; - if (path.length === 0) return ret; - const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH; - let start: number; - if (isAbsolute) { - ret.root = "/"; - start = 1; - } else { - start = 0; - } - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - - // Get non-dir info - for (; i >= start; --i) { - const code = path.charCodeAt(i); - if (code === CHAR_FORWARD_SLASH) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if ( - startDot === -1 || - end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) - ) { - if (end !== -1) { - if (startPart === 0 && isAbsolute) { - ret.base = ret.name = path.slice(1, end); - } else { - ret.base = ret.name = path.slice(startPart, end); - } - } - } else { - if (startPart === 0 && isAbsolute) { - ret.name = path.slice(1, startDot); - ret.base = path.slice(1, end); - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - } - ret.ext = path.slice(startDot, end); - } - - if (startPart > 0) ret.dir = path.slice(0, startPart - 1); - else if (isAbsolute) ret.dir = "/"; - - return ret; -} - -/** - * Converts a file URL to a path string. - * - * fromFileUrl("file:///home/foo"); // "/home/foo" - * @param url of a file URL - */ -export function fromFileUrl(url: string | URL): string { - url = url instanceof URL ? url : new URL(url); - if (url.protocol != "file:") { - throw new TypeError("Must be a file URL."); - } - return decodeURIComponent( - url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"), - ); -} - -/** - * Converts a path string to a file URL. - * - * toFileUrl("/home/foo"); // new URL("file:///home/foo") - * @param path to convert to file URL - */ -export function toFileUrl(path: string): URL { - if (!isAbsolute(path)) { - throw new TypeError("Must be an absolute path."); - } - const url = new URL("file:///"); - url.pathname = encodeWhitespace( - path.replace(/%/g, "%25").replace(/\\/g, "%5C"), - ); - return url; -} diff --git a/crates/swc_bundler/tests/.cache/deno/29fe1d6a6c6f95c62987b34fe56254f99d87d067.ts b/crates/swc_bundler/tests/.cache/deno/29fe1d6a6c6f95c62987b34fe56254f99d87d067.ts deleted file mode 100644 index 3b41b2458c4b..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/29fe1d6a6c6f95c62987b34fe56254f99d87d067.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Loaded from https://deno.land/x/cliffy@v0.12.1/packages/command/types/child-command.ts - - -import { Command } from '../lib/command.ts'; -import { StringType } from './string.ts'; - -// @TODO: add exclude option - -export class ChildCommandType extends StringType { - - #cmd?: Command; - - constructor( cmd?: Command ) { - super(); - this.#cmd = cmd; - } - - public complete( cmd: Command ): string[] { - return ( this.#cmd ?? cmd )?.getCommands( false ) - .map( ( cmd: Command ) => cmd.getName() ) || []; - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/2a148ed2236f95bf3d312375264d5b808491bbb3.ts b/crates/swc_bundler/tests/.cache/deno/2a148ed2236f95bf3d312375264d5b808491bbb3.ts deleted file mode 100644 index c2a7b6178296..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2a148ed2236f95bf3d312375264d5b808491bbb3.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/applyTo.js - - -import _curry2 from './internal/_curry2.js'; - -/** - * Takes a value and applies a function to it. - * - * This function is also known as the `thrush` combinator. - * - * @func - * @memberOf R - * @since v0.25.0 - * @category Function - * @sig a -> (a -> b) -> b - * @param {*} x The value - * @param {Function} f The function to apply - * @return {*} The result of applying `f` to `x` - * @example - * - * const t42 = R.applyTo(42); - * t42(R.identity); //=> 42 - * t42(R.add(1)); //=> 43 - */ -var applyTo = _curry2(function applyTo(x, f) { return f(x); }); -export default applyTo; diff --git a/crates/swc_bundler/tests/.cache/deno/2a49ade11cb9979e607b3f10474f75c7bb9b8683.ts b/crates/swc_bundler/tests/.cache/deno/2a49ade11cb9979e607b3f10474f75c7bb9b8683.ts deleted file mode 100644 index b80680349eb4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2a49ade11cb9979e607b3f10474f75c7bb9b8683.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Loaded from https://deno.land/std@0.85.0/encoding/base64.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -// deno-fmt-ignore -const base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", - "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", - "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", - "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", "+", "/"]; - -/** - * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 - * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation - * @param data - */ -export function encode(data: ArrayBuffer | string): string { - const uint8 = - typeof data === "string" - ? new TextEncoder().encode(data) - : data instanceof Uint8Array - ? data - : new Uint8Array(data); - let result = "", - i; - const l = uint8.length; - for (i = 2; i < l; i += 3) { - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; - result += base64abc[((uint8[i - 1] & 0x0f) << 2) | (uint8[i] >> 6)]; - result += base64abc[uint8[i] & 0x3f]; - } - if (i === l + 1) { - // 1 octet yet to write - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[(uint8[i - 2] & 0x03) << 4]; - result += "=="; - } - if (i === l) { - // 2 octets yet to write - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; - result += base64abc[(uint8[i - 1] & 0x0f) << 2]; - result += "="; - } - return result; -} - -/** - * Decodes a given RFC4648 base64 encoded string - * @param b64 - */ -export function decode(b64: string): Uint8Array { - const binString = atob(b64); - const size = binString.length; - const bytes = new Uint8Array(size); - for (let i = 0; i < size; i++) { - bytes[i] = binString.charCodeAt(i); - } - return bytes; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2a4f10b4b743fbf437d81567a8a0af2ab149a14a.ts b/crates/swc_bundler/tests/.cache/deno/2a4f10b4b743fbf437d81567a8a0af2ab149a14a.ts deleted file mode 100644 index 42d3d18136ea..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2a4f10b4b743fbf437d81567a8a0af2ab149a14a.ts +++ /dev/null @@ -1,597 +0,0 @@ -// Loaded from https://deno.land/std/datetime/formatter.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { - CallbackResult, - ReceiverResult, - Rule, - TestFunction, - TestResult, - Tokenizer, -} from "./tokenizer.ts"; - -function digits(value: string | number, count = 2): string { - return String(value).padStart(count, "0"); -} - -// as declared as in namespace Intl -type DateTimeFormatPartTypes = - | "day" - | "dayPeriod" - // | "era" - | "hour" - | "literal" - | "minute" - | "month" - | "second" - | "timeZoneName" - // | "weekday" - | "year" - | "fractionalSecond"; - -interface DateTimeFormatPart { - type: DateTimeFormatPartTypes; - value: string; -} - -type TimeZone = "UTC"; - -interface Options { - timeZone?: TimeZone; -} - -function createLiteralTestFunction(value: string): TestFunction { - return (string: string): TestResult => { - return string.startsWith(value) - ? { value, length: value.length } - : undefined; - }; -} - -function createMatchTestFunction(match: RegExp): TestFunction { - return (string: string): TestResult => { - const result = match.exec(string); - if (result) return { value: result, length: result[0].length }; - }; -} - -// according to unicode symbols (http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) -const defaultRules = [ - { - test: createLiteralTestFunction("yyyy"), - fn: (): CallbackResult => ({ type: "year", value: "numeric" }), - }, - { - test: createLiteralTestFunction("yy"), - fn: (): CallbackResult => ({ type: "year", value: "2-digit" }), - }, - - { - test: createLiteralTestFunction("MM"), - fn: (): CallbackResult => ({ type: "month", value: "2-digit" }), - }, - { - test: createLiteralTestFunction("M"), - fn: (): CallbackResult => ({ type: "month", value: "numeric" }), - }, - { - test: createLiteralTestFunction("dd"), - fn: (): CallbackResult => ({ type: "day", value: "2-digit" }), - }, - { - test: createLiteralTestFunction("d"), - fn: (): CallbackResult => ({ type: "day", value: "numeric" }), - }, - - { - test: createLiteralTestFunction("HH"), - fn: (): CallbackResult => ({ type: "hour", value: "2-digit" }), - }, - { - test: createLiteralTestFunction("H"), - fn: (): CallbackResult => ({ type: "hour", value: "numeric" }), - }, - { - test: createLiteralTestFunction("hh"), - fn: (): CallbackResult => ({ - type: "hour", - value: "2-digit", - hour12: true, - }), - }, - { - test: createLiteralTestFunction("h"), - fn: (): CallbackResult => ({ - type: "hour", - value: "numeric", - hour12: true, - }), - }, - { - test: createLiteralTestFunction("mm"), - fn: (): CallbackResult => ({ type: "minute", value: "2-digit" }), - }, - { - test: createLiteralTestFunction("m"), - fn: (): CallbackResult => ({ type: "minute", value: "numeric" }), - }, - { - test: createLiteralTestFunction("ss"), - fn: (): CallbackResult => ({ type: "second", value: "2-digit" }), - }, - { - test: createLiteralTestFunction("s"), - fn: (): CallbackResult => ({ type: "second", value: "numeric" }), - }, - { - test: createLiteralTestFunction("SSS"), - fn: (): CallbackResult => ({ type: "fractionalSecond", value: 3 }), - }, - { - test: createLiteralTestFunction("SS"), - fn: (): CallbackResult => ({ type: "fractionalSecond", value: 2 }), - }, - { - test: createLiteralTestFunction("S"), - fn: (): CallbackResult => ({ type: "fractionalSecond", value: 1 }), - }, - - { - test: createLiteralTestFunction("a"), - fn: (value: unknown): CallbackResult => ({ - type: "dayPeriod", - value: value as string, - }), - }, - - // quoted literal - { - test: createMatchTestFunction(/^(')(?\\.|[^\']*)\1/), - fn: (match: unknown): CallbackResult => ({ - type: "literal", - value: (match as RegExpExecArray).groups!.value as string, - }), - }, - // literal - { - test: createMatchTestFunction(/^.+?\s*/), - fn: (match: unknown): CallbackResult => ({ - type: "literal", - value: (match as RegExpExecArray)[0], - }), - }, -]; - -type FormatPart = { - type: DateTimeFormatPartTypes; - value: string | number; - hour12?: boolean; -}; -type Format = FormatPart[]; - -export class DateTimeFormatter { - #format: Format; - - constructor(formatString: string, rules: Rule[] = defaultRules) { - const tokenizer = new Tokenizer(rules); - this.#format = tokenizer.tokenize( - formatString, - ({ type, value, hour12 }) => { - const result = { - type, - value, - } as unknown as ReceiverResult; - if (hour12) result.hour12 = hour12 as boolean; - return result; - }, - ) as Format; - } - - format(date: Date, options: Options = {}): string { - let string = ""; - - const utc = options.timeZone === "UTC"; - - for (const token of this.#format) { - const type = token.type; - - switch (type) { - case "year": { - const value = utc ? date.getUTCFullYear() : date.getFullYear(); - switch (token.value) { - case "numeric": { - string += value; - break; - } - case "2-digit": { - string += digits(value, 2).slice(-2); - break; - } - default: - throw Error( - `FormatterError: value "${token.value}" is not supported`, - ); - } - break; - } - case "month": { - const value = (utc ? date.getUTCMonth() : date.getMonth()) + 1; - switch (token.value) { - case "numeric": { - string += value; - break; - } - case "2-digit": { - string += digits(value, 2); - break; - } - default: - throw Error( - `FormatterError: value "${token.value}" is not supported`, - ); - } - break; - } - case "day": { - const value = utc ? date.getUTCDate() : date.getDate(); - switch (token.value) { - case "numeric": { - string += value; - break; - } - case "2-digit": { - string += digits(value, 2); - break; - } - default: - throw Error( - `FormatterError: value "${token.value}" is not supported`, - ); - } - break; - } - case "hour": { - let value = utc ? date.getUTCHours() : date.getHours(); - value -= token.hour12 && date.getHours() > 12 ? 12 : 0; - switch (token.value) { - case "numeric": { - string += value; - break; - } - case "2-digit": { - string += digits(value, 2); - break; - } - default: - throw Error( - `FormatterError: value "${token.value}" is not supported`, - ); - } - break; - } - case "minute": { - const value = utc ? date.getUTCMinutes() : date.getMinutes(); - switch (token.value) { - case "numeric": { - string += value; - break; - } - case "2-digit": { - string += digits(value, 2); - break; - } - default: - throw Error( - `FormatterError: value "${token.value}" is not supported`, - ); - } - break; - } - case "second": { - const value = utc ? date.getUTCSeconds() : date.getSeconds(); - switch (token.value) { - case "numeric": { - string += value; - break; - } - case "2-digit": { - string += digits(value, 2); - break; - } - default: - throw Error( - `FormatterError: value "${token.value}" is not supported`, - ); - } - break; - } - case "fractionalSecond": { - const value = utc - ? date.getUTCMilliseconds() - : date.getMilliseconds(); - string += digits(value, Number(token.value)); - break; - } - // FIXME(bartlomieju) - case "timeZoneName": { - // string += utc ? "Z" : token.value - break; - } - case "dayPeriod": { - string += token.value ? (date.getHours() >= 12 ? "PM" : "AM") : ""; - break; - } - case "literal": { - string += token.value; - break; - } - - default: - throw Error(`FormatterError: { ${token.type} ${token.value} }`); - } - } - - return string; - } - - parseToParts(string: string): DateTimeFormatPart[] { - const parts: DateTimeFormatPart[] = []; - - for (const token of this.#format) { - const type = token.type; - - let value = ""; - switch (token.type) { - case "year": { - switch (token.value) { - case "numeric": { - value = /^\d{1,4}/.exec(string)?.[0] as string; - break; - } - case "2-digit": { - value = /^\d{1,2}/.exec(string)?.[0] as string; - break; - } - } - break; - } - case "month": { - switch (token.value) { - case "numeric": { - value = /^\d{1,2}/.exec(string)?.[0] as string; - break; - } - case "2-digit": { - value = /^\d{2}/.exec(string)?.[0] as string; - break; - } - case "narrow": { - value = /^[a-zA-Z]+/.exec(string)?.[0] as string; - break; - } - case "short": { - value = /^[a-zA-Z]+/.exec(string)?.[0] as string; - break; - } - case "long": { - value = /^[a-zA-Z]+/.exec(string)?.[0] as string; - break; - } - default: - throw Error( - `ParserError: value "${token.value}" is not supported`, - ); - } - break; - } - case "day": { - switch (token.value) { - case "numeric": { - value = /^\d{1,2}/.exec(string)?.[0] as string; - break; - } - case "2-digit": { - value = /^\d{2}/.exec(string)?.[0] as string; - break; - } - default: - throw Error( - `ParserError: value "${token.value}" is not supported`, - ); - } - break; - } - case "hour": { - switch (token.value) { - case "numeric": { - value = /^\d{1,2}/.exec(string)?.[0] as string; - if (token.hour12 && parseInt(value) > 12) { - console.error( - `Trying to parse hour greater than 12. Use 'H' instead of 'h'.`, - ); - } - break; - } - case "2-digit": { - value = /^\d{2}/.exec(string)?.[0] as string; - if (token.hour12 && parseInt(value) > 12) { - console.error( - `Trying to parse hour greater than 12. Use 'HH' instead of 'hh'.`, - ); - } - break; - } - default: - throw Error( - `ParserError: value "${token.value}" is not supported`, - ); - } - break; - } - case "minute": { - switch (token.value) { - case "numeric": { - value = /^\d{1,2}/.exec(string)?.[0] as string; - break; - } - case "2-digit": { - value = /^\d{2}/.exec(string)?.[0] as string; - break; - } - default: - throw Error( - `ParserError: value "${token.value}" is not supported`, - ); - } - break; - } - case "second": { - switch (token.value) { - case "numeric": { - value = /^\d{1,2}/.exec(string)?.[0] as string; - break; - } - case "2-digit": { - value = /^\d{2}/.exec(string)?.[0] as string; - break; - } - default: - throw Error( - `ParserError: value "${token.value}" is not supported`, - ); - } - break; - } - case "fractionalSecond": { - value = new RegExp(`^\\d{${token.value}}`).exec(string) - ?.[0] as string; - break; - } - case "timeZoneName": { - value = token.value as string; - break; - } - case "dayPeriod": { - value = /^(A|P)M/.exec(string)?.[0] as string; - break; - } - case "literal": { - if (!string.startsWith(token.value as string)) { - throw Error( - `Literal "${token.value}" not found "${string.slice(0, 25)}"`, - ); - } - value = token.value as string; - break; - } - - default: - throw Error(`${token.type} ${token.value}`); - } - - if (!value) { - throw Error( - `value not valid for token { ${type} ${value} } ${ - string.slice( - 0, - 25, - ) - }`, - ); - } - parts.push({ type, value }); - - string = string.slice(value.length); - } - - if (string.length) { - throw Error( - `datetime string was not fully parsed! ${string.slice(0, 25)}`, - ); - } - - return parts; - } - - /** sort & filter dateTimeFormatPart */ - sortDateTimeFormatPart(parts: DateTimeFormatPart[]): DateTimeFormatPart[] { - let result: DateTimeFormatPart[] = []; - const typeArray = [ - "year", - "month", - "day", - "hour", - "minute", - "second", - "fractionalSecond", - ]; - for (const type of typeArray) { - const current = parts.findIndex((el) => el.type === type); - if (current !== -1) { - result = result.concat(parts.splice(current, 1)); - } - } - result = result.concat(parts); - return result; - } - - partsToDate(parts: DateTimeFormatPart[]): Date { - const date = new Date(); - const utc = parts.find( - (part) => part.type === "timeZoneName" && part.value === "UTC", - ); - - utc ? date.setUTCHours(0, 0, 0, 0) : date.setHours(0, 0, 0, 0); - for (const part of parts) { - switch (part.type) { - case "year": { - const value = Number(part.value.padStart(4, "20")); - utc ? date.setUTCFullYear(value) : date.setFullYear(value); - break; - } - case "month": { - const value = Number(part.value) - 1; - utc ? date.setUTCMonth(value) : date.setMonth(value); - break; - } - case "day": { - const value = Number(part.value); - utc ? date.setUTCDate(value) : date.setDate(value); - break; - } - case "hour": { - let value = Number(part.value); - const dayPeriod = parts.find( - (part: DateTimeFormatPart) => part.type === "dayPeriod", - ); - if (dayPeriod?.value === "PM") value += 12; - utc ? date.setUTCHours(value) : date.setHours(value); - break; - } - case "minute": { - const value = Number(part.value); - utc ? date.setUTCMinutes(value) : date.setMinutes(value); - break; - } - case "second": { - const value = Number(part.value); - utc ? date.setUTCSeconds(value) : date.setSeconds(value); - break; - } - case "fractionalSecond": { - const value = Number(part.value); - utc ? date.setUTCMilliseconds(value) : date.setMilliseconds(value); - break; - } - } - } - return date; - } - - parse(string: string): Date { - const parts = this.parseToParts(string); - const sortParts = this.sortDateTimeFormatPart(parts); - return this.partsToDate(sortParts); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/2a7bb7657d73da4a00f49d87322148f3eb15a422.ts b/crates/swc_bundler/tests/.cache/deno/2a7bb7657d73da4a00f49d87322148f3eb15a422.ts deleted file mode 100644 index aa7e7f60bc3d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2a7bb7657d73da4a00f49d87322148f3eb15a422.ts +++ /dev/null @@ -1,85 +0,0 @@ -// Loaded from https://deno.land/x/god_crypto@v1.4.3/src/rsa/rsa_js.ts - - -import { - rsa_oaep_encrypt, - rsa_pkcs1_encrypt, - rsa_oaep_decrypt, - rsa_pkcs1_decrypt, - rsa_pkcs1_verify, - rsa_pkcs1_sign, -} from "./rsa_internal.ts"; -import { RawBinary } from "./../binary.ts"; -import type { RSAOption, RSASignOption } from "./common.ts"; -import { createHash } from "../hash.ts"; -import type { RSAKey } from "./rsa_key.ts"; - -export class PureRSA { - static async encrypt(key: RSAKey, message: Uint8Array, options: RSAOption) { - if (!key.e) throw "Invalid RSA key"; - - if (options.padding === "oaep") { - return new RawBinary(rsa_oaep_encrypt( - key.length, - key.n, - key.e, - message, - options.hash, - )); - } else if (options.padding === "pkcs1") { - return new RawBinary( - rsa_pkcs1_encrypt(key.length, key.n, key.e, message), - ); - } - - throw "Invalid parameters"; - } - - static async decrypt(key: RSAKey, ciper: Uint8Array, options: RSAOption) { - if (!key.d) throw "Invalid RSA key"; - - if (options.padding === "oaep") { - return new RawBinary(rsa_oaep_decrypt( - key.length, - key.n, - key.d, - ciper, - options.hash, - )); - } else if (options.padding === "pkcs1") { - return new RawBinary( - rsa_pkcs1_decrypt(key.length, key.n, key.d, ciper), - ); - } - - throw "Invalid parameters"; - } - - static async verify( - key: RSAKey, - signature: Uint8Array, - message: Uint8Array, - options: RSASignOption, - ) { - if (!key.e) throw "Invalid RSA key"; - - return rsa_pkcs1_verify( - key.length, - key.n, - key.e, - signature, - createHash(options.hash).update(message).digest(), - ); - } - - static async sign(key: RSAKey, message: Uint8Array, options: RSASignOption) { - if (!key.d) throw "You need private key to sign the message"; - - return rsa_pkcs1_sign( - key.length, - key.n, - key.d, - createHash(options.hash).update(message).digest(), - ); - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/2a8072d06fdc24bb0773d2daf7eb64c1469c432c.ts b/crates/swc_bundler/tests/.cache/deno/2a8072d06fdc24bb0773d2daf7eb64c1469c432c.ts deleted file mode 100644 index d397cee43b1f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2a8072d06fdc24bb0773d2daf7eb64c1469c432c.ts +++ /dev/null @@ -1,267 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/util/utils.ts - - -import { encode } from "./deps.ts"; -import { eventHandlers } from "../bot.ts"; -import { isActionRow } from "../helpers/type_guards/is_action_row.ts"; -import { isButton } from "../helpers/type_guards/is_button.ts"; -import { Errors } from "../types/discordeno/errors.ts"; -import type { ApplicationCommandOption } from "../types/interactions/commands/application_command_option.ts"; -import type { ApplicationCommandOptionChoice } from "../types/interactions/commands/application_command_option_choice.ts"; -import { DiscordApplicationCommandOptionTypes } from "../types/interactions/commands/application_command_option_types.ts"; -import type { CreateGlobalApplicationCommand } from "../types/interactions/commands/create_global_application_command.ts"; -import type { EditGlobalApplicationCommand } from "../types/interactions/commands/edit_global_application_command.ts"; -import { ButtonStyles } from "../types/messages/components/button_styles.ts"; -import type { MessageComponents } from "../types/messages/components/message_components.ts"; -import type { DiscordImageFormat } from "../types/misc/image_format.ts"; -import type { DiscordImageSize } from "../types/misc/image_size.ts"; -import { SLASH_COMMANDS_NAME_REGEX } from "./constants.ts"; -import { validateLength } from "./validate_length.ts"; - -export async function urlToBase64(url: string) { - const buffer = await fetch(url).then((res) => res.arrayBuffer()); - const imageStr = encode(buffer); - const type = url.substring(url.lastIndexOf(".") + 1); - return `data:image/${type};base64,${imageStr}`; -} - -/** Allows easy way to add a prop to a base object when needing to use complicated getters solution. */ -// deno-lint-ignore no-explicit-any -export function createNewProp(value: any): PropertyDescriptor { - return { configurable: true, enumerable: true, writable: true, value }; -} - -export function delay(ms: number): Promise { - return new Promise((res): number => - setTimeout((): void => { - res(); - }, ms) - ); -} - -export const formatImageURL = (url: string, size: DiscordImageSize = 128, format?: DiscordImageFormat) => { - return `${url}.${format || (url.includes("/a_") ? "gif" : "jpg")}?size=${size}`; -}; - -function camelToSnakeCase(text: string) { - return text.replace(/[A-Z]/g, ($1) => `_${$1.toLowerCase()}`); -} - -function snakeToCamelCase(text: string) { - return text.replace(/([-_][a-z])/gi, ($1) => $1.toUpperCase().replace("_", "")); -} - -function isConvertableObject(obj: unknown) { - return obj === Object(obj) && !Array.isArray(obj) && typeof obj !== "function" && !(obj instanceof Blob); -} - -export function snakelize( - // deno-lint-ignore no-explicit-any - obj: Record | Record[] -): T { - if (isConvertableObject(obj)) { - // deno-lint-ignore no-explicit-any - const convertedObject: Record = {}; - - Object.keys(obj).forEach((key) => { - eventHandlers.debug?.("loop", `Running forEach loop in snakelize function.`); - convertedObject[camelToSnakeCase(key)] = snakelize( - // deno-lint-ignore no-explicit-any - (obj as Record)[key] - ); - }); - - return convertedObject as T; - } else if (Array.isArray(obj)) { - obj = obj.map((element) => snakelize(element)); - } - - return obj as T; -} - -export function camelize( - // deno-lint-ignore no-explicit-any - obj: Record | Record[] -): T { - if (isConvertableObject(obj)) { - // deno-lint-ignore no-explicit-any - const convertedObject: Record = {}; - - Object.keys(obj).forEach((key) => { - eventHandlers.debug?.("loop", `Running forEach loop in camelize function.`); - convertedObject[snakeToCamelCase(key)] = camelize( - // deno-lint-ignore no-explicit-any - (obj as Record)[key] - ); - }); - - return convertedObject as T; - } else if (Array.isArray(obj)) { - obj = obj.map((element) => camelize(element)); - } - - return obj as T; -} - -/** @private */ -function validateSlashOptionChoices( - choices: ApplicationCommandOptionChoice[], - optionType: DiscordApplicationCommandOptionTypes -) { - for (const choice of choices) { - eventHandlers.debug?.("loop", `Running for of loop in validateSlashOptionChoices function.`); - if (!validateLength(choice.name, { min: 1, max: 100 })) { - throw new Error(Errors.INVALID_SLASH_OPTION_CHOICE_NAME); - } - - if ( - optionType === DiscordApplicationCommandOptionTypes.String && - (typeof choice.value !== "string" || choice.value.length < 1 || choice.value.length > 100) - ) { - throw new Error(Errors.INVALID_SLASH_OPTIONS_CHOICE_VALUE_TYPE); - } - - if (optionType === DiscordApplicationCommandOptionTypes.Integer && typeof choice.value !== "number") { - throw new Error(Errors.INVALID_SLASH_OPTIONS_CHOICE_VALUE_TYPE); - } - } -} - -/** @private */ -function validateSlashOptions(options: ApplicationCommandOption[]) { - const requiredOptions: ApplicationCommandOption[] = []; - const optionalOptions: ApplicationCommandOption[] = []; - - for (const option of options) { - eventHandlers.debug?.("loop", `Running for of loop in validateSlashOptions function.`); - option.name = option.name.toLowerCase(); - - if (option.choices?.length) { - if (option.choices.length > 25) throw new Error(Errors.TOO_MANY_SLASH_OPTION_CHOICES); - if ( - option.type !== DiscordApplicationCommandOptionTypes.String && - option.type !== DiscordApplicationCommandOptionTypes.Integer - ) - throw new Error(Errors.ONLY_STRING_OR_INTEGER_OPTIONS_CAN_HAVE_CHOICES); - } - - if (!validateLength(option.name, { min: 1, max: 32 })) throw new Error(Errors.INVALID_SLASH_OPTION_NAME); - - if (!validateLength(option.description, { min: 1, max: 100 })) - throw new Error(Errors.INVALID_SLASH_OPTION_DESCRIPTION); - - if (option.choices) { - validateSlashOptionChoices(option.choices, option.type); - } - - if (option.required) { - requiredOptions.push(option); - continue; - } - - optionalOptions.push(option); - } - - return [...requiredOptions, ...optionalOptions]; -} - -export function validateSlashCommands( - commands: (CreateGlobalApplicationCommand | EditGlobalApplicationCommand)[], - create = false -) { - return commands.map((command) => { - eventHandlers.debug?.("loop", `Running for of loop in validateSlashCommands function.`); - if (create) { - if (!command.name) throw new Error(Errors.INVALID_SLASH_NAME); - if (!command.description) throw new Error(Errors.INVALID_SLASH_DESCRIPTION); - } - - if (command.name) { - if (!SLASH_COMMANDS_NAME_REGEX.test(command.name)) { - throw new Error(Errors.INVALID_SLASH_NAME); - } - - command.name = command.name.toLowerCase(); - } - - if (command.description && !validateLength(command.description, { min: 1, max: 100 })) { - throw new Error(Errors.INVALID_SLASH_DESCRIPTION); - } - - if (command.options?.length) { - if (command.options.length > 25) { - throw new Error(Errors.TOO_MANY_SLASH_OPTIONS); - } - - command.options = validateSlashOptions(command.options); - } - - return command; - }); -} - -// Typescript is not so good as we developers so we need this little utility function to help it out -// Taken from https://fettblog.eu/typescript-hasownproperty/ -/** TS save way to check if a property exists in an object */ -// deno-lint-ignore ban-types -export function hasOwnProperty( - obj: T, - prop: Y -): obj is T & Record { - // deno-lint-ignore no-prototype-builtins - return obj.hasOwnProperty(prop); -} - -export function validateComponents(components: MessageComponents) { - if (!components?.length) return; - - let actionRowCounter = 0; - - for (const component of components) { - // 5 Link buttons can not have a customId - if (isButton(component)) { - if (component.type === ButtonStyles.Link && component.customId) { - throw new Error(Errors.LINK_BUTTON_CANNOT_HAVE_CUSTOM_ID); - } - // Other buttons must have a customId - if (!component.customId && component.type !== ButtonStyles.Link) { - throw new Error(Errors.BUTTON_REQUIRES_CUSTOM_ID); - } - - if (!validateLength(component.label, { max: 80 })) { - throw new Error(Errors.COMPONENT_LABEL_TOO_BIG); - } - - if (component.customId && !validateLength(component.customId, { max: 100 })) { - throw new Error(Errors.COMPONENT_CUSTOM_ID_TOO_BIG); - } - - if (typeof component.emoji === "string") { - // A snowflake id was provided - if (/^[0-9]+$/.test(component.emoji)) { - component.emoji = { - id: component.emoji, - }; - } else { - // A unicode emoji was provided - component.emoji = { - name: component.emoji, - }; - } - } - } - - if (!isActionRow(component)) { - continue; - } - - actionRowCounter++; - // Max of 5 ActionRows per message - if (actionRowCounter > 5) throw new Error(Errors.TOO_MANY_ACTION_ROWS); - - // Max of 5 Buttons (or any component type) within an ActionRow - if (component.components?.length > 5) { - throw new Error(Errors.TOO_MANY_COMPONENTS); - } - } -} diff --git a/crates/swc_bundler/tests/.cache/deno/2aa86467537e9d09af6d641d0c97285a8806f65d.ts b/crates/swc_bundler/tests/.cache/deno/2aa86467537e9d09af6d641d0c97285a8806f65d.ts deleted file mode 100644 index 02a5b5ae3d1f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2aa86467537e9d09af6d641d0c97285a8806f65d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/language/predicates.js - - -import { Kind } from './kinds.js'; -export function isDefinitionNode(node) { - return isExecutableDefinitionNode(node) || isTypeSystemDefinitionNode(node) || isTypeSystemExtensionNode(node); -} -export function isExecutableDefinitionNode(node) { - return node.kind === Kind.OPERATION_DEFINITION || node.kind === Kind.FRAGMENT_DEFINITION; -} -export function isSelectionNode(node) { - return node.kind === Kind.FIELD || node.kind === Kind.FRAGMENT_SPREAD || node.kind === Kind.INLINE_FRAGMENT; -} -export function isValueNode(node) { - return node.kind === Kind.VARIABLE || node.kind === Kind.INT || node.kind === Kind.FLOAT || node.kind === Kind.STRING || node.kind === Kind.BOOLEAN || node.kind === Kind.NULL || node.kind === Kind.ENUM || node.kind === Kind.LIST || node.kind === Kind.OBJECT; -} -export function isTypeNode(node) { - return node.kind === Kind.NAMED_TYPE || node.kind === Kind.LIST_TYPE || node.kind === Kind.NON_NULL_TYPE; -} -export function isTypeSystemDefinitionNode(node) { - return node.kind === Kind.SCHEMA_DEFINITION || isTypeDefinitionNode(node) || node.kind === Kind.DIRECTIVE_DEFINITION; -} -export function isTypeDefinitionNode(node) { - return node.kind === Kind.SCALAR_TYPE_DEFINITION || node.kind === Kind.OBJECT_TYPE_DEFINITION || node.kind === Kind.INTERFACE_TYPE_DEFINITION || node.kind === Kind.UNION_TYPE_DEFINITION || node.kind === Kind.ENUM_TYPE_DEFINITION || node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION; -} -export function isTypeSystemExtensionNode(node) { - return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); -} -export function isTypeExtensionNode(node) { - return node.kind === Kind.SCALAR_TYPE_EXTENSION || node.kind === Kind.OBJECT_TYPE_EXTENSION || node.kind === Kind.INTERFACE_TYPE_EXTENSION || node.kind === Kind.UNION_TYPE_EXTENSION || node.kind === Kind.ENUM_TYPE_EXTENSION || node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/2ab8414d73697114242dcbb3433341224d17b30f.ts b/crates/swc_bundler/tests/.cache/deno/2ab8414d73697114242dcbb3433341224d17b30f.ts deleted file mode 100644 index 668cac80d14f..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2ab8414d73697114242dcbb3433341224d17b30f.ts +++ /dev/null @@ -1,137 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/cache.ts - - -// deno-lint-ignore-file require-await no-explicit-any prefer-const -import type { DiscordenoChannel } from "./structures/channel.ts"; -import type { DiscordenoGuild } from "./structures/guild.ts"; -import type { DiscordenoMember } from "./structures/member.ts"; -import type { DiscordenoMessage } from "./structures/message.ts"; -import type { PresenceUpdate } from "./types/activity/presence_update.ts"; -import type { Emoji } from "./types/emojis/emoji.ts"; -import { Collection } from "./util/collection.ts"; - -export const cache = { - isReady: false, - /** All of the guild objects the bot has access to, mapped by their Ids */ - guilds: new Collection(), - /** All of the channel objects the bot has access to, mapped by their Ids */ - channels: new Collection(), - /** All of the message objects the bot has cached since the bot acquired `READY` state, mapped by their Ids */ - messages: new Collection(), - /** All of the member objects that have been cached since the bot acquired `READY` state, mapped by their Ids */ - members: new Collection(), - /** All of the unavailable guilds, mapped by their Ids (id, timestamp) */ - unavailableGuilds: new Collection(), - /** All of the presence update objects received in PRESENCE_UPDATE gateway event, mapped by their user Id */ - presences: new Collection(), - fetchAllMembersProcessingRequests: new Collection< - string, - (value: Collection | PromiseLike>) => void - >(), - executedSlashCommands: new Set(), - get emojis() { - return new Collection( - this.guilds.reduce((a, b) => [...a, ...b.emojis.map((e) => [e.id, e])], [] as any[]) - ); - }, -}; - -export let cacheHandlers = { - /** Deletes all items from the cache */ - async clear(table: TableName) { - return cache[table].clear(); - }, - /** Deletes 1 item from cache using the key */ - async delete(table: TableName, key: bigint) { - return cache[table].delete(key); - }, - /** Check if something exists in cache with a key */ - async has(table: TableName, key: bigint) { - return cache[table].has(key); - }, - - /** Get the number of key-value pairs */ - async size(table: TableName) { - return cache[table].size; - }, - - // Done differently to have overloads - /** Add a key value pair to the cache */ - set, - /** Get the value from the cache using its key */ - get, - /** Run a function on all items in this cache */ - forEach, - /** Allows you to filter our all items in this cache. */ - filter, -}; - -export type TableName = "guilds" | "unavailableGuilds" | "channels" | "messages" | "members" | "presences"; - -function set(table: "guilds", key: bigint, value: DiscordenoGuild): Promise>; -function set(table: "channels", key: bigint, value: DiscordenoChannel): Promise>; -function set(table: "messages", key: bigint, value: DiscordenoMessage): Promise>; -function set(table: "members", key: bigint, value: DiscordenoMember): Promise>; -function set(table: "presences", key: bigint, value: PresenceUpdate): Promise>; -function set(table: "unavailableGuilds", key: bigint, value: number): Promise>; -async function set(table: TableName, key: bigint, value: any) { - return cache[table].set(key, value); -} - -function get(table: "guilds", key: bigint): Promise; -function get(table: "channels", key: bigint): Promise; -function get(table: "messages", key: bigint): Promise; -function get(table: "members", key: bigint): Promise; -function get(table: "presences", key: bigint): Promise; -function get(table: "unavailableGuilds", key: bigint): Promise; -async function get(table: TableName, key: bigint) { - return cache[table].get(key); -} - -function forEach( - table: "guilds", - callback: (value: DiscordenoGuild, key: bigint, map: Map) => unknown -): void; -function forEach( - table: "unavailableGuilds", - callback: (value: number, key: bigint, map: Map) => unknown -): void; -function forEach( - table: "channels", - callback: (value: DiscordenoChannel, key: bigint, map: Map) => unknown -): void; -function forEach( - table: "messages", - callback: (value: DiscordenoMessage, key: bigint, map: Map) => unknown -): void; -function forEach( - table: "members", - callback: (value: DiscordenoMember, key: bigint, map: Map) => unknown -): void; -function forEach(table: TableName, callback: (value: any, key: bigint, map: Map) => unknown) { - return cache[table].forEach(callback); -} - -function filter( - table: "guilds", - callback: (value: DiscordenoGuild, key: bigint) => boolean -): Promise>; -function filter( - table: "unavailableGuilds", - callback: (value: number, key: bigint) => boolean -): Promise>; -function filter( - table: "channels", - callback: (value: DiscordenoChannel, key: bigint) => boolean -): Promise>; -function filter( - table: "messages", - callback: (value: DiscordenoMessage, key: bigint) => boolean -): Promise>; -function filter( - table: "members", - callback: (value: DiscordenoMember, key: bigint) => boolean -): Promise>; -async function filter(table: TableName, callback: (value: any, key: bigint) => boolean) { - return cache[table].filter(callback); -} diff --git a/crates/swc_bundler/tests/.cache/deno/2ac7f0a0369e40861b5285d17a7444c57b8b1a7c.ts b/crates/swc_bundler/tests/.cache/deno/2ac7f0a0369e40861b5285d17a7444c57b8b1a7c.ts deleted file mode 100644 index ca22709eaf1d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2ac7f0a0369e40861b5285d17a7444c57b8b1a7c.ts +++ /dev/null @@ -1,200 +0,0 @@ -// Loaded from https://deno.land/std@0.69.0/http/http_status.ts - - -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -/** HTTP status codes */ -export enum Status { - /** RFC 7231, 6.2.1 */ - Continue = 100, - /** RFC 7231, 6.2.2 */ - SwitchingProtocols = 101, - /** RFC 2518, 10.1 */ - Processing = 102, - /** RFC 8297 **/ - EarlyHints = 103, - /** RFC 7231, 6.3.1 */ - OK = 200, - /** RFC 7231, 6.3.2 */ - Created = 201, - /** RFC 7231, 6.3.3 */ - Accepted = 202, - /** RFC 7231, 6.3.4 */ - NonAuthoritativeInfo = 203, - /** RFC 7231, 6.3.5 */ - NoContent = 204, - /** RFC 7231, 6.3.6 */ - ResetContent = 205, - /** RFC 7233, 4.1 */ - PartialContent = 206, - /** RFC 4918, 11.1 */ - MultiStatus = 207, - /** RFC 5842, 7.1 */ - AlreadyReported = 208, - /** RFC 3229, 10.4.1 */ - IMUsed = 226, - - /** RFC 7231, 6.4.1 */ - MultipleChoices = 300, - /** RFC 7231, 6.4.2 */ - MovedPermanently = 301, - /** RFC 7231, 6.4.3 */ - Found = 302, - /** RFC 7231, 6.4.4 */ - SeeOther = 303, - /** RFC 7232, 4.1 */ - NotModified = 304, - /** RFC 7231, 6.4.5 */ - UseProxy = 305, - /** RFC 7231, 6.4.7 */ - TemporaryRedirect = 307, - /** RFC 7538, 3 */ - PermanentRedirect = 308, - - /** RFC 7231, 6.5.1 */ - BadRequest = 400, - /** RFC 7235, 3.1 */ - Unauthorized = 401, - /** RFC 7231, 6.5.2 */ - PaymentRequired = 402, - /** RFC 7231, 6.5.3 */ - Forbidden = 403, - /** RFC 7231, 6.5.4 */ - NotFound = 404, - /** RFC 7231, 6.5.5 */ - MethodNotAllowed = 405, - /** RFC 7231, 6.5.6 */ - NotAcceptable = 406, - /** RFC 7235, 3.2 */ - ProxyAuthRequired = 407, - /** RFC 7231, 6.5.7 */ - RequestTimeout = 408, - /** RFC 7231, 6.5.8 */ - Conflict = 409, - /** RFC 7231, 6.5.9 */ - Gone = 410, - /** RFC 7231, 6.5.10 */ - LengthRequired = 411, - /** RFC 7232, 4.2 */ - PreconditionFailed = 412, - /** RFC 7231, 6.5.11 */ - RequestEntityTooLarge = 413, - /** RFC 7231, 6.5.12 */ - RequestURITooLong = 414, - /** RFC 7231, 6.5.13 */ - UnsupportedMediaType = 415, - /** RFC 7233, 4.4 */ - RequestedRangeNotSatisfiable = 416, - /** RFC 7231, 6.5.14 */ - ExpectationFailed = 417, - /** RFC 7168, 2.3.3 */ - Teapot = 418, - /** RFC 7540, 9.1.2 */ - MisdirectedRequest = 421, - /** RFC 4918, 11.2 */ - UnprocessableEntity = 422, - /** RFC 4918, 11.3 */ - Locked = 423, - /** RFC 4918, 11.4 */ - FailedDependency = 424, - /** RFC 8470, 5.2 */ - TooEarly = 425, - /** RFC 7231, 6.5.15 */ - UpgradeRequired = 426, - /** RFC 6585, 3 */ - PreconditionRequired = 428, - /** RFC 6585, 4 */ - TooManyRequests = 429, - /** RFC 6585, 5 */ - RequestHeaderFieldsTooLarge = 431, - /** RFC 7725, 3 */ - UnavailableForLegalReasons = 451, - - /** RFC 7231, 6.6.1 */ - InternalServerError = 500, - /** RFC 7231, 6.6.2 */ - NotImplemented = 501, - /** RFC 7231, 6.6.3 */ - BadGateway = 502, - /** RFC 7231, 6.6.4 */ - ServiceUnavailable = 503, - /** RFC 7231, 6.6.5 */ - GatewayTimeout = 504, - /** RFC 7231, 6.6.6 */ - HTTPVersionNotSupported = 505, - /** RFC 2295, 8.1 */ - VariantAlsoNegotiates = 506, - /** RFC 4918, 11.5 */ - InsufficientStorage = 507, - /** RFC 5842, 7.2 */ - LoopDetected = 508, - /** RFC 2774, 7 */ - NotExtended = 510, - /** RFC 6585, 6 */ - NetworkAuthenticationRequired = 511, -} - -export const STATUS_TEXT = new Map([ - [Status.Continue, "Continue"], - [Status.SwitchingProtocols, "Switching Protocols"], - [Status.Processing, "Processing"], - [Status.EarlyHints, "Early Hints"], - [Status.OK, "OK"], - [Status.Created, "Created"], - [Status.Accepted, "Accepted"], - [Status.NonAuthoritativeInfo, "Non-Authoritative Information"], - [Status.NoContent, "No Content"], - [Status.ResetContent, "Reset Content"], - [Status.PartialContent, "Partial Content"], - [Status.MultiStatus, "Multi-Status"], - [Status.AlreadyReported, "Already Reported"], - [Status.IMUsed, "IM Used"], - [Status.MultipleChoices, "Multiple Choices"], - [Status.MovedPermanently, "Moved Permanently"], - [Status.Found, "Found"], - [Status.SeeOther, "See Other"], - [Status.NotModified, "Not Modified"], - [Status.UseProxy, "Use Proxy"], - [Status.TemporaryRedirect, "Temporary Redirect"], - [Status.PermanentRedirect, "Permanent Redirect"], - [Status.BadRequest, "Bad Request"], - [Status.Unauthorized, "Unauthorized"], - [Status.PaymentRequired, "Payment Required"], - [Status.Forbidden, "Forbidden"], - [Status.NotFound, "Not Found"], - [Status.MethodNotAllowed, "Method Not Allowed"], - [Status.NotAcceptable, "Not Acceptable"], - [Status.ProxyAuthRequired, "Proxy Authentication Required"], - [Status.RequestTimeout, "Request Timeout"], - [Status.Conflict, "Conflict"], - [Status.Gone, "Gone"], - [Status.LengthRequired, "Length Required"], - [Status.PreconditionFailed, "Precondition Failed"], - [Status.RequestEntityTooLarge, "Request Entity Too Large"], - [Status.RequestURITooLong, "Request URI Too Long"], - [Status.UnsupportedMediaType, "Unsupported Media Type"], - [Status.RequestedRangeNotSatisfiable, "Requested Range Not Satisfiable"], - [Status.ExpectationFailed, "Expectation Failed"], - [Status.Teapot, "I'm a teapot"], - [Status.MisdirectedRequest, "Misdirected Request"], - [Status.UnprocessableEntity, "Unprocessable Entity"], - [Status.Locked, "Locked"], - [Status.FailedDependency, "Failed Dependency"], - [Status.TooEarly, "Too Early"], - [Status.UpgradeRequired, "Upgrade Required"], - [Status.PreconditionRequired, "Precondition Required"], - [Status.TooManyRequests, "Too Many Requests"], - [Status.RequestHeaderFieldsTooLarge, "Request Header Fields Too Large"], - [Status.UnavailableForLegalReasons, "Unavailable For Legal Reasons"], - [Status.InternalServerError, "Internal Server Error"], - [Status.NotImplemented, "Not Implemented"], - [Status.BadGateway, "Bad Gateway"], - [Status.ServiceUnavailable, "Service Unavailable"], - [Status.GatewayTimeout, "Gateway Timeout"], - [Status.HTTPVersionNotSupported, "HTTP Version Not Supported"], - [Status.VariantAlsoNegotiates, "Variant Also Negotiates"], - [Status.InsufficientStorage, "Insufficient Storage"], - [Status.LoopDetected, "Loop Detected"], - [Status.NotExtended, "Not Extended"], - [Status.NetworkAuthenticationRequired, "Network Authentication Required"], -]); diff --git a/crates/swc_bundler/tests/.cache/deno/2ac81768a33cbd97bb1a6d3c50686350f1130003.ts b/crates/swc_bundler/tests/.cache/deno/2ac81768a33cbd97bb1a6d3c50686350f1130003.ts deleted file mode 100644 index 1c2953d8b5c7..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2ac81768a33cbd97bb1a6d3c50686350f1130003.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/std@0.92.0/fs/_util.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import * as path from "../path/mod.ts"; - -/** - * Test whether or not `dest` is a sub-directory of `src` - * @param src src file path - * @param dest dest file path - * @param sep path separator - */ -export function isSubdir( - src: string, - dest: string, - sep: string = path.sep, -): boolean { - if (src === dest) { - return false; - } - const srcArray = src.split(sep); - const destArray = dest.split(sep); - return srcArray.every((current, i) => destArray[i] === current); -} - -export type PathType = "file" | "dir" | "symlink"; - -/** - * Get a human readable file type string. - * - * @param fileInfo A FileInfo describes a file and is returned by `stat`, - * `lstat` - */ -export function getFileInfoType(fileInfo: Deno.FileInfo): PathType | undefined { - return fileInfo.isFile - ? "file" - : fileInfo.isDirectory - ? "dir" - : fileInfo.isSymlink - ? "symlink" - : undefined; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2adbfab19da02fbe2ff485f9c907b5b023afc151.ts b/crates/swc_bundler/tests/.cache/deno/2adbfab19da02fbe2ff485f9c907b5b023afc151.ts deleted file mode 100644 index 1847bbb4d320..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2adbfab19da02fbe2ff485f9c907b5b023afc151.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/x/abc@v1.2.4/types.ts - - -import type { ServerRequest } from "./vendor/https/deno.land/std/http/server.ts"; -import type { Context } from "./context.ts"; -import type { Application } from "./app.ts"; - -/** `Renderer` is the interface that wraps the `render` function. */ -export type Renderer = { - templates?: string; - render(name: string, data: T): Promise; -}; - -/* `HandlerFunc` defines a function to serve HTTP requests. */ -export type HandlerFunc = (c: Context) => Promise | unknown; - -/* `MiddlewareFunc` defines a function to process middleware. */ -export type MiddlewareFunc = (next: HandlerFunc) => HandlerFunc; - -export type ContextOptions = { app: Application; r: ServerRequest }; diff --git a/crates/swc_bundler/tests/.cache/deno/2ae6669cfb6f655894f8861c3ae839388b467167.ts b/crates/swc_bundler/tests/.cache/deno/2ae6669cfb6f655894f8861c3ae839388b467167.ts deleted file mode 100644 index 2f4f90b2dbea..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2ae6669cfb6f655894f8861c3ae839388b467167.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/instanceOf.js - - -/** - * A replacement for instanceof which includes an error warning when multi-realm - * constructors are detected. - */ -// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production -// See: https://webpack.js.org/guides/production/ -export default Deno.env.NODE_ENV === 'production' ? -/* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */ -// eslint-disable-next-line no-shadow -function instanceOf(value, constructor) { - return value instanceof constructor; -} : // eslint-disable-next-line no-shadow -function instanceOf(value, constructor) { - if (value instanceof constructor) { - return true; - } - - if (value) { - const valueClass = value.constructor; - const className = constructor.name; - - if (className && valueClass && valueClass.name === className) { - throw new Error(`Cannot use ${className} "${value}" from another module or realm. - -Ensure that there is only one instance of "graphql" in the node_modules -directory. If different versions of "graphql" are the dependencies of other -relied on modules, use "resolutions" to ensure only one version is installed. - -https://yarnpkg.com/en/docs/selective-version-resolutions - -Duplicate "graphql" modules cannot be used at the same time since different -versions may have different capabilities and behavior. The data from one -version used in the function from another could produce confusing and -spurious results.`); - } - } - - return false; -}; diff --git a/crates/swc_bundler/tests/.cache/deno/2aeb963553d95da69a2f534fba2a864e731cdd74.ts b/crates/swc_bundler/tests/.cache/deno/2aeb963553d95da69a2f534fba2a864e731cdd74.ts deleted file mode 100644 index 3c04698697c8..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2aeb963553d95da69a2f534fba2a864e731cdd74.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Loaded from https://deno.land/x/ramda@v0.27.2/source/uniqBy.js - - -import _Set from './internal/_Set.js'; -import _curry2 from './internal/_curry2.js'; - - -/** - * Returns a new list containing only one copy of each element in the original - * list, based upon the value returned by applying the supplied function to - * each list element. Prefers the first item if the supplied function produces - * the same value on two items. [`R.equals`](#equals) is used for comparison. - * - * @func - * @memberOf R - * @since v0.16.0 - * @category List - * @sig (a -> b) -> [a] -> [a] - * @param {Function} fn A function used to produce a value to use during comparisons. - * @param {Array} list The array to consider. - * @return {Array} The list of unique items. - * @example - * - * R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] - */ -var uniqBy = _curry2(function uniqBy(fn, list) { - var set = new _Set(); - var result = []; - var idx = 0; - var appliedItem, item; - - while (idx < list.length) { - item = list[idx]; - appliedItem = fn(item); - if (set.add(appliedItem)) { - result.push(item); - } - idx += 1; - } - return result; -}); -export default uniqBy; diff --git a/crates/swc_bundler/tests/.cache/deno/2b206cba17cc968297d736bf2465e83e79ae74ad.ts b/crates/swc_bundler/tests/.cache/deno/2b206cba17cc968297d736bf2465e83e79ae74ad.ts deleted file mode 100644 index 42aea708ccb4..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2b206cba17cc968297d736bf2465e83e79ae74ad.ts +++ /dev/null @@ -1,985 +0,0 @@ -// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/type/definition.js - - -// FIXME - -/* eslint-disable import/no-cycle */ -import objectEntries from '../polyfills/objectEntries.js'; -import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols.js'; -import inspect from '../jsutils/inspect.js'; -import keyMap from '../jsutils/keyMap.js'; -import mapValue from '../jsutils/mapValue.js'; -import toObjMap from '../jsutils/toObjMap.js'; -import devAssert from '../jsutils/devAssert.js'; -import keyValMap from '../jsutils/keyValMap.js'; -import instanceOf from '../jsutils/instanceOf.js'; -import didYouMean from '../jsutils/didYouMean.js'; -import isObjectLike from '../jsutils/isObjectLike.js'; -import identityFunc from '../jsutils/identityFunc.js'; -import defineToJSON from '../jsutils/defineToJSON.js'; -import suggestionList from '../jsutils/suggestionList.js'; -import { Kind } from '../language/kinds.js'; -import { print } from '../language/printer.js'; -import { GraphQLError } from '../error/GraphQLError.js'; -import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.js'; -export function isType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type); -} -export function assertType(type) { - if (!isType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`); - } - - return type; -} -/** - * There are predicates for each kind of GraphQL type. - */ - -// eslint-disable-next-line no-redeclare -export function isScalarType(type) { - return instanceOf(type, GraphQLScalarType); -} -export function assertScalarType(type) { - if (!isScalarType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isObjectType(type) { - return instanceOf(type, GraphQLObjectType); -} -export function assertObjectType(type) { - if (!isObjectType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isInterfaceType(type) { - return instanceOf(type, GraphQLInterfaceType); -} -export function assertInterfaceType(type) { - if (!isInterfaceType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Interface type.`); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isUnionType(type) { - return instanceOf(type, GraphQLUnionType); -} -export function assertUnionType(type) { - if (!isUnionType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isEnumType(type) { - return instanceOf(type, GraphQLEnumType); -} -export function assertEnumType(type) { - if (!isEnumType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isInputObjectType(type) { - return instanceOf(type, GraphQLInputObjectType); -} -export function assertInputObjectType(type) { - if (!isInputObjectType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Input Object type.`); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isListType(type) { - return instanceOf(type, GraphQLList); -} -export function assertListType(type) { - if (!isListType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`); - } - - return type; -} -// eslint-disable-next-line no-redeclare -export function isNonNullType(type) { - return instanceOf(type, GraphQLNonNull); -} -export function assertNonNullType(type) { - if (!isNonNullType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`); - } - - return type; -} -/** - * These types may be used as input types for arguments and directives. - */ - -export function isInputType(type) { - return isScalarType(type) || isEnumType(type) || isInputObjectType(type) || isWrappingType(type) && isInputType(type.ofType); -} -export function assertInputType(type) { - if (!isInputType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`); - } - - return type; -} -/** - * These types may be used as output types as the result of fields. - */ - -export function isOutputType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isWrappingType(type) && isOutputType(type.ofType); -} -export function assertOutputType(type) { - if (!isOutputType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`); - } - - return type; -} -/** - * These types may describe types which may be leaf values. - */ - -export function isLeafType(type) { - return isScalarType(type) || isEnumType(type); -} -export function assertLeafType(type) { - if (!isLeafType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`); - } - - return type; -} -/** - * These types may describe the parent context of a selection set. - */ - -export function isCompositeType(type) { - return isObjectType(type) || isInterfaceType(type) || isUnionType(type); -} -export function assertCompositeType(type) { - if (!isCompositeType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL composite type.`); - } - - return type; -} -/** - * These types may describe the parent context of a selection set. - */ - -export function isAbstractType(type) { - return isInterfaceType(type) || isUnionType(type); -} -export function assertAbstractType(type) { - if (!isAbstractType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`); - } - - return type; -} -/** - * List Type Wrapper - * - * A list is a wrapping type which points to another type. - * Lists are often created within the context of defining the fields of - * an object type. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * parents: { type: GraphQLList(PersonType) }, - * children: { type: GraphQLList(PersonType) }, - * }) - * }) - * - */ -// FIXME: workaround to fix issue with Babel parser - -/* :: -declare class GraphQLList<+T: GraphQLType> { - +ofType: T; - static (ofType: T): GraphQLList; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - -export function GraphQLList(ofType) { - if (this instanceof GraphQLList) { - this.ofType = assertType(ofType); - } else { - return new GraphQLList(ofType); - } -} // Need to cast through any to alter the prototype. - -GraphQLList.prototype.toString = function toString() { - return '[' + String(this.ofType) + ']'; -}; - -Object.defineProperty(GraphQLList.prototype, SYMBOL_TO_STRING_TAG, { - get() { - return 'GraphQLList'; - } - -}); -defineToJSON(GraphQLList); -/** - * Non-Null Type Wrapper - * - * A non-null is a wrapping type which points to another type. - * Non-null types enforce that their values are never null and can ensure - * an error is raised if this ever occurs during a request. It is useful for - * fields which you can make a strong guarantee on non-nullability, for example - * usually the id field of a database row will never be null. - * - * Example: - * - * const RowType = new GraphQLObjectType({ - * name: 'Row', - * fields: () => ({ - * id: { type: GraphQLNonNull(GraphQLString) }, - * }) - * }) - * - * Note: the enforcement of non-nullability occurs within the executor. - */ -// FIXME: workaround to fix issue with Babel parser - -/* :: -declare class GraphQLNonNull<+T: GraphQLNullableType> { - +ofType: T; - static (ofType: T): GraphQLNonNull; - // Note: constructors cannot be used for covariant types. Drop the "new". - constructor(ofType: GraphQLType): void; -} -*/ - -export function GraphQLNonNull(ofType) { - if (this instanceof GraphQLNonNull) { - this.ofType = assertNullableType(ofType); - } else { - return new GraphQLNonNull(ofType); - } -} // Need to cast through any to alter the prototype. - -GraphQLNonNull.prototype.toString = function toString() { - return String(this.ofType) + '!'; -}; - -Object.defineProperty(GraphQLNonNull.prototype, SYMBOL_TO_STRING_TAG, { - get() { - return 'GraphQLNonNull'; - } - -}); -defineToJSON(GraphQLNonNull); -/** - * These types wrap and modify other types - */ - -export function isWrappingType(type) { - return isListType(type) || isNonNullType(type); -} -export function assertWrappingType(type) { - if (!isWrappingType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`); - } - - return type; -} -/** - * These types can all accept null as a value. - */ - -export function isNullableType(type) { - return isType(type) && !isNonNullType(type); -} -export function assertNullableType(type) { - if (!isNullableType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`); - } - - return type; -} -/* eslint-disable no-redeclare */ - -export function getNullableType(type) { - /* eslint-enable no-redeclare */ - if (type) { - return isNonNullType(type) ? type.ofType : type; - } -} -/** - * These named types do not include modifiers like List or NonNull. - */ - -export function isNamedType(type) { - return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type); -} -export function assertNamedType(type) { - if (!isNamedType(type)) { - throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`); - } - - return type; -} -/* eslint-disable no-redeclare */ - -export function getNamedType(type) { - /* eslint-enable no-redeclare */ - if (type) { - let unwrappedType = type; - - while (isWrappingType(unwrappedType)) { - unwrappedType = unwrappedType.ofType; - } - - return unwrappedType; - } -} -/** - * Used while defining GraphQL types to allow for circular references in - * otherwise immutable type definitions. - */ - -function resolveThunk(thunk) { - // $FlowFixMe(>=0.90.0) - return typeof thunk === 'function' ? thunk() : thunk; -} - -function undefineIfEmpty(arr) { - return arr && arr.length > 0 ? arr : undefined; -} -/** - * Scalar Type Definition - * - * The leaf values of any request and input values to arguments are - * Scalars (or Enums) and are defined with a name and a series of functions - * used to parse input from ast or variables and to ensure validity. - * - * If a type's serialize function does not return a value (i.e. it returns - * `undefined`) then an error will be raised and a `null` value will be returned - * in the response. If the serialize function returns `null`, then no error will - * be included in the response. - * - * Example: - * - * const OddType = new GraphQLScalarType({ - * name: 'Odd', - * serialize(value) { - * if (value % 2 === 1) { - * return value; - * } - * } - * }); - * - */ - - -export class GraphQLScalarType { - constructor(config) { - const parseValue = config.parseValue ?? identityFunc; - this.name = config.name; - this.description = config.description; - this.serialize = config.serialize ?? identityFunc; - this.parseValue = parseValue; - - this.parseLiteral = config.parseLiteral ?? (node => parseValue(valueFromASTUntyped(node))); - - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - devAssert(typeof config.name === 'string', 'Must provide name.'); - devAssert(config.serialize == null || typeof config.serialize === 'function', `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`); - - if (config.parseLiteral) { - devAssert(typeof config.parseValue === 'function' && typeof config.parseLiteral === 'function', `${this.name} must provide both "parseValue" and "parseLiteral" functions.`); - } - } - - toConfig() { - return { - name: this.name, - description: this.description, - serialize: this.serialize, - parseValue: this.parseValue, - parseLiteral: this.parseLiteral, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [] - }; - } - - toString() { - return this.name; - } // $FlowFixMe Flow doesn't support computed properties yet - - - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLScalarType'; - } - -} -defineToJSON(GraphQLScalarType); - -/** - * Object Type Definition - * - * Almost all of the GraphQL types you define will be object types. Object types - * have a name, but most importantly describe their fields. - * - * Example: - * - * const AddressType = new GraphQLObjectType({ - * name: 'Address', - * fields: { - * street: { type: GraphQLString }, - * number: { type: GraphQLInt }, - * formatted: { - * type: GraphQLString, - * resolve(obj) { - * return obj.number + ' ' + obj.street - * } - * } - * } - * }); - * - * When two types need to refer to each other, or a type needs to refer to - * itself in a field, you can use a function expression (aka a closure or a - * thunk) to supply the fields lazily. - * - * Example: - * - * const PersonType = new GraphQLObjectType({ - * name: 'Person', - * fields: () => ({ - * name: { type: GraphQLString }, - * bestFriend: { type: PersonType }, - * }) - * }); - * - */ -export class GraphQLObjectType { - constructor(config) { - this.name = config.name; - this.description = config.description; - this.isTypeOf = config.isTypeOf; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - devAssert(config.isTypeOf == null || typeof config.isTypeOf === 'function', `${this.name} must provide "isTypeOf" as a function, ` + `but got: ${inspect(config.isTypeOf)}.`); - } - - getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - } - - getInterfaces() { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - - return this._interfaces; - } - - toConfig() { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - isTypeOf: this.isTypeOf, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes || [] - }; - } - - toString() { - return this.name; - } // $FlowFixMe Flow doesn't support computed properties yet - - - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLObjectType'; - } - -} -defineToJSON(GraphQLObjectType); - -function defineInterfaces(config) { - const interfaces = resolveThunk(config.interfaces) ?? []; - devAssert(Array.isArray(interfaces), `${config.name} interfaces must be an Array or a function which returns an Array.`); - return interfaces; -} - -function defineFieldMap(config) { - const fieldMap = resolveThunk(config.fields); - devAssert(isPlainObj(fieldMap), `${config.name} fields must be an object with field names as keys or a function which returns such an object.`); - return mapValue(fieldMap, (fieldConfig, fieldName) => { - devAssert(isPlainObj(fieldConfig), `${config.name}.${fieldName} field config must be an object.`); - devAssert(!('isDeprecated' in fieldConfig), `${config.name}.${fieldName} should provide "deprecationReason" instead of "isDeprecated".`); - devAssert(fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function', `${config.name}.${fieldName} field resolver must be a function if ` + `provided, but got: ${inspect(fieldConfig.resolve)}.`); - const argsConfig = fieldConfig.args ?? {}; - devAssert(isPlainObj(argsConfig), `${config.name}.${fieldName} args must be an object with argument names as keys.`); - const args = objectEntries(argsConfig).map(([argName, argConfig]) => ({ - name: argName, - description: argConfig.description, - type: argConfig.type, - defaultValue: argConfig.defaultValue, - extensions: argConfig.extensions && toObjMap(argConfig.extensions), - astNode: argConfig.astNode - })); - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - args, - resolve: fieldConfig.resolve, - subscribe: fieldConfig.subscribe, - isDeprecated: fieldConfig.deprecationReason != null, - deprecationReason: fieldConfig.deprecationReason, - extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} - -function isPlainObj(obj) { - return isObjectLike(obj) && !Array.isArray(obj); -} - -function fieldsToFieldsConfig(fields) { - return mapValue(fields, field => ({ - description: field.description, - type: field.type, - args: argsToArgsConfig(field.args), - resolve: field.resolve, - subscribe: field.subscribe, - deprecationReason: field.deprecationReason, - extensions: field.extensions, - astNode: field.astNode - })); -} -/** - * @internal - */ - - -export function argsToArgsConfig(args) { - return keyValMap(args, arg => arg.name, arg => ({ - description: arg.description, - type: arg.type, - defaultValue: arg.defaultValue, - extensions: arg.extensions, - astNode: arg.astNode - })); -} -export function isRequiredArgument(arg) { - return isNonNullType(arg.type) && arg.defaultValue === undefined; -} - -/** - * Interface Type Definition - * - * When a field can return one of a heterogeneous set of types, a Interface type - * is used to describe what types are possible, what fields are in common across - * all types, as well as a function to determine which type is actually used - * when the field is resolved. - * - * Example: - * - * const EntityType = new GraphQLInterfaceType({ - * name: 'Entity', - * fields: { - * name: { type: GraphQLString } - * } - * }); - * - */ -export class GraphQLInterfaceType { - constructor(config) { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineFieldMap.bind(undefined, config); - this._interfaces = defineInterfaces.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - devAssert(config.resolveType == null || typeof config.resolveType === 'function', `${this.name} must provide "resolveType" as a function, ` + `but got: ${inspect(config.resolveType)}.`); - } - - getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - } - - getInterfaces() { - if (typeof this._interfaces === 'function') { - this._interfaces = this._interfaces(); - } - - return this._interfaces; - } - - toConfig() { - return { - name: this.name, - description: this.description, - interfaces: this.getInterfaces(), - fields: fieldsToFieldsConfig(this.getFields()), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [] - }; - } - - toString() { - return this.name; - } // $FlowFixMe Flow doesn't support computed properties yet - - - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLInterfaceType'; - } - -} -defineToJSON(GraphQLInterfaceType); - -/** - * Union Type Definition - * - * When a field can return one of a heterogeneous set of types, a Union type - * is used to describe what types are possible as well as providing a function - * to determine which type is actually used when the field is resolved. - * - * Example: - * - * const PetType = new GraphQLUnionType({ - * name: 'Pet', - * types: [ DogType, CatType ], - * resolveType(value) { - * if (value instanceof Dog) { - * return DogType; - * } - * if (value instanceof Cat) { - * return CatType; - * } - * } - * }); - * - */ -export class GraphQLUnionType { - constructor(config) { - this.name = config.name; - this.description = config.description; - this.resolveType = config.resolveType; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._types = defineTypes.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - devAssert(config.resolveType == null || typeof config.resolveType === 'function', `${this.name} must provide "resolveType" as a function, ` + `but got: ${inspect(config.resolveType)}.`); - } - - getTypes() { - if (typeof this._types === 'function') { - this._types = this._types(); - } - - return this._types; - } - - toConfig() { - return { - name: this.name, - description: this.description, - types: this.getTypes(), - resolveType: this.resolveType, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [] - }; - } - - toString() { - return this.name; - } // $FlowFixMe Flow doesn't support computed properties yet - - - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLUnionType'; - } - -} -defineToJSON(GraphQLUnionType); - -function defineTypes(config) { - const types = resolveThunk(config.types); - devAssert(Array.isArray(types), `Must provide Array of types or a function which returns such an array for Union ${config.name}.`); - return types; -} - -/** - * Enum Type Definition - * - * Some leaf values of requests and input values are Enums. GraphQL serializes - * Enum values as strings, however internally Enums can be represented by any - * kind of type, often integers. - * - * Example: - * - * const RGBType = new GraphQLEnumType({ - * name: 'RGB', - * values: { - * RED: { value: 0 }, - * GREEN: { value: 1 }, - * BLUE: { value: 2 } - * } - * }); - * - * Note: If a value is not provided in a definition, the name of the enum value - * will be used as its internal value. - */ -export class GraphQLEnumType -/* */ -{ - constructor(config) { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._values = defineEnumValues(this.name, config.values); - this._valueLookup = new Map(this._values.map(enumValue => [enumValue.value, enumValue])); - this._nameLookup = keyMap(this._values, value => value.name); - devAssert(typeof config.name === 'string', 'Must provide name.'); - } - - getValues() { - return this._values; - } - - getValue(name) { - return this._nameLookup[name]; - } - - serialize(outputValue) { - const enumValue = this._valueLookup.get(outputValue); - - if (enumValue === undefined) { - throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${inspect(outputValue)}`); - } - - return enumValue.name; - } - - parseValue(inputValue) - /* T */ - { - if (typeof inputValue !== 'string') { - const valueStr = inspect(inputValue); - throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + didYouMeanEnumValue(this, valueStr)); - } - - const enumValue = this.getValue(inputValue); - - if (enumValue == null) { - throw new GraphQLError(`Value "${inputValue}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, inputValue)); - } - - return enumValue.value; - } - - parseLiteral(valueNode, _variables) - /* T */ - { - // Note: variables will be resolved to a value before calling this function. - if (valueNode.kind !== Kind.ENUM) { - const valueStr = print(valueNode); - throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + didYouMeanEnumValue(this, valueStr), valueNode); - } - - const enumValue = this.getValue(valueNode.value); - - if (enumValue == null) { - const valueStr = print(valueNode); - throw new GraphQLError(`Value "${valueStr}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, valueStr), valueNode); - } - - return enumValue.value; - } - - toConfig() { - const values = keyValMap(this.getValues(), value => value.name, value => ({ - description: value.description, - value: value.value, - deprecationReason: value.deprecationReason, - extensions: value.extensions, - astNode: value.astNode - })); - return { - name: this.name, - description: this.description, - values, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [] - }; - } - - toString() { - return this.name; - } // $FlowFixMe Flow doesn't support computed properties yet - - - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLEnumType'; - } - -} -defineToJSON(GraphQLEnumType); - -function didYouMeanEnumValue(enumType, unknownValueStr) { - const allNames = enumType.getValues().map(value => value.name); - const suggestedValues = suggestionList(unknownValueStr, allNames); - return didYouMean('the enum value', suggestedValues); -} - -function defineEnumValues(typeName, valueMap) { - devAssert(isPlainObj(valueMap), `${typeName} values must be an object with value names as keys.`); - return objectEntries(valueMap).map(([valueName, valueConfig]) => { - devAssert(isPlainObj(valueConfig), `${typeName}.${valueName} must refer to an object with a "value" key ` + `representing an internal value but got: ${inspect(valueConfig)}.`); - devAssert(!('isDeprecated' in valueConfig), `${typeName}.${valueName} should provide "deprecationReason" instead of "isDeprecated".`); - return { - name: valueName, - description: valueConfig.description, - value: valueConfig.value !== undefined ? valueConfig.value : valueName, - isDeprecated: valueConfig.deprecationReason != null, - deprecationReason: valueConfig.deprecationReason, - extensions: valueConfig.extensions && toObjMap(valueConfig.extensions), - astNode: valueConfig.astNode - }; - }); -} - -/** - * Input Object Type Definition - * - * An input object defines a structured collection of fields which may be - * supplied to a field argument. - * - * Using `NonNull` will ensure that a value must be provided by the query - * - * Example: - * - * const GeoPoint = new GraphQLInputObjectType({ - * name: 'GeoPoint', - * fields: { - * lat: { type: GraphQLNonNull(GraphQLFloat) }, - * lon: { type: GraphQLNonNull(GraphQLFloat) }, - * alt: { type: GraphQLFloat, defaultValue: 0 }, - * } - * }); - * - */ -export class GraphQLInputObjectType { - constructor(config) { - this.name = config.name; - this.description = config.description; - this.extensions = config.extensions && toObjMap(config.extensions); - this.astNode = config.astNode; - this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes); - this._fields = defineInputFieldMap.bind(undefined, config); - devAssert(typeof config.name === 'string', 'Must provide name.'); - } - - getFields() { - if (typeof this._fields === 'function') { - this._fields = this._fields(); - } - - return this._fields; - } - - toConfig() { - const fields = mapValue(this.getFields(), field => ({ - description: field.description, - type: field.type, - defaultValue: field.defaultValue, - extensions: field.extensions, - astNode: field.astNode - })); - return { - name: this.name, - description: this.description, - fields, - extensions: this.extensions, - astNode: this.astNode, - extensionASTNodes: this.extensionASTNodes ?? [] - }; - } - - toString() { - return this.name; - } // $FlowFixMe Flow doesn't support computed properties yet - - - get [SYMBOL_TO_STRING_TAG]() { - return 'GraphQLInputObjectType'; - } - -} -defineToJSON(GraphQLInputObjectType); - -function defineInputFieldMap(config) { - const fieldMap = resolveThunk(config.fields); - devAssert(isPlainObj(fieldMap), `${config.name} fields must be an object with field names as keys or a function which returns such an object.`); - return mapValue(fieldMap, (fieldConfig, fieldName) => { - devAssert(!('resolve' in fieldConfig), `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`); - return { - name: fieldName, - description: fieldConfig.description, - type: fieldConfig.type, - defaultValue: fieldConfig.defaultValue, - extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions), - astNode: fieldConfig.astNode - }; - }); -} - -export function isRequiredInputField(field) { - return isNonNullType(field.type) && field.defaultValue === undefined; -} \ No newline at end of file diff --git a/crates/swc_bundler/tests/.cache/deno/2b4079a6a55d242f35211a78092b8ba2fcc7fd3e.ts b/crates/swc_bundler/tests/.cache/deno/2b4079a6a55d242f35211a78092b8ba2fcc7fd3e.ts deleted file mode 100644 index 63d90e70a523..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2b4079a6a55d242f35211a78092b8ba2fcc7fd3e.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Loaded from https://deno.land/x/compress@v0.3.8/zlib/zlib/zstream.ts - - -export default class ZStream { - /* next input byte */ - input: Uint8Array | null = null; // JS specific, because we have no pointers - next_in = 0; - /* number of bytes available at input */ - avail_in = 0; - /* total number of input bytes read so far */ - total_in = 0; - /* next output byte should be put there */ - output: Uint8Array | null = null; // JS specific, because we have no pointers - next_out = 0; - /* remaining free space at output */ - avail_out = 0; - /* total number of bytes output so far */ - total_out = 0; - /* last error message, NULL if no error */ - msg = "" /*Z_NULL*/; - /* not visible by applications */ - state: any = null; - /* best guess about the data type: binary or text */ - data_type = 2 /*Z_UNKNOWN*/; - /* adler32 value of the uncompressed data */ - adler = 0; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2b5bb73daef23a2398824e9a41373be137249c6e.ts b/crates/swc_bundler/tests/.cache/deno/2b5bb73daef23a2398824e9a41373be137249c6e.ts deleted file mode 100644 index ded28fd2073e..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2b5bb73daef23a2398824e9a41373be137249c6e.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts - - -import { eventHandlers } from "../../bot.ts"; -import { cacheHandlers } from "../../cache.ts"; -import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts"; -import type { MessageReactionRemoveEmoji } from "../../types/messages/message_reaction_remove_emoji.ts"; -import { snowflakeToBigint } from "../../util/bigint.ts"; - -export async function handleMessageReactionRemoveEmoji(data: DiscordGatewayPayload) { - const payload = data.d as MessageReactionRemoveEmoji; - const message = await cacheHandlers.get("messages", snowflakeToBigint(payload.messageId)); - - if (message?.reactions) { - message.reactions = message.reactions.filter( - (reaction) => - !( - // MUST USE == because discord sends null and we use undefined - (reaction.emoji.id == payload.emoji.id && reaction.emoji.name === payload.emoji.name) - ) - ); - - if (!message.reactions.length) message.reactions = undefined; - - await cacheHandlers.set("messages", message.id, message); - } - - eventHandlers.reactionRemoveEmoji?.( - payload.emoji, - snowflakeToBigint(payload.messageId), - snowflakeToBigint(payload.channelId), - payload.guildId ? snowflakeToBigint(payload.guildId) : undefined - ); -} diff --git a/crates/swc_bundler/tests/.cache/deno/2b6e1c0654e1bf9f7f6102b05190cf351b39aca9.ts b/crates/swc_bundler/tests/.cache/deno/2b6e1c0654e1bf9f7f6102b05190cf351b39aca9.ts deleted file mode 100644 index 0d99f6e02b58..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2b6e1c0654e1bf9f7f6102b05190cf351b39aca9.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/types/discovery/discovery_category.ts - - -import { DiscoveryName } from "./discovery_name.ts"; - -//TODO: add docs link -export interface DiscoveryCategory { - /** Numeric id of the category */ - id: number; - /** The name of this category, in mutliple languages */ - name: DiscoveryName; - /** Whether this category can be set as a guild's primary category */ - isPrimary: boolean; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2b7b6bbc4b86ce27fdfaa13b6b7795eb23690606.ts b/crates/swc_bundler/tests/.cache/deno/2b7b6bbc4b86ce27fdfaa13b6b7795eb23690606.ts deleted file mode 100644 index 9f19e2c2ca2d..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2b7b6bbc4b86ce27fdfaa13b6b7795eb23690606.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/guilds/get_widget_image_url.ts - - -import { cacheHandlers } from "../../cache.ts"; -import type { GetGuildWidgetImageQuery } from "../../types/guilds/get_guild_widget_image.ts"; -import { Errors } from "../../types/discordeno/errors.ts"; -import { endpoints } from "../../util/constants.ts"; - -/** Returns the widget image URL for the guild. */ -export async function getWidgetImageURL(guildId: bigint, options?: GetGuildWidgetImageQuery & { force?: boolean }) { - if (!options?.force) { - const guild = await cacheHandlers.get("guilds", guildId); - if (!guild) throw new Error(Errors.GUILD_NOT_FOUND); - if (!guild.widgetEnabled) throw new Error(Errors.GUILD_WIDGET_NOT_ENABLED); - } - - return `${endpoints.GUILD_WIDGET(guildId)}.png?style=${options?.style ?? "shield"}`; -} diff --git a/crates/swc_bundler/tests/.cache/deno/2b85ac5eb77f99400bf84a9424fc4de3e0475e48.ts b/crates/swc_bundler/tests/.cache/deno/2b85ac5eb77f99400bf84a9424fc4de3e0475e48.ts deleted file mode 100644 index d74b41cbe8e0..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2b85ac5eb77f99400bf84a9424fc4de3e0475e48.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Loaded from https://deno.land/std@0.84.0/encoding/utf8.ts - - -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -/** A default TextEncoder instance */ -export const encoder = new TextEncoder(); - -/** Shorthand for new TextEncoder().encode() */ -export function encode(input?: string): Uint8Array { - return encoder.encode(input); -} - -/** A default TextDecoder instance */ -export const decoder = new TextDecoder(); - -/** Shorthand for new TextDecoder().decode() */ -export function decode(input?: Uint8Array): string { - return decoder.decode(input); -} diff --git a/crates/swc_bundler/tests/.cache/deno/2b8953b5ddb1067a9a564a6120dd2b289242bfdc.ts b/crates/swc_bundler/tests/.cache/deno/2b8953b5ddb1067a9a564a6120dd2b289242bfdc.ts deleted file mode 100644 index 1ace724d61d9..000000000000 --- a/crates/swc_bundler/tests/.cache/deno/2b8953b5ddb1067a9a564a6120dd2b289242bfdc.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/templates/edit_guild_template.ts - - -import { rest } from "../../rest/rest.ts"; -import type { ModifyGuildTemplate } from "../../types/templates/modify_guild_template.ts"; -import type { Template } from "../../types/templates/template.ts"; -import { endpoints } from "../../util/constants.ts"; -import { requireBotGuildPermissions } from "../../util/permissions.ts"; - -/** - * Edit a template's metadata. - * Requires the `MANAGE_GUILD` permission. - */ -export async function editGuildTemplate(guildId: bigint, templateCode: string, data: ModifyGuildTemplate) { - await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - - if (data.name?.length && (data.name.length < 1 || data.name.length > 100)) { - throw new Error("The name can only be in between 1-100 characters."); - } - - if (data.description?.length && data.description.length > 120) { - throw new Error("The description can only be in between 0-120 characters."); - } - - return await rest.runMethod