diff --git a/Cargo.lock b/Cargo.lock index 578ed8f5b..e407767e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -228,6 +228,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "assert-unchecked" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7330592adf847ee2e3513587b4db2db410a0d751378654e7e993d9adcbe5c795" + [[package]] name = "ast_node" version = "2.0.0" @@ -237,7 +243,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -248,7 +254,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -279,7 +285,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -350,9 +356,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] @@ -510,7 +516,7 @@ checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -583,6 +589,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "castaway" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.0.83" @@ -690,7 +705,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -760,6 +775,20 @@ dependencies = [ "memchr", ] +[[package]] +name = "compact_str" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + [[package]] name = "console" version = "0.15.8" @@ -769,7 +798,7 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", + "unicode-width 0.1.11", "windows-sys 0.52.0", ] @@ -876,6 +905,12 @@ dependencies = [ "windows-sys 0.33.0", ] +[[package]] +name = "cow-utils" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" + [[package]] name = "cpufeatures" version = "0.2.12" @@ -1082,7 +1117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" dependencies = [ "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -1130,7 +1165,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -1152,7 +1187,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -1263,7 +1298,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -1283,7 +1318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core 0.20.2", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -1547,7 +1582,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -1568,7 +1603,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -1747,6 +1782,24 @@ dependencies = [ "farmfe_utils 0.1.6", ] +[[package]] +name = "farmfe_plugin_dts" +version = "0.0.0" +dependencies = [ + "farmfe_core", + "farmfe_macro_plugin", + "farmfe_toolkit", + "farmfe_toolkit_plugin_types", + "oxc_allocator", + "oxc_parser", + "oxc_span", + "oxc_transformer", + "regex", + "serde", + "serde_json", + "url", +] + [[package]] name = "farmfe_plugin_html" version = "0.0.12" @@ -1937,7 +1990,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -2093,7 +2146,7 @@ checksum = "8d7ccf961415e7aa17ef93dcb6c2441faaa8e768abe09e659b908089546f74c5" dependencies = [ "proc-macro2", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -2173,7 +2226,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -2256,7 +2309,7 @@ checksum = "b0e085ded9f1267c32176b40921b9754c474f7dd96f7e808d4a982e48aa1e854" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -2509,7 +2562,7 @@ dependencies = [ "new_debug_unreachable", "once_cell", "phf", - "rustc-hash", + "rustc-hash 1.1.0", "triomphe", ] @@ -2624,7 +2677,7 @@ dependencies = [ "libflate", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -2659,7 +2712,7 @@ dependencies = [ "instant", "number_prefix", "portable-atomic", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -2737,7 +2790,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -2989,7 +3042,7 @@ version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", "redox_syscall 0.4.1", ] @@ -3000,7 +3053,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", ] @@ -3091,9 +3144,9 @@ checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" @@ -3133,9 +3186,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -3149,7 +3202,7 @@ dependencies = [ "miette-derive 5.10.0", "once_cell", "thiserror", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -3163,7 +3216,7 @@ dependencies = [ "owo-colors", "textwrap", "thiserror", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -3174,7 +3227,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -3185,7 +3238,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -3244,7 +3297,7 @@ version = "2.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1bd081bbaef43600fd2c5dd4c525b8ecea7dfdacf40ebc674e87851dce6559e" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "ctor 0.2.6", "napi-derive", "napi-sys", @@ -3270,7 +3323,7 @@ dependencies = [ "napi-derive-backend", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -3285,7 +3338,7 @@ dependencies = [ "quote", "regex", "semver 1.0.21", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -3379,6 +3432,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nonmax" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" + [[package]] name = "normpath" version = "0.2.0" @@ -3394,7 +3453,7 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "crossbeam-channel", "filetime", "fsevent-sys", @@ -3409,11 +3468,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", "serde", @@ -3427,11 +3485,10 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] @@ -3493,7 +3550,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -3559,7 +3616,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "block2 0.5.1", "libc", "objc2 0.5.2", @@ -3575,7 +3632,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "block2 0.5.1", "objc2 0.5.2", "objc2-foundation", @@ -3614,7 +3671,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "block2 0.5.1", "libc", "objc2 0.5.2", @@ -3626,7 +3683,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "block2 0.5.1", "objc2 0.5.2", "objc2-foundation", @@ -3638,7 +3695,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "block2 0.5.1", "objc2 0.5.2", "objc2-foundation", @@ -3692,9 +3749,288 @@ dependencies = [ [[package]] name = "owo-colors" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" +checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" + +[[package]] +name = "oxc-browserslist" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d240f6572a29895f324ad834a42a0c4bad0739269a08d0181ad7d6db7537e0d1" +dependencies = [ + "nom", + "rustc-hash 2.0.0", + "serde", + "serde_json", + "thiserror", + "time", +] + +[[package]] +name = "oxc-miette" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e03e63fd113c068b82d07c9c614b0b146c08a3ac0a4dface3ea1d1a9d14d549e" +dependencies = [ + "cfg-if", + "owo-colors", + "oxc-miette-derive", + "textwrap", + "thiserror", + "unicode-width 0.2.0", +] + +[[package]] +name = "oxc-miette-derive" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e21f680e8c5f1900297d394627d495351b9e37761f7bbf90116bd5eeb6e80967" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "oxc_allocator" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "931f734a61f63a0571163b160b764d90d83077c4d2631d15b26fe1b66763dad8" +dependencies = [ + "allocator-api2", + "bumpalo", +] + +[[package]] +name = "oxc_ast" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9a771175e84c2324c841fe7ca3ddacb5df8102f043e2fc3e96d0bfee039c13d" +dependencies = [ + "bitflags 2.6.0", + "cow-utils", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", + "oxc_regular_expression", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_ast_macros" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed71131e79889e226fb6510b90fa1a4a7495c8fdac43a4f505334fb0f1324e3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "oxc_cfg" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e13f126deb1a5c4ac158816cd6dae5ad22004e9010de1b59e8fbfa20d636872" +dependencies = [ + "bitflags 2.6.0", + "itertools 0.13.0", + "nonmax", + "oxc_index", + "oxc_syntax", + "petgraph", + "rustc-hash 2.0.0", +] + +[[package]] +name = "oxc_data_structures" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60c1e9651f904dd130930ae4d567147e06155600f7e545376558a8f476ca398c" +dependencies = [ + "assert-unchecked", +] + +[[package]] +name = "oxc_diagnostics" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37049d46eb02a97e4cc0900672a921666393c642c1ad419a20d483285f5b590" +dependencies = [ + "oxc-miette", + "rustc-hash 2.0.0", +] + +[[package]] +name = "oxc_ecmascript" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93b4201e1ebf6c13ed7296268ef08dabb864218e835f2b1f174eea73958888d5" +dependencies = [ + "num-bigint", + "num-traits", + "oxc_ast", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_estree" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fa45c638ccfd88b5c26147b0a98e1e8dd49542327dda94445b940ef91920d6a" + +[[package]] +name = "oxc_index" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae76739229d0cc5e834e0e3b9e8c4078a86828ff47f5bc71138e4571ce528f83" + +[[package]] +name = "oxc_parser" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0106e10cd67a59d91a75232d4c40f188b8532efea9b9bbed110bce157e7d3b9a" +dependencies = [ + "assert-unchecked", + "bitflags 2.6.0", + "cow-utils", + "memchr", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_ast", + "oxc_diagnostics", + "oxc_regular_expression", + "oxc_span", + "oxc_syntax", + "rustc-hash 2.0.0", + "seq-macro", +] + +[[package]] +name = "oxc_regular_expression" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bd0d5b1b943173378a5f61d6a4c49edc7e8c9157241e9bbba54594d7449b4c" +dependencies = [ + "oxc_allocator", + "oxc_ast_macros", + "oxc_diagnostics", + "oxc_estree", + "oxc_span", + "phf", + "rustc-hash 2.0.0", + "unicode-id-start", +] + +[[package]] +name = "oxc_semantic" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90df00caf2d0bc7adf30f60e16b7b0672f92e328d025b00b5ea0ace2edffb5c2" +dependencies = [ + "assert-unchecked", + "indexmap 2.6.0", + "itertools 0.13.0", + "oxc_allocator", + "oxc_ast", + "oxc_cfg", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_index", + "oxc_span", + "oxc_syntax", + "phf", + "rustc-hash 2.0.0", +] + +[[package]] +name = "oxc_span" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7b5d7caf8a20611f34c5c9ebdf232b6b42498e5424d02ef1e2dffe31553b49f" +dependencies = [ + "compact_str", + "oxc-miette", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", +] + +[[package]] +name = "oxc_syntax" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3135d5ddd0dc8ca535c0ac517a526ace8cac2699bb1345064c9fe046ca761dfa" +dependencies = [ + "assert-unchecked", + "bitflags 2.6.0", + "dashmap 6.1.0", + "nonmax", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", + "oxc_index", + "oxc_span", + "phf", + "rustc-hash 2.0.0", + "ryu-js", + "unicode-id-start", +] + +[[package]] +name = "oxc_transformer" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ddfedbd5af5e66b6d1d0165a5e81c473544e77d1aa0e1552dd1c3d43541f008" +dependencies = [ + "base64 0.22.1", + "cow-utils", + "dashmap 6.1.0", + "indexmap 2.6.0", + "itoa", + "oxc-browserslist", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_parser", + "oxc_regular_expression", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "oxc_traverse", + "ropey", + "rustc-hash 2.0.0", + "serde", + "serde_json", + "sha1", +] + +[[package]] +name = "oxc_traverse" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef6ab3d857d404750ae266d1ade5ba95e6d59d617a92b44b2c63d860fc887e3" +dependencies = [ + "compact_str", + "itoa", + "memoffset 0.9.1", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_ecmascript", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "rustc-hash 2.0.0", +] [[package]] name = "parking_lot" @@ -3748,9 +4084,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", "indexmap 2.6.0", @@ -3786,7 +4122,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -3815,7 +4151,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -3930,9 +4266,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -4317,11 +4653,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64 0.21.7", - "bitflags 2.5.0", + "bitflags 2.6.0", "serde", "serde_derive", ] +[[package]] +name = "ropey" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93411e420bcd1a75ddd1dc3caf18c23155eda2c090631a85af21ba19e97093b5" +dependencies = [ + "smallvec", + "str_indices", +] + [[package]] name = "rust-embed" version = "8.5.0" @@ -4344,7 +4690,7 @@ dependencies = [ "quote", "rust-embed-utils", "shellexpand", - "syn 2.0.65", + "syn 2.0.87", "walkdir", ] @@ -4370,6 +4716,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc_version" version = "0.2.3" @@ -4394,7 +4746,7 @@ version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -4428,9 +4780,9 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "ryu-js" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4950d85bc52415f8432144c97c4791bd0c4f7954de32a7270ee9cccd3c22b12b" +checksum = "ad97d4ce1560a5e27cec89519dc8300d1aa6035b099821261c651486a19e44d5" [[package]] name = "same-file" @@ -4453,7 +4805,7 @@ dependencies = [ "parking_lot", "prost", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "serde", "serde_json", "url", @@ -4482,7 +4834,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -4533,11 +4885,17 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "seq-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" + [[package]] name = "serde" -version = "1.0.204" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -4555,13 +4913,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -4572,17 +4930,18 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "indexmap 2.6.0", "itoa", + "memchr", "ryu", "serde", ] @@ -4807,7 +5166,7 @@ dependencies = [ "data-encoding", "debugid", "if_chain", - "rustc-hash", + "rustc-hash 1.1.0", "rustc_version 0.2.3", "serde", "serde_json", @@ -4861,7 +5220,7 @@ checksum = "9cf483ea7e0e3a03d1b91687895814425149ad77facd3e2b6839dde26da98454" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -4870,6 +5229,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "str_indices" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" + [[package]] name = "string_enum" version = "1.0.0" @@ -4879,7 +5244,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -4909,7 +5274,7 @@ dependencies = [ "bumpalo", "hashbrown 0.14.5", "ptr_meta", - "rustc-hash", + "rustc-hash 1.1.0", "triomphe", ] @@ -4923,7 +5288,7 @@ dependencies = [ "hstr", "once_cell", "rkyv", - "rustc-hash", + "rustc-hash 1.1.0", "serde", ] @@ -4959,7 +5324,7 @@ dependencies = [ "once_cell", "parking_lot", "rkyv", - "rustc-hash", + "rustc-hash 1.1.0", "serde", "siphasher", "sourcemap", @@ -4968,7 +5333,7 @@ dependencies = [ "swc_eq_ignore_macros", "swc_visit", "tracing", - "unicode-width", + "unicode-width 0.1.11", "url", ] @@ -4996,7 +5361,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5019,8 +5384,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5975118f6d3fe1cff7e7073999a9ffc37f55b9f57c1e4e11d81ca3cb6dda2d1c" dependencies = [ "auto_impl", - "bitflags 2.5.0", - "rustc-hash", + "bitflags 2.6.0", + "rustc-hash 1.1.0", "serde", "swc_atoms", "swc_common", @@ -5038,7 +5403,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5061,7 +5426,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf51da567426fa8850597ccd115572aca04b93dfaeb2a43ee8e5fc5d5849ba6c" dependencies = [ - "rustc-hash", + "rustc-hash 1.1.0", "serde", "swc_atoms", "swc_common", @@ -5135,7 +5500,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99e7c0cd9dfe2a49c8f0b4ce699c13c9e270b8487a0176e1d89e5a9a586d0b3b" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "bytecheck", "is-macro", "num-bigint", @@ -5179,7 +5544,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5221,7 +5586,7 @@ dependencies = [ "arrayvec", "indexmap 2.6.0", "is-macro", - "rustc-hash", + "rustc-hash 1.1.0", "serde", "serde_derive", "smallvec", @@ -5414,7 +5779,7 @@ dependencies = [ "phf", "radix_fmt", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "ryu-js", "serde", "serde_json", @@ -5467,7 +5832,7 @@ dependencies = [ "indexmap 2.6.0", "once_cell", "preset_env_base", - "rustc-hash", + "rustc-hash 1.1.0", "semver 1.0.21", "serde", "serde_json", @@ -5508,12 +5873,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6f43d1983d48dca819a7d0c79c5eb98011a2f8759acbddd972858ec228c66d4" dependencies = [ "better_scoped_tls", - "bitflags 2.5.0", + "bitflags 2.6.0", "indexmap 2.6.0", "once_cell", "phf", "rayon", - "rustc-hash", + "rustc-hash 1.1.0", "serde", "smallvec", "swc_atoms", @@ -5585,7 +5950,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5596,7 +5961,7 @@ checksum = "25f8b1f049d172e4b83167751293728ce0c4692e364c1ffbce7af35bb7dad855" dependencies = [ "Inflector", "anyhow", - "bitflags 2.5.0", + "bitflags 2.6.0", "indexmap 2.6.0", "is-macro", "path-clean 1.0.1", @@ -5626,7 +5991,7 @@ dependencies = [ "once_cell", "petgraph", "rayon", - "rustc-hash", + "rustc-hash 1.1.0", "serde_json", "swc_atoms", "swc_common", @@ -5647,7 +6012,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3090cde1901f95b5430171709acc319cd36acda5c2a4a77706656ede5fbdd4f" dependencies = [ "either", - "rustc-hash", + "rustc-hash 1.1.0", "serde", "smallvec", "swc_atoms", @@ -5710,7 +6075,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c85c31dad1d402a52394eb184742a7095ba02277c55df327b89fb8bd65e59a7c" dependencies = [ "indexmap 2.6.0", - "rustc-hash", + "rustc-hash 1.1.0", "swc_atoms", "swc_common", "swc_ecma_ast", @@ -5730,7 +6095,7 @@ dependencies = [ "num_cpus", "once_cell", "rayon", - "rustc-hash", + "rustc-hash 1.1.0", "ryu-js", "swc_atoms", "swc_common", @@ -5763,7 +6128,7 @@ checksum = "e96e15288bf385ab85eb83cff7f9e2d834348da58d0a31b33bdb572e66ee413e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5787,7 +6152,7 @@ checksum = "b1b3add3571bc073f49b4f4fb4326f54c24fe7799296e0ad5341af895150e79c" dependencies = [ "indexmap 2.6.0", "petgraph", - "rustc-hash", + "rustc-hash 1.1.0", "swc_common", ] @@ -5811,8 +6176,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12419d070a0d184f599e804394d357d5c05f9a4264543ab62a057429ba86a95d" dependencies = [ "auto_impl", - "bitflags 2.5.0", - "rustc-hash", + "bitflags 2.6.0", + "rustc-hash 1.1.0", "swc_atoms", "swc_common", "swc_html_ast", @@ -5829,7 +6194,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5907,7 +6272,7 @@ checksum = "a509f56fca05b39ba6c15f3e58636c3924c78347d63853632ed2ffcb6f5a0ac7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5966,7 +6331,7 @@ checksum = "4c78717a841565df57f811376a3d19c9156091c55175e12d378f3a522de70cef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -5992,9 +6357,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.65" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -6068,13 +6433,13 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" dependencies = [ "smawk", "unicode-linebreak", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -6094,7 +6459,7 @@ checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -6176,7 +6541,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -6269,7 +6634,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] @@ -6379,6 +6744,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.2.4" @@ -6644,7 +7015,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", "wasm-bindgen-shared", ] @@ -6678,7 +7049,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6887,7 +7258,7 @@ dependencies = [ "lazy_static", "libc", "mach2", - "memoffset 0.9.0", + "memoffset 0.9.1", "more-asserts", "region", "scopeguard", @@ -6993,7 +7364,7 @@ version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "indexmap 2.6.0", "semver 1.0.21", ] @@ -7006,7 +7377,7 @@ checksum = "a259b226fd6910225aa7baeba82f9d9933b6d00f2ce1b49b80fa4214328237cc" dependencies = [ "leb128", "memchr", - "unicode-width", + "unicode-width 0.1.11", "wasm-encoder", ] @@ -7630,7 +8001,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.65", + "syn 2.0.87", ] [[package]] diff --git a/examples/lib/README.md b/examples/lib/README.md new file mode 100644 index 000000000..9b6558c88 --- /dev/null +++ b/examples/lib/README.md @@ -0,0 +1,37 @@ +# Farm + TypeScript + +This template should help you start developing using TypeScript in Farm. + +## Setup + +Install the dependencies: + +```bash +pnpm install +``` + +## Get Started + +Start the dev server: + +```bash +pnpm start +``` + +Build the app for production: + +```bash +pnpm build +``` + +Preview the Production build product: + +```bash +pnpm preview +``` + +Clear persistent cache local files + +```bash +pnpm clean +``` diff --git a/examples/lib/farm.config.ts b/examples/lib/farm.config.ts new file mode 100644 index 000000000..d3c8e8d7d --- /dev/null +++ b/examples/lib/farm.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from '@farmfe/core'; + +export default defineConfig({ + compilation: { + presetEnv: false, + progress: false, + input: { + index: "./index.ts" + }, + persistentCache: false + }, + plugins: ['@farmfe/plugin-dts'] +}); diff --git a/examples/lib/index.ts b/examples/lib/index.ts new file mode 100644 index 000000000..d8c9a7d7e --- /dev/null +++ b/examples/lib/index.ts @@ -0,0 +1 @@ +export const a: number = 1; diff --git a/examples/lib/package.json b/examples/lib/package.json new file mode 100644 index 000000000..f130634fd --- /dev/null +++ b/examples/lib/package.json @@ -0,0 +1,15 @@ +{ + "name": "lib", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "build": "farm build", + "clean": "farm clean" + }, + "devDependencies": { + "@farmfe/cli": "workspace:*", + "typescript": "^5.4.3", + "@farmfe/plugin-dts": "workspace:*" + } +} diff --git a/examples/lib/tsconfig.json b/examples/lib/tsconfig.json new file mode 100644 index 000000000..145dd74ad --- /dev/null +++ b/examples/lib/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} \ No newline at end of file diff --git a/examples/lib/tsconfig.node.json b/examples/lib/tsconfig.node.json new file mode 100644 index 000000000..8d4232518 --- /dev/null +++ b/examples/lib/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true + }, + "include": ["farm.config.ts"] +} diff --git a/js-plugins/less/farm.config.mjs b/js-plugins/less/farm.config.mjs index f5e5cb18d..917b5ae60 100644 --- a/js-plugins/less/farm.config.mjs +++ b/js-plugins/less/farm.config.mjs @@ -1,8 +1,9 @@ -import farmDtsPlugin from '@farmfe/js-plugin-dts'; +// import farmDtsPlugin from '@farmfe/js-plugin-dts'; import { createFarmJsPluginBuildConfig } from '../../configs/farm-js-plugin.base.config.mjs'; export default createFarmJsPluginBuildConfig([ - farmDtsPlugin({ - tsConfigPath: './tsconfig.build.json' - }) + // farmDtsPlugin({ + // tsConfigPath: './tsconfig.build.json' + // }), + // '@farmfe/plugin-dts' ]); diff --git a/js-plugins/less/package.json b/js-plugins/less/package.json index 0acf711bf..a53a8e652 100644 --- a/js-plugins/less/package.json +++ b/js-plugins/less/package.json @@ -42,6 +42,7 @@ "@farmfe/cli": "workspace:*", "@farmfe/core": "workspace:*", "@farmfe/js-plugin-dts": "workspace:^", + "@farmfe/plugin-dts": "workspace:*", "@types/less": "^3.0.3", "less": "^4.1.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c426e3c41..f57017e15 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -744,6 +744,18 @@ importers: specifier: ^0.14.0 version: 0.14.0 + examples/lib: + devDependencies: + '@farmfe/cli': + specifier: workspace:* + version: link:../../packages/cli + '@farmfe/plugin-dts': + specifier: workspace:* + version: link:../../rust-plugins/dts + typescript: + specifier: ^5.4.3 + version: 5.6.3 + examples/lib-for-browser: dependencies: react-refresh: @@ -2099,7 +2111,7 @@ importers: version: 0.2.5(vue@2.6.14) tdesign-vue: specifier: latest - version: 1.10.4(vue@2.6.14) + version: 1.10.5(vue@2.6.14) vite-plugin-vue2-svg: specifier: ^0.4.0 version: 0.4.0(ejs@3.1.10)(lodash@4.17.21)(vue-template-compiler@2.6.14(vue@2.6.14)) @@ -2133,7 +2145,7 @@ importers: version: 0.2.5(vue@2.7.16) tdesign-vue: specifier: latest - version: 1.10.4(vue@2.7.16) + version: 1.10.5(vue@2.7.16) vite-plugin-vue2-svg: specifier: ^0.4.0 version: 0.4.0(ejs@3.1.10)(lodash@4.17.21)(vue-template-compiler@2.7.16(vue@2.7.16)) @@ -2413,6 +2425,9 @@ importers: '@farmfe/js-plugin-dts': specifier: workspace:^ version: link:../dts + '@farmfe/plugin-dts': + specifier: workspace:* + version: link:../../rust-plugins/dts '@types/less': specifier: ^3.0.3 version: 3.0.5 @@ -2846,6 +2861,12 @@ importers: packages/utils: {} + rust-plugins/dts: + devDependencies: + '@farmfe/plugin-tools': + specifier: workspace:* + version: link:../../packages/plugin-tools + rust-plugins/react: devDependencies: '@farmfe/plugin-tools': @@ -18567,8 +18588,8 @@ packages: peerDependencies: vue: ^2.6.12 - tdesign-vue@1.10.4: - resolution: {integrity: sha512-ej4QgA/E9DsxlMzr1++pomREgpncniP1llMT2qGIkZ4vtpHJV3CjBIf6eDLtWTUWz3c8B5RM8lAqm2ZxSvGCEg==} + tdesign-vue@1.10.5: + resolution: {integrity: sha512-D/833QpG7N0zH7lN7zhuegKJN0AVklAhrUKG7zmKcPrEZKaL7jjGz9lr6UOU/CJAEae0dij8YQtcscEIq3ugqw==} peerDependencies: vue: ~2.6.10 @@ -42122,8 +42143,8 @@ snapshots: picocolors: 1.0.0 sade: 1.8.1 svelte: 4.0.0 - svelte-preprocess: 5.1.3(@babel/core@7.25.2)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.47)(ts-node@10.9.1(@swc/core@1.7.26(@swc/helpers@0.5.3))(@types/node@22.5.0)(typescript@5.2.2)))(postcss@8.4.47)(sass@1.74.1)(svelte@4.0.0)(typescript@5.4.5) - typescript: 5.4.5 + svelte-preprocess: 5.1.3(@babel/core@7.25.2)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.47)(ts-node@10.9.1(@swc/core@1.7.26(@swc/helpers@0.5.3))(@types/node@22.5.0)(typescript@5.2.2)))(postcss@8.4.47)(sass@1.74.1)(svelte@4.0.0)(typescript@5.6.3) + typescript: 5.6.3 transitivePeerDependencies: - '@babel/core' - coffeescript @@ -42139,7 +42160,7 @@ snapshots: dependencies: svelte: 4.0.0 - svelte-preprocess@5.1.3(@babel/core@7.25.2)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.47)(ts-node@10.9.1(@swc/core@1.7.26(@swc/helpers@0.5.3))(@types/node@22.5.0)(typescript@5.2.2)))(postcss@8.4.47)(sass@1.74.1)(svelte@4.0.0)(typescript@5.4.5): + svelte-preprocess@5.1.3(@babel/core@7.25.2)(less@4.2.0)(postcss-load-config@4.0.1(postcss@8.4.47)(ts-node@10.9.1(@swc/core@1.7.26(@swc/helpers@0.5.3))(@types/node@22.5.0)(typescript@5.2.2)))(postcss@8.4.47)(sass@1.74.1)(svelte@4.0.0)(typescript@5.6.3): dependencies: '@types/pug': 2.0.10 detect-indent: 6.1.0 @@ -42153,7 +42174,7 @@ snapshots: postcss: 8.4.47 postcss-load-config: 4.0.1(postcss@8.4.47)(ts-node@10.9.1(@swc/core@1.7.26(@swc/helpers@0.5.3))(@types/node@22.5.0)(typescript@5.2.2)) sass: 1.74.1 - typescript: 5.4.5 + typescript: 5.6.3 svelte@4.0.0: dependencies: @@ -42353,7 +42374,7 @@ snapshots: classnames: 2.3.2 vue: 2.7.16 - tdesign-vue@1.10.4(vue@2.6.14): + tdesign-vue@1.10.5(vue@2.6.14): dependencies: '@babel/runtime': 7.23.2 '@popperjs/core': 2.11.8 @@ -42375,7 +42396,7 @@ snapshots: validator: 13.11.0 vue: 2.6.14 - tdesign-vue@1.10.4(vue@2.7.16): + tdesign-vue@1.10.5(vue@2.7.16): dependencies: '@babel/runtime': 7.23.2 '@popperjs/core': 2.11.8 diff --git a/rust-plugins/dts/.gitignore b/rust-plugins/dts/.gitignore new file mode 100644 index 000000000..c70c11233 --- /dev/null +++ b/rust-plugins/dts/.gitignore @@ -0,0 +1,2 @@ +*.farm +*.node \ No newline at end of file diff --git a/rust-plugins/dts/CHANGELOG.md b/rust-plugins/dts/CHANGELOG.md new file mode 100644 index 000000000..a2f8b37f3 --- /dev/null +++ b/rust-plugins/dts/CHANGELOG.md @@ -0,0 +1,7 @@ +# @farmfe/plugin-replace-dirname + +## 1.0.0-nightly-20241024075304 + +### Major Changes + +- 9a1b2b9: bump replace-dirname plugin diff --git a/rust-plugins/dts/Cargo.toml b/rust-plugins/dts/Cargo.toml new file mode 100644 index 000000000..8af4af2a9 --- /dev/null +++ b/rust-plugins/dts/Cargo.toml @@ -0,0 +1,21 @@ +[package] +edition = "2021" +name = "farmfe_plugin_dts" +version = "0.0.0" + +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +farmfe_core = { version = "*", path = "../../crates/core" } +farmfe_macro_plugin = { version = "*", path = "../../crates/macro_plugin" } +farmfe_toolkit_plugin_types = { version = "*", path = "../../crates/toolkit_plugin_types" } +farmfe_toolkit = { version = "*", path = "../../crates/toolkit" } +regex = "1.7.3" +serde = { version = "1.0", features = ["derive", "rc"] } +serde_json = { version = "1.0", features = ["preserve_order"] } +url = "2.3.1" +oxc_allocator = "0.36.0" +oxc_parser = "0.36.0" +oxc_span = "0.36.0" +oxc_transformer = "0.36.0" diff --git a/rust-plugins/dts/index.d.ts b/rust-plugins/dts/index.d.ts new file mode 100755 index 000000000..299c09ef0 --- /dev/null +++ b/rust-plugins/dts/index.d.ts @@ -0,0 +1,13 @@ +export interface IOptions { + /** + * The path to the root of the project + */ + include?: string[]; + /** + * exclude the path from the project + */ + exclude?: string[]; +} + +const binPath: string; +export default binPath; diff --git a/rust-plugins/dts/index.js b/rust-plugins/dts/index.js new file mode 100755 index 000000000..39d6258dc --- /dev/null +++ b/rust-plugins/dts/index.js @@ -0,0 +1,142 @@ +import { existsSync, readFileSync } from "fs"; +import { createRequire } from "module"; +import { dirname, join } from "path"; +import { fileURLToPath } from "url"; + +const { platform, arch } = process; +const currentDir = dirname(fileURLToPath(import.meta.url)); + +let binPath = null; + +const require = createRequire(import.meta.url); + +function isMusl() { + // For Node 10 + if (!process.report || typeof process.report.getReport !== "function") { + try { + return readFileSync("/usr/bin/ldd", "utf8").includes("musl"); + } catch (e) { + return true; + } + } else { + const { glibcVersionRuntime } = process.report.getReport().header; + return !glibcVersionRuntime; + } +} + +switch (platform) { + case "win32": + switch (arch) { + case "x64": + if (existsSync(join(currentDir, "./npm/win32-x64-msvc/index.farm"))) { + binPath = join(currentDir, "./npm/win32-x64-msvc/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-win32-x64-msvc", + ); + } + + break; + case "ia32": + if (existsSync(join(currentDir, "./npm/win32-ia32-msvc/index.farm"))) { + binPath = join(currentDir, "./npm/win32-ia32-msvc/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-win32-ia32-msvc", + ); + } + + break; + case "arm64": + if (existsSync(join(currentDir, "./npm/win32-arm64-msvc/index.farm"))) { + binPath = join(currentDir, "./npm/win32-arm64-msvc/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-win32-arm64-msvc", + ); + } + + break; + default: + throw new Error(`Unsupported architecture on Windows: ${arch}`); + } + break; + case "darwin": + switch (arch) { + case "x64": + if (existsSync(join(currentDir, "./npm/darwin-x64/index.farm"))) { + binPath = join(currentDir, "./npm/darwin-x64/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-darwin-x64", + ); + } + break; + case "arm64": + if (existsSync(join(currentDir, "./npm/darwin-arm64/index.farm"))) { + binPath = join(currentDir, "./npm/darwin-arm64/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-darwin-arm64", + ); + } + break; + default: + throw new Error(`Unsupported architecture on macOS: ${arch}`); + } + break; + case "linux": + switch (arch) { + case "x64": + if (isMusl()) { + if (existsSync(join(currentDir, "./npm/linux-x64-musl/index.farm"))) { + binPath = join(currentDir, "./npm/linux-x64-musl/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-linux-x64-musl", + ); + } + } else { + if (existsSync(join(currentDir, "./npm/linux-x64-gnu/index.farm"))) { + binPath = join(currentDir, "./npm/linux-x64-gnu/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-linux-x64-gnu", + ); + } + } + + break; + + case "arm64": + if (isMusl()) { + if ( + existsSync(join(currentDir, "./npm/linux-arm64-musl/index.farm")) + ) { + binPath = join(currentDir, "./npm/linux-arm64-musl/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-linux-arm64-musl", + ); + } + } else { + if ( + existsSync(join(currentDir, "./npm/linux-arm64-gnu/index.farm")) + ) { + binPath = join(currentDir, "./npm/linux-arm64-gnu/index.farm"); + } else { + binPath = require.resolve( + "@farmfe/plugin-dts-linux-arm64-gnu", + ); + } + } + break; + default: + throw new Error(`Unsupported architecture on Linux: ${arch}`); + } + break; + default: + throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`); +} + +export default binPath; diff --git a/rust-plugins/dts/npm/darwin-arm64/README.md b/rust-plugins/dts/npm/darwin-arm64/README.md new file mode 100644 index 000000000..a386239f4 --- /dev/null +++ b/rust-plugins/dts/npm/darwin-arm64/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-darwin-arm64` + +This is the **aarch64-apple-darwin** binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/darwin-arm64/package.json b/rust-plugins/dts/npm/darwin-arm64/package.json new file mode 100644 index 000000000..5a481bd6e --- /dev/null +++ b/rust-plugins/dts/npm/darwin-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@farmfe/plugin-replace-dirname-darwin-arm64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} diff --git a/rust-plugins/dts/npm/darwin-x64/README.md b/rust-plugins/dts/npm/darwin-x64/README.md new file mode 100644 index 000000000..31572db33 --- /dev/null +++ b/rust-plugins/dts/npm/darwin-x64/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-darwin-x64` + +This is the **x86_64-apple-darwin** binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/darwin-x64/package.json b/rust-plugins/dts/npm/darwin-x64/package.json new file mode 100644 index 000000000..752bf7950 --- /dev/null +++ b/rust-plugins/dts/npm/darwin-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@farmfe/plugin-replace-dirname-darwin-x64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} diff --git a/rust-plugins/dts/npm/linux-arm64-gnu/README.md b/rust-plugins/dts/npm/linux-arm64-gnu/README.md new file mode 100644 index 000000000..ddd7dfb9d --- /dev/null +++ b/rust-plugins/dts/npm/linux-arm64-gnu/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-react-linux-arm64-gnu` + +This is the **aarch64-unknown-linux-gnu** binary for `@farmfe/plugin-react` diff --git a/rust-plugins/dts/npm/linux-arm64-gnu/package.json b/rust-plugins/dts/npm/linux-arm64-gnu/package.json new file mode 100644 index 000000000..ccef8ff4a --- /dev/null +++ b/rust-plugins/dts/npm/linux-arm64-gnu/package.json @@ -0,0 +1,21 @@ +{ + "name": "@farmfe/plugin-replace-dirname-linux-arm64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "glibc" + ] +} diff --git a/rust-plugins/dts/npm/linux-arm64-musl/README.md b/rust-plugins/dts/npm/linux-arm64-musl/README.md new file mode 100644 index 000000000..a64fd85dd --- /dev/null +++ b/rust-plugins/dts/npm/linux-arm64-musl/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-linux-arm64-musl` + +This is the **aarch64-unknown-linux-musl** binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/linux-arm64-musl/package.json b/rust-plugins/dts/npm/linux-arm64-musl/package.json new file mode 100644 index 000000000..c9ea5b92b --- /dev/null +++ b/rust-plugins/dts/npm/linux-arm64-musl/package.json @@ -0,0 +1,21 @@ +{ + "name": "@farmfe/plugin-replace-dirname-linux-arm64-musl", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "glibc" + ] +} diff --git a/rust-plugins/dts/npm/linux-x64-gnu/README.md b/rust-plugins/dts/npm/linux-x64-gnu/README.md new file mode 100644 index 000000000..2c17903a1 --- /dev/null +++ b/rust-plugins/dts/npm/linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/linux-x64-gnu/package.json b/rust-plugins/dts/npm/linux-x64-gnu/package.json new file mode 100644 index 000000000..5a107f359 --- /dev/null +++ b/rust-plugins/dts/npm/linux-x64-gnu/package.json @@ -0,0 +1,21 @@ +{ + "name": "@farmfe/plugin-replace-dirname-linux-x64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "glibc" + ] +} diff --git a/rust-plugins/dts/npm/linux-x64-musl/README.md b/rust-plugins/dts/npm/linux-x64-musl/README.md new file mode 100644 index 000000000..4947d1e79 --- /dev/null +++ b/rust-plugins/dts/npm/linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/linux-x64-musl/package.json b/rust-plugins/dts/npm/linux-x64-musl/package.json new file mode 100644 index 000000000..e5edcbbed --- /dev/null +++ b/rust-plugins/dts/npm/linux-x64-musl/package.json @@ -0,0 +1,18 @@ +{ + "name": "@farmfe/plugin-replace-dirname-linux-x64-musl", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} diff --git a/rust-plugins/dts/npm/win32-arm64-msvc/README.md b/rust-plugins/dts/npm/win32-arm64-msvc/README.md new file mode 100644 index 000000000..7042e9575 --- /dev/null +++ b/rust-plugins/dts/npm/win32-arm64-msvc/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-win32-arm64-msvc` + +This is the aarch64-pc-windows-msvc binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/win32-arm64-msvc/package.json b/rust-plugins/dts/npm/win32-arm64-msvc/package.json new file mode 100644 index 000000000..16c9f7795 --- /dev/null +++ b/rust-plugins/dts/npm/win32-arm64-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "@farmfe/plugin-replace-dirname-win32-arm64-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "arm64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} diff --git a/rust-plugins/dts/npm/win32-ia32-msvc/README.md b/rust-plugins/dts/npm/win32-ia32-msvc/README.md new file mode 100644 index 000000000..db8c3d41a --- /dev/null +++ b/rust-plugins/dts/npm/win32-ia32-msvc/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-win32-ia32-msvc` + +This is the i686-pc-windows-msvc binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/win32-ia32-msvc/package.json b/rust-plugins/dts/npm/win32-ia32-msvc/package.json new file mode 100644 index 000000000..5d576ee19 --- /dev/null +++ b/rust-plugins/dts/npm/win32-ia32-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "@farmfe/plugin-replace-dirname-win32-ia32-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "ia32" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} diff --git a/rust-plugins/dts/npm/win32-x64-msvc/README.md b/rust-plugins/dts/npm/win32-x64-msvc/README.md new file mode 100644 index 000000000..3cf9ed74b --- /dev/null +++ b/rust-plugins/dts/npm/win32-x64-msvc/README.md @@ -0,0 +1,3 @@ +# `@farmfe/plugin-replace-dirname-win32-x64-msvc` + +This is the **x86_64-pc-windows-msvc** binary for `@farmfe/plugin-replace-dirname` diff --git a/rust-plugins/dts/npm/win32-x64-msvc/package.json b/rust-plugins/dts/npm/win32-x64-msvc/package.json new file mode 100644 index 000000000..c579d4534 --- /dev/null +++ b/rust-plugins/dts/npm/win32-x64-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "@farmfe/plugin-replace-dirname-win32-x64-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "main": "index.farm", + "files": [ + "index.farm" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} diff --git a/rust-plugins/dts/package.json b/rust-plugins/dts/package.json new file mode 100755 index 000000000..edd454983 --- /dev/null +++ b/rust-plugins/dts/package.json @@ -0,0 +1,46 @@ +{ + "name": "@farmfe/plugin-dts", + "version": "1.0.0-nightly-20241024075304", + "main": "index.js", + "types": "index.d.ts", + "type": "module", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "devDependencies": { + "@farmfe/plugin-tools": "workspace:*" + }, + "napi": { + "name": "farm_plugin_dts", + "triples": { + "additional": [ + "aarch64-apple-darwin", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl", + "x86_64-unknown-linux-musl", + "i686-pc-windows-msvc", + "aarch64-pc-windows-msvc" + ] + } + }, + "exports": { + ".": { + "import": "./index.js", + "types": "./index.d.ts", + "default": "./index.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "dev": "cargo watch -w src -s 'scripts/watch.sh'", + "build": "farm-plugin-tools build --platform --cargo-name farmfe_plugin_dts -p farmfe_plugin_dts --release", + "build:publish": "cross-env CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_STRIP=symbols CARGO_PROFILE_RELEASE_PANIC=abort CARGO_PROFILE_RELEASE_OPT_LEVEL=z farm-plugin-tools build --platform --cargo-name farmfe_plugin_dts -p farmfe_plugin_dts --release", + "prepublishOnly": "farm-plugin-tools prepublish" + }, + "files": [ + "index.js", + "index.d.ts", + "func.js" + ] +} diff --git a/rust-plugins/dts/rustfmt.toml b/rust-plugins/dts/rustfmt.toml new file mode 100755 index 000000000..cab5731ed --- /dev/null +++ b/rust-plugins/dts/rustfmt.toml @@ -0,0 +1,2 @@ +tab_spaces = 2 +edition = "2021" diff --git a/rust-plugins/dts/scripts/watch.sh b/rust-plugins/dts/scripts/watch.sh new file mode 100755 index 000000000..255a484ac --- /dev/null +++ b/rust-plugins/dts/scripts/watch.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +npm run build diff --git a/rust-plugins/dts/src/lib.rs b/rust-plugins/dts/src/lib.rs new file mode 100644 index 000000000..cacb63047 --- /dev/null +++ b/rust-plugins/dts/src/lib.rs @@ -0,0 +1,127 @@ +#![deny(clippy::all)] +use farmfe_core::{ + config::{config_regex::ConfigRegex, Config}, + context::CompilationContext, + error::CompilationError, + plugin::{ + Plugin, PluginAnalyzeDepsHookParam, PluginFinalizeModuleHookParam, + PluginGenerateResourcesHookResult, PluginHookContext, PluginLoadHookParam, + PluginLoadHookResult, PluginParseHookParam, PluginProcessModuleHookParam, + }, + swc_common::{comments::SingleThreadedComments, Mark}, + swc_ecma_ast::{Module as EcmaAstModule, ModuleItem}, + swc_ecma_parser::{lexer::Lexer, EsSyntax as EsConfig, Parser, StringInput, Syntax}, +}; +use farmfe_toolkit::swc_ecma_transforms::{helpers::inject_helpers, typescript::tsx}; +use farmfe_toolkit::{ + common::PathFilter, + swc_ecma_visit::{VisitMut, VisitMutWith}, +}; +use std::{ + path::{Path, PathBuf}, + sync::Arc, +}; + +use farmfe_macro_plugin::farm_plugin; + +#[farm_plugin] +pub struct FarmPluginDts { + options: FarmPluginDtsOptions, +} + +#[derive(serde::Deserialize)] +pub struct FarmPluginDtsOptions { + exclude: Vec, + include: Vec, +} + +impl Default for FarmPluginDtsOptions { + fn default() -> Self { + Self { + exclude: vec![ConfigRegex::new("node_modules/")], + include: vec![], + } + } +} + +impl FarmPluginDts { + fn new(_: &Config, options: String) -> Self { + let options: FarmPluginDtsOptions = serde_json::from_str(&options).unwrap_or_default(); + Self { options } + } +} + +impl Plugin for FarmPluginDts { + fn name(&self) -> &str { + "FarmPluginDts" + } + + fn priority(&self) -> i32 { + 101 + } + + fn resolve( + &self, + param: &farmfe_core::plugin::PluginResolveHookParam, + _context: &std::sync::Arc, + _hook_context: &farmfe_core::plugin::PluginHookContext, + ) -> farmfe_core::error::Result> { + // println!("resolve {:?} from {:?}", param.source, param.importer); + Ok(None) + } + + fn load( + &self, + param: &farmfe_core::plugin::PluginLoadHookParam, + _context: &std::sync::Arc, + _hook_context: &farmfe_core::plugin::PluginHookContext, + ) -> farmfe_core::error::Result> { + if param.resolved_path.ends_with(".farm-runtime") { + return Ok(None); + } + // println!("load path: {:#?}", param); + Ok(None) + } + + fn transform( + &self, + param: &farmfe_core::plugin::PluginTransformHookParam, + context: &std::sync::Arc, + ) -> farmfe_core::error::Result> { + // module type guard is neccessary + // return Ok(Some(farmfe_core::plugin::PluginTransformHookResult { + // content: compile_result.css, + // source_map: compile_result.source_map, + // // tell farm compiler that we have transformed this module to css + // module_type: Some(farmfe_core::module::ModuleType::Css), + // ignore_previous_source_map: false, + // })); + if param.resolved_path.ends_with(".farm-runtime") { + return Ok(None); + } + // let transform_options = oxc_transformer::TransformOptions::default(); + // println!("transform_options : {:#?}", transform_options); + println!("transform path: {:#?}", param); + + Ok(None) + } + + fn process_module( + &self, + param: &mut PluginProcessModuleHookParam, + _: &Arc, + ) -> Result, CompilationError> { + let filter = PathFilter::new(&self.options.include, &self.options.exclude); + if param.module_id.relative_path().ends_with(".farm-runtime") { + return Ok(None); + } + if !filter.execute(param.module_id.relative_path()) + && param.module_id.relative_path().ends_with(".farm-runtime") + { + return Ok(None); + } + println!("param.module_id: {:#?}", param.module_id.relative_path()); + println!("param.content: {:#?}", param.content); + Ok(Some(())) + } +}