diff --git a/.gitignore b/.gitignore index cdef4c6..4f7c0ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /docs/* /examples/playground/* +/examples/monorepo/* !.gitkeep diff --git a/examples/monorepo/.gitkeep b/examples/monorepo/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/key-extractor/Cargo.lock b/key-extractor/Cargo.lock index 23e1769..2cbe7d9 100644 --- a/key-extractor/Cargo.lock +++ b/key-extractor/Cargo.lock @@ -55,9 +55,9 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "ar_archive_writer" -version = "0.2.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c269894b6fe5e9d7ada0cf69b5bf847ff35bc25fc271f08e1d080fce80339a" +checksum = "7eb93bbb63b9c227414f6eb3a0adfddca591a8ce1e9b60661bb08969b87e340b" dependencies = [ "object", ] @@ -204,6 +204,16 @@ dependencies = [ "serde", ] +[[package]] +name = "cargo-platform" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0c0e6148f11f01f32650a2ea02d532b2ad4e81d8bd41e6e565b5adc5e6082" +dependencies = [ + "serde", + "serde_core", +] + [[package]] name = "cargo_metadata" version = "0.18.1" @@ -211,7 +221,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", - "cargo-platform", + "cargo-platform 0.1.9", "semver", "serde", "serde_json", @@ -220,16 +230,16 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.19.2" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" dependencies = [ "camino", - "cargo-platform", + "cargo-platform 0.3.2", "semver", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -249,9 +259,9 @@ checksum = "faed1a83001dc2c9201451030cc317e35bef36c84d3781d7c5bb9f343c397da8" [[package]] name = "cc" -version = "1.2.51" +version = "1.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ "find-msvc-tools", "shlex", @@ -265,9 +275,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ "iana-time-zone", "num-traits", @@ -385,9 +395,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" [[package]] name = "debugid" @@ -473,6 +483,12 @@ dependencies = [ "syn", ] +[[package]] +name = "dragonbox_ecma" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a5577f010d4e1bb3f3c4d6081e05718eb6992cf20119cab4d3abadff198b5ae" + [[package]] name = "dyn-clone" version = "1.0.20" @@ -509,9 +525,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fnv" @@ -614,9 +630,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hstr" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c43c0a9e8fbdb3bb9dc8eee85e1e2ac81605418b4c83b6b7413cbf14d56ca5c" +checksum = "faa57007c3c9dab34df2fa4c1fb52fe9c34ec5a27ed9d8edea53254b50cd7887" dependencies = [ "hashbrown 0.14.5", "new_debug_unreachable", @@ -628,9 +644,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -807,9 +823,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "js-sys" -version = "0.3.83" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ "once_cell", "wasm-bindgen", @@ -838,9 +854,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.179" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "linux-raw-sys" @@ -956,9 +972,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-integer" @@ -990,9 +1006,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "memchr", ] @@ -1092,7 +1108,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher 1.0.1", + "siphasher 1.0.2", ] [[package]] @@ -1128,18 +1144,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "psm" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11f2fedc3b7dafdc2851bc52f277377c5473d378859be234bc7ebb593144d01" +checksum = "1fa96cb91275ed31d6da3e983447320c4eb219ac180fa1679a0889ff32861e2d" dependencies = [ "ar_archive_writer", "cc", @@ -1167,9 +1183,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -1285,9 +1301,9 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2e88acca7157d83d789836a3987dafc12bc3d88a050e54b8fe9ea4aaa29d20" +checksum = "360b333c61ae24e5af3ae7c8660bd6b21ccd8200dbbc5d33c2454421e85b9c69" dependencies = [ "bytecheck", "bytes", @@ -1304,9 +1320,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6dffea3c91fa91a3c0fc8a061b0e27fef25c6304728038a6d6bcb1c58ba9bd" +checksum = "7c02f8cdd12b307ab69fe0acf4cd2249c7460eb89dce64a0febadf934ebb6a9e" dependencies = [ "proc-macro2", "quote", @@ -1344,12 +1360,6 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" -[[package]] -name = "ryu-js" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd29631678d6fb0903b69223673e122c32e9ae559d0960a38d574695ebc0ea15" - [[package]] name = "schemars" version = "0.9.0" @@ -1364,9 +1374,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" dependencies = [ "dyn-clone", "ref-cast", @@ -1457,7 +1467,7 @@ dependencies = [ "indexmap 1.9.3", "indexmap 2.13.0", "schemars 0.9.0", - "schemars 1.2.0", + "schemars 1.2.1", "serde_core", "serde_json", "serde_with_macros", @@ -1516,9 +1526,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "siphasher" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" [[package]] name = "smallvec" @@ -1640,9 +1650,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "54.0.0" +version = "56.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f361c932ffe029754a10512ee217f550109ee80dda1fe6ec90772440bfc0a68" +checksum = "a98e364864dc10de940b04a8e2b60ea2d2d512b1aa1e940651e128446fe35d71" dependencies = [ "swc_allocator", "swc_atoms", @@ -1661,9 +1671,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "19.0.0" +version = "20.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "724195600825cbdd2a899d5473d2ce1f24ae418bff1231f160ecf38a3bc81f46" +checksum = "252124d0d786aa2338860701a067c93488747dfadbfedb16ac78f386e16a0ac4" dependencies = [ "bitflags", "cbor4ii", @@ -1681,25 +1691,24 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "21.0.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c77d9d21345ca986ae3b5ff1a4fa3607b15b07ed397506e6dba32e867cf40fd" +checksum = "56116de786118dce35e90b612a1f4d952116dd2728ecb197c8064cfccf527baf" dependencies = [ "ascii", "compact_str", + "dragonbox_ecma", "memchr", "num-bigint", "once_cell", "regex", "rustc-hash", - "ryu-js", "serde", "swc_allocator", "swc_atoms", "swc_common", "swc_ecma_ast", "swc_ecma_codegen_macros", - "swc_sourcemap", "tracing", ] @@ -1716,9 +1725,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "32.0.0" +version = "33.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d0c36843109fff178bbedc439b4190daa865d78e553134243a4df220329fdd" +checksum = "7d237cf212d1f3ff5c0cf6ab5070f0ed4d624a0ab032ac4f0451675d31890e71" dependencies = [ "bitflags", "either", @@ -1750,9 +1759,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "35.0.0" +version = "36.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f9f0dee4466e6eeb7042f2a0fc6c84298dfa914baff5bcfb44beb9f24b215f" +checksum = "bdf93abf3dc6d2b21a2a29c62b0197cd270b6105a483236ecba91993f895204e" dependencies = [ "better_scoped_tls", "indexmap 2.13.0", @@ -1772,9 +1781,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "38.0.0" +version = "40.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df902ecb7e522c8df33f11db02fbed22abd4809663490100e3ea66c103130dd" +checksum = "994b87d7c96e973c324efdc1e68ee58ceca319d1416b6a7fd63157f45e72a493" dependencies = [ "ansi_term", "anyhow", @@ -1798,16 +1807,16 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "25.0.0" +version = "26.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dd5ee449d21110a271e73d0a9f7640a8854a62cb0e2cb0c9db3445383598e21" +checksum = "3669c1d92ba315caff5a80df76141367acf61b2d846231a1960e25be65a20fbd" dependencies = [ + "dragonbox_ecma", "indexmap 2.13.0", "num_cpus", "once_cell", "par-core", "rustc-hash", - "ryu-js", "swc_atoms", "swc_common", "swc_ecma_ast", @@ -1817,9 +1826,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "19.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69d63f7f704a2ec937edef90a3eba1f64602eceb60c8deb260c01131f680e8b" +checksum = "e971a258717db3dc8939c38410d8b8cb8126f1b05b9758672daa7cae3e0248c2" dependencies = [ "new_debug_unreachable", "num-bigint", @@ -1887,9 +1896,9 @@ dependencies = [ [[package]] name = "swc_plugin_proxy" -version = "19.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f976dc63cd8b1916f265ee7d2647c28a85b433640099a5bf07153346dedffda" +checksum = "e78e1a9d26be495289cb07b9d73222f92f60b74d47904169d3ce4977600ec11e" dependencies = [ "better_scoped_tls", "cbor4ii", @@ -2059,11 +2068,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -2079,9 +2088,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -2099,30 +2108,30 @@ dependencies = [ [[package]] name = "time" -version = "0.3.44" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.24" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4" dependencies = [ "num-conv", "time-core", @@ -2280,9 +2289,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" dependencies = [ "js-sys", "wasm-bindgen", @@ -2296,12 +2305,12 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vergen" -version = "9.0.6" +version = "9.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2bf58be11fc9414104c6d3a2e464163db5ef74b12296bda593cac37b6e4777" +checksum = "b849a1f6d8639e8de261e81ee0fc881e3e3620db1af9f2e0da015d4382ceaf75" dependencies = [ "anyhow", - "cargo_metadata 0.19.2", + "cargo_metadata 0.23.1", "derive_builder", "regex", "rustversion", @@ -2310,9 +2319,9 @@ dependencies = [ [[package]] name = "vergen-lib" -version = "0.1.6" +version = "9.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b07e6010c0f3e59fcb164e0163834597da68d1f864e2b8ca49f74de01e9c166" +checksum = "b34a29ba7e9c59e62f229ae1932fb1b8fb8a6fdcc99215a641913f5f5a59a569" dependencies = [ "anyhow", "derive_builder", @@ -2333,18 +2342,18 @@ checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" dependencies = [ "cfg-if", "once_cell", @@ -2355,9 +2364,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2365,9 +2374,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ "bumpalo", "proc-macro2", @@ -2378,9 +2387,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.106" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" dependencies = [ "unicode-ident", ] @@ -2559,9 +2568,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "wit-bindgen" -version = "0.46.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" [[package]] name = "writeable" @@ -2609,18 +2618,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0" dependencies = [ "proc-macro2", "quote", @@ -2683,6 +2692,6 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.12" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc5a66a20078bf1251bde995aa2fdcc4b800c70b5d92dd2c62abc5c60f679f8" +checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445" diff --git a/key-extractor/Cargo.toml b/key-extractor/Cargo.toml index 9f46329..9f343d6 100644 --- a/key-extractor/Cargo.toml +++ b/key-extractor/Cargo.toml @@ -13,13 +13,13 @@ serde = "1.0.0" serde_json = "1.0.0" serde_with = "3.0.0" swc_common = "18.0.0" -swc_core = { version = "54.0.0", features = ["ecma_plugin_transform"] } -swc_ecma_ast = "19.0.0" -swc_ecma_visit = "19.0.0" +swc_core = { version = "56.0.0", features = ["ecma_plugin_transform"] } +swc_ecma_ast = "20.0.0" +swc_ecma_visit = "20.0.0" swc_plugin_macro = "1.0.0" [dev-dependencies] -swc_core = { version = "54.0.0", features = ["ecma_parser"] } +swc_core = { version = "56.0.0", features = ["ecma_parser"] } [profile.release] codegen-units = 1 diff --git a/package/package.json b/package/package.json index 787b2a3..fed6e65 100644 --- a/package/package.json +++ b/package/package.json @@ -71,11 +71,12 @@ "prepublishOnly": "pnpm build" }, "dependencies": { - "@formatjs/icu-messageformat-parser": "^3.3.0", - "@swc/core": "^1.15.8", + "@formatjs/icu-messageformat-parser": "^3.5.1", + "@swc/core": "^1.15.11", "commander": "^13.1.0", "fast-memoize": "^2.5.2", - "intl-messageformat": "^11.0.9", + "gettext-parser": "^9.0.1", + "intl-messageformat": "^11.1.2", "negotiator": "^1.0.0", "path-to-regexp": "^8.3.0", "tsup": "^8.5.1", @@ -83,18 +84,19 @@ }, "devDependencies": { "@eslint/js": "^9.39.2", + "@types/gettext-parser": "^8.0.0", "@types/negotiator": "^0.6.4", - "@types/node": "^22.19.3", + "@types/node": "^22.19.11", "@types/react": "18.2.0", - "@vitest/coverage-v8": "^4.0.16", + "@vitest/coverage-v8": "^4.0.18", "eslint": "^9.39.2", "next": "^14.2.35", - "prettier": "^3.7.4", + "prettier": "^3.8.1", "react": "^18.3.1", "react-dom": "18.2.0", "typescript": "^5.9.3", - "typescript-eslint": "^8.52.0", - "vitest": "^4.0.16" + "typescript-eslint": "^8.55.0", + "vitest": "^4.0.18" }, "peerDependencies": { "next": "^14.0.0", diff --git a/package/pnpm-lock.yaml b/package/pnpm-lock.yaml index d5bd58c..80c5330 100644 --- a/package/pnpm-lock.yaml +++ b/package/pnpm-lock.yaml @@ -9,20 +9,23 @@ importers: .: dependencies: '@formatjs/icu-messageformat-parser': - specifier: ^3.3.0 - version: 3.3.0 + specifier: ^3.5.1 + version: 3.5.1 '@swc/core': - specifier: ^1.15.8 - version: 1.15.8 + specifier: ^1.15.11 + version: 1.15.11 commander: specifier: ^13.1.0 version: 13.1.0 fast-memoize: specifier: ^2.5.2 version: 2.5.2 + gettext-parser: + specifier: ^9.0.1 + version: 9.0.1 intl-messageformat: - specifier: ^11.0.9 - version: 11.0.9 + specifier: ^11.1.2 + version: 11.1.2 negotiator: specifier: ^1.0.0 version: 1.0.0 @@ -31,7 +34,7 @@ importers: version: 8.3.0 tsup: specifier: ^8.5.1 - version: 8.5.1(@swc/core@1.15.8)(postcss@8.5.6)(typescript@5.9.3)(yaml@2.8.2) + version: 8.5.1(@swc/core@1.15.11)(postcss@8.5.6)(typescript@5.9.3)(yaml@2.8.2) yaml: specifier: ^2.8.2 version: 2.8.2 @@ -39,18 +42,21 @@ importers: '@eslint/js': specifier: ^9.39.2 version: 9.39.2 + '@types/gettext-parser': + specifier: ^8.0.0 + version: 8.0.0 '@types/negotiator': specifier: ^0.6.4 version: 0.6.4 '@types/node': - specifier: ^22.19.3 - version: 22.19.3 + specifier: ^22.19.11 + version: 22.19.11 '@types/react': specifier: 18.2.0 version: 18.2.0 '@vitest/coverage-v8': - specifier: ^4.0.16 - version: 4.0.16(vitest@4.0.16(@types/node@22.19.3)(yaml@2.8.2)) + specifier: ^4.0.18 + version: 4.0.18(vitest@4.0.18(@types/node@22.19.11)(yaml@2.8.2)) eslint: specifier: ^9.39.2 version: 9.39.2 @@ -58,8 +64,8 @@ importers: specifier: ^14.2.35 version: 14.2.35(react-dom@18.2.0(react@18.3.1))(react@18.3.1) prettier: - specifier: ^3.7.4 - version: 3.7.4 + specifier: ^3.8.1 + version: 3.8.1 react: specifier: ^18.3.1 version: 18.3.1 @@ -70,11 +76,11 @@ importers: specifier: ^5.9.3 version: 5.9.3 typescript-eslint: - specifier: ^8.52.0 - version: 8.52.0(eslint@9.39.2)(typescript@5.9.3) + specifier: ^8.55.0 + version: 8.55.0(eslint@9.39.2)(typescript@5.9.3) vitest: - specifier: ^4.0.16 - version: 4.0.16(@types/node@22.19.3)(yaml@2.8.2) + specifier: ^4.0.18 + version: 4.0.18(@types/node@22.19.11)(yaml@2.8.2) packages: @@ -293,20 +299,20 @@ packages: resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@formatjs/ecma402-abstract@3.0.8': - resolution: {integrity: sha512-NRiqvxAvhbARZRFSRFPjN0y8txxmVutv2vMYvW2HSdCVf58w9l4osLj6Ujif643vImwZBcbKqhiKE0IOhY+DvA==} + '@formatjs/ecma402-abstract@3.1.1': + resolution: {integrity: sha512-jhZbTwda+2tcNrs4kKvxrPLPjx8QsBCLCUgrrJ/S+G9YrGHWLhAyFMMBHJBnBoOwuLHd7L14FgYudviKaxkO2Q==} - '@formatjs/fast-memoize@3.0.3': - resolution: {integrity: sha512-CArYtQKGLAOruCMeq5/RxCg6vUXFx3OuKBdTm30Wn/+gCefehmZ8Y2xSMxMrO2iel7hRyE3HKfV56t3vAU6D4Q==} + '@formatjs/fast-memoize@3.1.0': + resolution: {integrity: sha512-b5mvSWCI+XVKiz5WhnBCY3RJ4ZwfjAidU0yVlKa3d3MSgKmH1hC3tBGEAtYyN5mqL7N0G5x0BOUYyO8CEupWgg==} - '@formatjs/icu-messageformat-parser@3.3.0': - resolution: {integrity: sha512-dqxGSwH22ZfBwa6EVvrrIo+8kHHUSjuw9iZy6HkkN5XgH5/8ny9zDGhvC6ZOFYp01PAbwHvUTIHqznC6Z1nIbA==} + '@formatjs/icu-messageformat-parser@3.5.1': + resolution: {integrity: sha512-sSDmSvmmoVQ92XqWb499KrIhv/vLisJU8ITFrx7T7NZHUmMY7EL9xgRowAosaljhqnj/5iufG24QrdzB6X3ItA==} - '@formatjs/icu-skeleton-parser@2.0.8': - resolution: {integrity: sha512-Z493tGxtKu0xNcSZjS8HrWNfq25HMscqbq5qwRFBYz14b70k1DHmhqVAwYDdDK0Ytj9YG1nvY4+IRq53LVNFdA==} + '@formatjs/icu-skeleton-parser@2.1.1': + resolution: {integrity: sha512-PSFABlcNefjI6yyk8f7nyX1DC7NHmq6WaCHZLySEXBrXuLOB2f935YsnzuPjlz+ibhb9yWTdPeVX1OVcj24w2Q==} - '@formatjs/intl-localematcher@0.7.5': - resolution: {integrity: sha512-7/nd90cn5CT7SVF71/ybUKAcnvBlr9nZlJJp8O8xIZHXFgYOC4SXExZlSdgHv2l6utjw1byidL06QzChvQMHwA==} + '@formatjs/intl-localematcher@0.8.1': + resolution: {integrity: sha512-xwEuwQFdtSq1UKtQnyTZWC+eHdv7Uygoa+H2k/9uzBVQjDyp9r20LNDNKedWXll7FssT3GRHvqsdJGYSUWqYFA==} '@humanfs/core@0.19.1': resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} @@ -357,24 +363,28 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [glibc] '@next/swc-linux-arm64-musl@14.2.33': resolution: {integrity: sha512-Bm+QulsAItD/x6Ih8wGIMfRJy4G73tu1HJsrccPW6AfqdZd0Sfm5Imhgkgq2+kly065rYMnCOxTBvmvFY1BKfg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [musl] '@next/swc-linux-x64-gnu@14.2.33': resolution: {integrity: sha512-FnFn+ZBgsVMbGDsTqo8zsnRzydvsGV8vfiWwUo1LD8FTmPTdV+otGSWKc4LJec0oSexFnCYVO4hX8P8qQKaSlg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [glibc] '@next/swc-linux-x64-musl@14.2.33': resolution: {integrity: sha512-345tsIWMzoXaQndUTDv1qypDRiebFxGYx9pYkhwY4hBRaOLt8UGfiWKr9FSSHs25dFIf8ZqIFaPdy5MljdoawA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [musl] '@next/swc-win32-arm64-msvc@14.2.33': resolution: {integrity: sha512-nscpt0G6UCTkrT2ppnJnFsYbPDQwmum4GNXYTeoTIdsmMydSKFz9Iny2jpaRupTb+Wl298+Rh82WKzt9LCcqSQ==} @@ -428,66 +438,79 @@ packages: resolution: {integrity: sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.55.1': resolution: {integrity: sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.55.1': resolution: {integrity: sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.55.1': resolution: {integrity: sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.55.1': resolution: {integrity: sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.55.1': resolution: {integrity: sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==} cpu: [loong64] os: [linux] + libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.55.1': resolution: {integrity: sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.55.1': resolution: {integrity: sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==} cpu: [ppc64] os: [linux] + libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.55.1': resolution: {integrity: sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.55.1': resolution: {integrity: sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.55.1': resolution: {integrity: sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.55.1': resolution: {integrity: sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.55.1': resolution: {integrity: sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openbsd-x64@4.55.1': resolution: {integrity: sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==} @@ -522,68 +545,72 @@ packages: '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} - '@swc/core-darwin-arm64@1.15.8': - resolution: {integrity: sha512-M9cK5GwyWWRkRGwwCbREuj6r8jKdES/haCZ3Xckgkl8MUQJZA3XB7IXXK1IXRNeLjg6m7cnoMICpXv1v1hlJOg==} + '@swc/core-darwin-arm64@1.15.11': + resolution: {integrity: sha512-QoIupRWVH8AF1TgxYyeA5nS18dtqMuxNwchjBIwJo3RdwLEFiJq6onOx9JAxHtuPwUkIVuU2Xbp+jCJ7Vzmgtg==} engines: {node: '>=10'} cpu: [arm64] os: [darwin] - '@swc/core-darwin-x64@1.15.8': - resolution: {integrity: sha512-j47DasuOvXl80sKJHSi2X25l44CMc3VDhlJwA7oewC1nV1VsSzwX+KOwE5tLnfORvVJJyeiXgJORNYg4jeIjYQ==} + '@swc/core-darwin-x64@1.15.11': + resolution: {integrity: sha512-S52Gu1QtPSfBYDiejlcfp9GlN+NjTZBRRNsz8PNwBgSE626/FUf2PcllVUix7jqkoMC+t0rS8t+2/aSWlMuQtA==} engines: {node: '>=10'} cpu: [x64] os: [darwin] - '@swc/core-linux-arm-gnueabihf@1.15.8': - resolution: {integrity: sha512-siAzDENu2rUbwr9+fayWa26r5A9fol1iORG53HWxQL1J8ym4k7xt9eME0dMPXlYZDytK5r9sW8zEA10F2U3Xwg==} + '@swc/core-linux-arm-gnueabihf@1.15.11': + resolution: {integrity: sha512-lXJs8oXo6Z4yCpimpQ8vPeCjkgoHu5NoMvmJZ8qxDyU99KVdg6KwU9H79vzrmB+HfH+dCZ7JGMqMF//f8Cfvdg==} engines: {node: '>=10'} cpu: [arm] os: [linux] - '@swc/core-linux-arm64-gnu@1.15.8': - resolution: {integrity: sha512-o+1y5u6k2FfPYbTRUPvurwzNt5qd0NTumCTFscCNuBksycloXY16J8L+SMW5QRX59n4Hp9EmFa3vpvNHRVv1+Q==} + '@swc/core-linux-arm64-gnu@1.15.11': + resolution: {integrity: sha512-chRsz1K52/vj8Mfq/QOugVphlKPWlMh10V99qfH41hbGvwAU6xSPd681upO4bKiOr9+mRIZZW+EfJqY42ZzRyA==} engines: {node: '>=10'} cpu: [arm64] os: [linux] + libc: [glibc] - '@swc/core-linux-arm64-musl@1.15.8': - resolution: {integrity: sha512-koiCqL09EwOP1S2RShCI7NbsQuG6r2brTqUYE7pV7kZm9O17wZ0LSz22m6gVibpwEnw8jI3IE1yYsQTVpluALw==} + '@swc/core-linux-arm64-musl@1.15.11': + resolution: {integrity: sha512-PYftgsTaGnfDK4m6/dty9ryK1FbLk+LosDJ/RJR2nkXGc8rd+WenXIlvHjWULiBVnS1RsjHHOXmTS4nDhe0v0w==} engines: {node: '>=10'} cpu: [arm64] os: [linux] + libc: [musl] - '@swc/core-linux-x64-gnu@1.15.8': - resolution: {integrity: sha512-4p6lOMU3bC+Vd5ARtKJ/FxpIC5G8v3XLoPEZ5s7mLR8h7411HWC/LmTXDHcrSXRC55zvAVia1eldy6zDLz8iFQ==} + '@swc/core-linux-x64-gnu@1.15.11': + resolution: {integrity: sha512-DKtnJKIHiZdARyTKiX7zdRjiDS1KihkQWatQiCHMv+zc2sfwb4Glrodx2VLOX4rsa92NLR0Sw8WLcPEMFY1szQ==} engines: {node: '>=10'} cpu: [x64] os: [linux] + libc: [glibc] - '@swc/core-linux-x64-musl@1.15.8': - resolution: {integrity: sha512-z3XBnbrZAL+6xDGAhJoN4lOueIxC/8rGrJ9tg+fEaeqLEuAtHSW2QHDHxDwkxZMjuF/pZ6MUTjHjbp8wLbuRLA==} + '@swc/core-linux-x64-musl@1.15.11': + resolution: {integrity: sha512-mUjjntHj4+8WBaiDe5UwRNHuEzLjIWBTSGTw0JT9+C9/Yyuh4KQqlcEQ3ro6GkHmBGXBFpGIj/o5VMyRWfVfWw==} engines: {node: '>=10'} cpu: [x64] os: [linux] + libc: [musl] - '@swc/core-win32-arm64-msvc@1.15.8': - resolution: {integrity: sha512-djQPJ9Rh9vP8GTS/Df3hcc6XP6xnG5c8qsngWId/BLA9oX6C7UzCPAn74BG/wGb9a6j4w3RINuoaieJB3t+7iQ==} + '@swc/core-win32-arm64-msvc@1.15.11': + resolution: {integrity: sha512-ZkNNG5zL49YpaFzfl6fskNOSxtcZ5uOYmWBkY4wVAvgbSAQzLRVBp+xArGWh2oXlY/WgL99zQSGTv7RI5E6nzA==} engines: {node: '>=10'} cpu: [arm64] os: [win32] - '@swc/core-win32-ia32-msvc@1.15.8': - resolution: {integrity: sha512-/wfAgxORg2VBaUoFdytcVBVCgf1isWZIEXB9MZEUty4wwK93M/PxAkjifOho9RN3WrM3inPLabICRCEgdHpKKQ==} + '@swc/core-win32-ia32-msvc@1.15.11': + resolution: {integrity: sha512-6XnzORkZCQzvTQ6cPrU7iaT9+i145oLwnin8JrfsLG41wl26+5cNQ2XV3zcbrnFEV6esjOceom9YO1w9mGJByw==} engines: {node: '>=10'} cpu: [ia32] os: [win32] - '@swc/core-win32-x64-msvc@1.15.8': - resolution: {integrity: sha512-GpMePrh9Sl4d61o4KAHOOv5is5+zt6BEXCOCgs/H0FLGeii7j9bWDE8ExvKFy2GRRZVNR1ugsnzaGWHKM6kuzA==} + '@swc/core-win32-x64-msvc@1.15.11': + resolution: {integrity: sha512-IQ2n6af7XKLL6P1gIeZACskSxK8jWtoKpJWLZmdXTDj1MGzktUy4i+FvpdtxFmJWNavRWH1VmTr6kAubRDHeKw==} engines: {node: '>=10'} cpu: [x64] os: [win32] - '@swc/core@1.15.8': - resolution: {integrity: sha512-T8keoJjXaSUoVBCIjgL6wAnhADIb09GOELzKg10CjNg+vLX48P93SME6jTfte9MZIm5m+Il57H3rTSk/0kzDUw==} + '@swc/core@1.15.11': + resolution: {integrity: sha512-iLmLTodbYxU39HhMPaMUooPwO/zqJWvsqkrXv1ZI38rMb048p6N7qtAtTp37sw9NzSrvH6oli8EdDygo09IZ/w==} engines: {node: '>=10'} peerDependencies: '@swc/helpers': '>=0.5.17' @@ -609,14 +636,17 @@ packages: '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + '@types/gettext-parser@8.0.0': + resolution: {integrity: sha512-oBBIahfWKqAC8LsIw+uFwhXfwlF8GhWDUhyEjoP7Pl9g5bFLhYA/2SiXPkE4oKhDX9fL091qCAyPVZtIkd5X6Q==} + '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} '@types/negotiator@0.6.4': resolution: {integrity: sha512-elf6BsTq+AkyNsb2h5cGNst2Mc7dPliVoAPm1fXglC/BM3f2pFA40BaSSv3E5lyHteEawVKLP+8TwiY1DMNb3A==} - '@types/node@22.19.3': - resolution: {integrity: sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==} + '@types/node@22.19.11': + resolution: {integrity: sha512-BH7YwL6rA93ReqeQS1c4bsPpcfOmJasG+Fkr6Y59q83f9M1WcBRHR2vM+P9eOisYRcN3ujQoiZY8uk5W+1WL8w==} '@types/prop-types@15.7.15': resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==} @@ -624,82 +654,85 @@ packages: '@types/react@18.2.0': resolution: {integrity: sha512-0FLj93y5USLHdnhIhABk83rm8XEGA7kH3cr+YUlvxoUGp1xNt/DINUMvqPxLyOQMzLmZe8i4RTHbvb8MC7NmrA==} + '@types/readable-stream@4.0.23': + resolution: {integrity: sha512-wwXrtQvbMHxCbBgjHaMGEmImFTQxxpfMOR/ZoQnXxB1woqkUbdLGFDgauo00Py9IudiaqSeiBiulSV9i6XIPig==} + '@types/scheduler@0.26.0': resolution: {integrity: sha512-WFHp9YUJQ6CKshqoC37iOlHnQSmxNc795UhB26CyBBttrN9svdIrUjl/NjnNmfcwtncN0h/0PPAFWv9ovP8mLA==} - '@typescript-eslint/eslint-plugin@8.52.0': - resolution: {integrity: sha512-okqtOgqu2qmZJ5iN4TWlgfF171dZmx2FzdOv2K/ixL2LZWDStL8+JgQerI2sa8eAEfoydG9+0V96m7V+P8yE1Q==} + '@typescript-eslint/eslint-plugin@8.55.0': + resolution: {integrity: sha512-1y/MVSz0NglV1ijHC8OT49mPJ4qhPYjiK08YUQVbIOyu+5k862LKUHFkpKHWu//zmr7hDR2rhwUm6gnCGNmGBQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^8.52.0 + '@typescript-eslint/parser': ^8.55.0 eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/parser@8.52.0': - resolution: {integrity: sha512-iIACsx8pxRnguSYhHiMn2PvhvfpopO9FXHyn1mG5txZIsAaB6F0KwbFnUQN3KCiG3Jcuad/Cao2FAs1Wp7vAyg==} + '@typescript-eslint/parser@8.55.0': + resolution: {integrity: sha512-4z2nCSBfVIMnbuu8uinj+f0o4qOeggYJLbjpPHka3KH1om7e+H9yLKTYgksTaHcGco+NClhhY2vyO3HsMH1RGw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/project-service@8.52.0': - resolution: {integrity: sha512-xD0MfdSdEmeFa3OmVqonHi+Cciab96ls1UhIF/qX/O/gPu5KXD0bY9lu33jj04fjzrXHcuvjBcBC+D3SNSadaw==} + '@typescript-eslint/project-service@8.55.0': + resolution: {integrity: sha512-zRcVVPFUYWa3kNnjaZGXSu3xkKV1zXy8M4nO/pElzQhFweb7PPtluDLQtKArEOGmjXoRjnUZ29NjOiF0eCDkcQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/scope-manager@8.52.0': - resolution: {integrity: sha512-ixxqmmCcc1Nf8S0mS0TkJ/3LKcC8mruYJPOU6Ia2F/zUUR4pApW7LzrpU3JmtePbRUTes9bEqRc1Gg4iyRnDzA==} + '@typescript-eslint/scope-manager@8.55.0': + resolution: {integrity: sha512-fVu5Omrd3jeqeQLiB9f1YsuK/iHFOwb04bCtY4BSCLgjNbOD33ZdV6KyEqplHr+IlpgT0QTZ/iJ+wT7hvTx49Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/tsconfig-utils@8.52.0': - resolution: {integrity: sha512-jl+8fzr/SdzdxWJznq5nvoI7qn2tNYV/ZBAEcaFMVXf+K6jmXvAFrgo/+5rxgnL152f//pDEAYAhhBAZGrVfwg==} + '@typescript-eslint/tsconfig-utils@8.55.0': + resolution: {integrity: sha512-1R9cXqY7RQd7WuqSN47PK9EDpgFUK3VqdmbYrvWJZYDd0cavROGn+74ktWBlmJ13NXUQKlZ/iAEQHI/V0kKe0Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/type-utils@8.52.0': - resolution: {integrity: sha512-JD3wKBRWglYRQkAtsyGz1AewDu3mTc7NtRjR/ceTyGoPqmdS5oCdx/oZMWD5Zuqmo6/MpsYs0wp6axNt88/2EQ==} + '@typescript-eslint/type-utils@8.55.0': + resolution: {integrity: sha512-x1iH2unH4qAt6I37I2CGlsNs+B9WGxurP2uyZLRz6UJoZWDBx9cJL1xVN/FiOmHEONEg6RIufdvyT0TEYIgC5g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/types@8.52.0': - resolution: {integrity: sha512-LWQV1V4q9V4cT4H5JCIx3481iIFxH1UkVk+ZkGGAV1ZGcjGI9IoFOfg3O6ywz8QqCDEp7Inlg6kovMofsNRaGg==} + '@typescript-eslint/types@8.55.0': + resolution: {integrity: sha512-ujT0Je8GI5BJWi+/mMoR0wxwVEQaxM+pi30xuMiJETlX80OPovb2p9E8ss87gnSVtYXtJoU9U1Cowcr6w2FE0w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.52.0': - resolution: {integrity: sha512-XP3LClsCc0FsTK5/frGjolyADTh3QmsLp6nKd476xNI9CsSsLnmn4f0jrzNoAulmxlmNIpeXuHYeEQv61Q6qeQ==} + '@typescript-eslint/typescript-estree@8.55.0': + resolution: {integrity: sha512-EwrH67bSWdx/3aRQhCoxDaHM+CrZjotc2UCCpEDVqfCE+7OjKAGWNY2HsCSTEVvWH2clYQK8pdeLp42EVs+xQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/utils@8.52.0': - resolution: {integrity: sha512-wYndVMWkweqHpEpwPhwqE2lnD2DxC6WVLupU/DOt/0/v+/+iQbbzO3jOHjmBMnhu0DgLULvOaU4h4pwHYi2oRQ==} + '@typescript-eslint/utils@8.55.0': + resolution: {integrity: sha512-BqZEsnPGdYpgyEIkDC1BadNY8oMwckftxBT+C8W0g1iKPdeqKZBtTfnvcq0nf60u7MkjFO8RBvpRGZBPw4L2ow==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/visitor-keys@8.52.0': - resolution: {integrity: sha512-ink3/Zofus34nmBsPjow63FP5M7IGff0RKAgqR6+CFpdk22M7aLwC9gOcLGYqr7MczLPzZVERW9hRog3O4n1sQ==} + '@typescript-eslint/visitor-keys@8.55.0': + resolution: {integrity: sha512-AxNRwEie8Nn4eFS1FzDMJWIISMGoXMb037sgCBJ3UR6o0fQTzr2tqN9WT+DkWJPhIdQCfV7T6D387566VtnCJA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@vitest/coverage-v8@4.0.16': - resolution: {integrity: sha512-2rNdjEIsPRzsdu6/9Eq0AYAzYdpP6Bx9cje9tL3FE5XzXRQF1fNU9pe/1yE8fCrS0HD+fBtt6gLPh6LI57tX7A==} + '@vitest/coverage-v8@4.0.18': + resolution: {integrity: sha512-7i+N2i0+ME+2JFZhfuz7Tg/FqKtilHjGyGvoHYQ6iLV0zahbsJ9sljC9OcFcPDbhYKCet+sG8SsVqlyGvPflZg==} peerDependencies: - '@vitest/browser': 4.0.16 - vitest: 4.0.16 + '@vitest/browser': 4.0.18 + vitest: 4.0.18 peerDependenciesMeta: '@vitest/browser': optional: true - '@vitest/expect@4.0.16': - resolution: {integrity: sha512-eshqULT2It7McaJkQGLkPjPjNph+uevROGuIMJdG3V+0BSR2w9u6J9Lwu+E8cK5TETlfou8GRijhafIMhXsimA==} + '@vitest/expect@4.0.18': + resolution: {integrity: sha512-8sCWUyckXXYvx4opfzVY03EOiYVxyNrHS5QxX3DAIi5dpJAAkyJezHCP77VMX4HKA2LDT/Jpfo8i2r5BE3GnQQ==} - '@vitest/mocker@4.0.16': - resolution: {integrity: sha512-yb6k4AZxJTB+q9ycAvsoxGn+j/po0UaPgajllBgt1PzoMAAmJGYFdDk0uCcRcxb3BrME34I6u8gHZTQlkqSZpg==} + '@vitest/mocker@4.0.18': + resolution: {integrity: sha512-HhVd0MDnzzsgevnOWCBj5Otnzobjy5wLBe4EdeeFGv8luMsGcYqDuFRMcttKWZA5vVO8RFjexVovXvAM4JoJDQ==} peerDependencies: msw: ^2.4.9 vite: ^6.0.0 || ^7.0.0-0 @@ -709,20 +742,20 @@ packages: vite: optional: true - '@vitest/pretty-format@4.0.16': - resolution: {integrity: sha512-eNCYNsSty9xJKi/UdVD8Ou16alu7AYiS2fCPRs0b1OdhJiV89buAXQLpTbe+X8V9L6qrs9CqyvU7OaAopJYPsA==} + '@vitest/pretty-format@4.0.18': + resolution: {integrity: sha512-P24GK3GulZWC5tz87ux0m8OADrQIUVDPIjjj65vBXYG17ZeU3qD7r+MNZ1RNv4l8CGU2vtTRqixrOi9fYk/yKw==} - '@vitest/runner@4.0.16': - resolution: {integrity: sha512-VWEDm5Wv9xEo80ctjORcTQRJ539EGPB3Pb9ApvVRAY1U/WkHXmmYISqU5E79uCwcW7xYUV38gwZD+RV755fu3Q==} + '@vitest/runner@4.0.18': + resolution: {integrity: sha512-rpk9y12PGa22Jg6g5M3UVVnTS7+zycIGk9ZNGN+m6tZHKQb7jrP7/77WfZy13Y/EUDd52NDsLRQhYKtv7XfPQw==} - '@vitest/snapshot@4.0.16': - resolution: {integrity: sha512-sf6NcrYhYBsSYefxnry+DR8n3UV4xWZwWxYbCJUt2YdvtqzSPR7VfGrY0zsv090DAbjFZsi7ZaMi1KnSRyK1XA==} + '@vitest/snapshot@4.0.18': + resolution: {integrity: sha512-PCiV0rcl7jKQjbgYqjtakly6T1uwv/5BQ9SwBLekVg/EaYeQFPiXcgrC2Y7vDMA8dM1SUEAEV82kgSQIlXNMvA==} - '@vitest/spy@4.0.16': - resolution: {integrity: sha512-4jIOWjKP0ZUaEmJm00E0cOBLU+5WE0BpeNr3XN6TEF05ltro6NJqHWxXD0kA8/Zc8Nh23AT8WQxwNG+WeROupw==} + '@vitest/spy@4.0.18': + resolution: {integrity: sha512-cbQt3PTSD7P2OARdVW3qWER5EGq7PHlvE+QfzSC0lbwO+xnt7+XH06ZzFjFRgzUX//JmpxrCu92VdwvEPlWSNw==} - '@vitest/utils@4.0.16': - resolution: {integrity: sha512-h8z9yYhV3e1LEfaQ3zdypIrnAg/9hguReGZoS7Gl0aBG5xgA410zBqECqmaF/+RkTggRsfnzc1XaAHA6bmUufA==} + '@vitest/utils@4.0.18': + resolution: {integrity: sha512-msMRKLMVLWygpK3u2Hybgi4MNjcYJvwTb0Ru09+fOyCXIgT5raYP041DRRdiJiI3k/2U6SEbAETB3YtBrUkCFA==} acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} @@ -824,6 +857,10 @@ packages: resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} engines: {node: ^14.18.0 || >=16.10.0} + content-type@1.0.5: + resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} + engines: {node: '>= 0.6'} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -846,6 +883,9 @@ packages: deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + encoding@0.1.13: + resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} + es-module-lexer@1.7.0: resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} @@ -951,6 +991,10 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + gettext-parser@9.0.1: + resolution: {integrity: sha512-q6F1KukCoQO9WivuO3O86UK+SyhYi8V1lSn+Ql4IfhHmbCX98drWTt2bGRn2RqEORsF8NgnpbcUaAr/ATNs57A==} + engines: {node: '>=20'} + glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} @@ -969,6 +1013,10 @@ packages: html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -985,8 +1033,8 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} - intl-messageformat@11.0.9: - resolution: {integrity: sha512-xA4aCCMnCxynKV5kI7V0GlMf+BGJxsXQRwr5tfEgmcB791eDEQa4r+s4wU7GqMR0jx7+K4jyEH2UfBpVGTDNPQ==} + intl-messageformat@11.1.2: + resolution: {integrity: sha512-ucSrQmZGAxfiBHfBRXW/k7UC8MaGFlEj4Ry1tKiDcmgwQm1y3EDl40u+4VNHYomxJQMJi9NEI3riDRlth96jKg==} is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} @@ -1007,10 +1055,6 @@ packages: resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} engines: {node: '>=10'} - istanbul-lib-source-maps@5.0.6: - resolution: {integrity: sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==} - engines: {node: '>=10'} - istanbul-reports@3.2.0: resolution: {integrity: sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==} engines: {node: '>=8'} @@ -1204,8 +1248,8 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier@3.7.4: - resolution: {integrity: sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==} + prettier@3.8.1: + resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} engines: {node: '>=14'} hasBin: true @@ -1239,6 +1283,9 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + scheduler@0.23.2: resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} @@ -1247,6 +1294,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.7.4: + resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==} + engines: {node: '>=10'} + hasBin: true + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -1366,8 +1418,8 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - typescript-eslint@8.52.0: - resolution: {integrity: sha512-atlQQJ2YkO4pfTVQmQ+wvYQwexPDOIgo+RaVcD7gHgzy/IQA+XTyuxNM9M9TVXvttkF7koBHmcwisKdOAf2EcA==} + typescript-eslint@8.55.0: + resolution: {integrity: sha512-HE4wj+r5lmDVS9gdaN0/+iqNvPZwGfnJ5lZuz7s5vLlg9ODw0bIiiETaios9LvFI1U94/VBXGm3CB2Y5cNFMpw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -1427,18 +1479,18 @@ packages: yaml: optional: true - vitest@4.0.16: - resolution: {integrity: sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==} + vitest@4.0.18: + resolution: {integrity: sha512-hOQuK7h0FGKgBAas7v0mSAsnvrIgAvWmRFjmzpJ7SwFHH3g1k2u37JtYwOwmEKhK6ZO3v9ggDBBm0La1LCK4uQ==} engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@opentelemetry/api': ^1.9.0 '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0 - '@vitest/browser-playwright': 4.0.16 - '@vitest/browser-preview': 4.0.16 - '@vitest/browser-webdriverio': 4.0.16 - '@vitest/ui': 4.0.16 + '@vitest/browser-playwright': 4.0.18 + '@vitest/browser-preview': 4.0.18 + '@vitest/browser-webdriverio': 4.0.18 + '@vitest/ui': 4.0.18 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -1625,31 +1677,31 @@ snapshots: '@eslint/core': 0.17.0 levn: 0.4.1 - '@formatjs/ecma402-abstract@3.0.8': + '@formatjs/ecma402-abstract@3.1.1': dependencies: - '@formatjs/fast-memoize': 3.0.3 - '@formatjs/intl-localematcher': 0.7.5 + '@formatjs/fast-memoize': 3.1.0 + '@formatjs/intl-localematcher': 0.8.1 decimal.js: 10.6.0 tslib: 2.8.1 - '@formatjs/fast-memoize@3.0.3': + '@formatjs/fast-memoize@3.1.0': dependencies: tslib: 2.8.1 - '@formatjs/icu-messageformat-parser@3.3.0': + '@formatjs/icu-messageformat-parser@3.5.1': dependencies: - '@formatjs/ecma402-abstract': 3.0.8 - '@formatjs/icu-skeleton-parser': 2.0.8 + '@formatjs/ecma402-abstract': 3.1.1 + '@formatjs/icu-skeleton-parser': 2.1.1 tslib: 2.8.1 - '@formatjs/icu-skeleton-parser@2.0.8': + '@formatjs/icu-skeleton-parser@2.1.1': dependencies: - '@formatjs/ecma402-abstract': 3.0.8 + '@formatjs/ecma402-abstract': 3.1.1 tslib: 2.8.1 - '@formatjs/intl-localematcher@0.7.5': + '@formatjs/intl-localematcher@0.8.1': dependencies: - '@formatjs/fast-memoize': 3.0.3 + '@formatjs/fast-memoize': 3.1.0 tslib: 2.8.1 '@humanfs/core@0.19.1': {} @@ -1783,51 +1835,51 @@ snapshots: '@standard-schema/spec@1.1.0': {} - '@swc/core-darwin-arm64@1.15.8': + '@swc/core-darwin-arm64@1.15.11': optional: true - '@swc/core-darwin-x64@1.15.8': + '@swc/core-darwin-x64@1.15.11': optional: true - '@swc/core-linux-arm-gnueabihf@1.15.8': + '@swc/core-linux-arm-gnueabihf@1.15.11': optional: true - '@swc/core-linux-arm64-gnu@1.15.8': + '@swc/core-linux-arm64-gnu@1.15.11': optional: true - '@swc/core-linux-arm64-musl@1.15.8': + '@swc/core-linux-arm64-musl@1.15.11': optional: true - '@swc/core-linux-x64-gnu@1.15.8': + '@swc/core-linux-x64-gnu@1.15.11': optional: true - '@swc/core-linux-x64-musl@1.15.8': + '@swc/core-linux-x64-musl@1.15.11': optional: true - '@swc/core-win32-arm64-msvc@1.15.8': + '@swc/core-win32-arm64-msvc@1.15.11': optional: true - '@swc/core-win32-ia32-msvc@1.15.8': + '@swc/core-win32-ia32-msvc@1.15.11': optional: true - '@swc/core-win32-x64-msvc@1.15.8': + '@swc/core-win32-x64-msvc@1.15.11': optional: true - '@swc/core@1.15.8': + '@swc/core@1.15.11': dependencies: '@swc/counter': 0.1.3 '@swc/types': 0.1.25 optionalDependencies: - '@swc/core-darwin-arm64': 1.15.8 - '@swc/core-darwin-x64': 1.15.8 - '@swc/core-linux-arm-gnueabihf': 1.15.8 - '@swc/core-linux-arm64-gnu': 1.15.8 - '@swc/core-linux-arm64-musl': 1.15.8 - '@swc/core-linux-x64-gnu': 1.15.8 - '@swc/core-linux-x64-musl': 1.15.8 - '@swc/core-win32-arm64-msvc': 1.15.8 - '@swc/core-win32-ia32-msvc': 1.15.8 - '@swc/core-win32-x64-msvc': 1.15.8 + '@swc/core-darwin-arm64': 1.15.11 + '@swc/core-darwin-x64': 1.15.11 + '@swc/core-linux-arm-gnueabihf': 1.15.11 + '@swc/core-linux-arm64-gnu': 1.15.11 + '@swc/core-linux-arm64-musl': 1.15.11 + '@swc/core-linux-x64-gnu': 1.15.11 + '@swc/core-linux-x64-musl': 1.15.11 + '@swc/core-win32-arm64-msvc': 1.15.11 + '@swc/core-win32-ia32-msvc': 1.15.11 + '@swc/core-win32-x64-msvc': 1.15.11 '@swc/counter@0.1.3': {} @@ -1849,11 +1901,16 @@ snapshots: '@types/estree@1.0.8': {} + '@types/gettext-parser@8.0.0': + dependencies: + '@types/node': 22.19.11 + '@types/readable-stream': 4.0.23 + '@types/json-schema@7.0.15': {} '@types/negotiator@0.6.4': {} - '@types/node@22.19.3': + '@types/node@22.19.11': dependencies: undici-types: 6.21.0 @@ -1865,16 +1922,20 @@ snapshots: '@types/scheduler': 0.26.0 csstype: 3.2.3 + '@types/readable-stream@4.0.23': + dependencies: + '@types/node': 22.19.11 + '@types/scheduler@0.26.0': {} - '@typescript-eslint/eslint-plugin@8.52.0(@typescript-eslint/parser@8.52.0(eslint@9.39.2)(typescript@5.9.3))(eslint@9.39.2)(typescript@5.9.3)': + '@typescript-eslint/eslint-plugin@8.55.0(@typescript-eslint/parser@8.55.0(eslint@9.39.2)(typescript@5.9.3))(eslint@9.39.2)(typescript@5.9.3)': dependencies: '@eslint-community/regexpp': 4.12.2 - '@typescript-eslint/parser': 8.52.0(eslint@9.39.2)(typescript@5.9.3) - '@typescript-eslint/scope-manager': 8.52.0 - '@typescript-eslint/type-utils': 8.52.0(eslint@9.39.2)(typescript@5.9.3) - '@typescript-eslint/utils': 8.52.0(eslint@9.39.2)(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.52.0 + '@typescript-eslint/parser': 8.55.0(eslint@9.39.2)(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.55.0 + '@typescript-eslint/type-utils': 8.55.0(eslint@9.39.2)(typescript@5.9.3) + '@typescript-eslint/utils': 8.55.0(eslint@9.39.2)(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.55.0 eslint: 9.39.2 ignore: 7.0.5 natural-compare: 1.4.0 @@ -1883,41 +1944,41 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.52.0(eslint@9.39.2)(typescript@5.9.3)': + '@typescript-eslint/parser@8.55.0(eslint@9.39.2)(typescript@5.9.3)': dependencies: - '@typescript-eslint/scope-manager': 8.52.0 - '@typescript-eslint/types': 8.52.0 - '@typescript-eslint/typescript-estree': 8.52.0(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.52.0 + '@typescript-eslint/scope-manager': 8.55.0 + '@typescript-eslint/types': 8.55.0 + '@typescript-eslint/typescript-estree': 8.55.0(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.55.0 debug: 4.4.3 eslint: 9.39.2 typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.52.0(typescript@5.9.3)': + '@typescript-eslint/project-service@8.55.0(typescript@5.9.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.52.0(typescript@5.9.3) - '@typescript-eslint/types': 8.52.0 + '@typescript-eslint/tsconfig-utils': 8.55.0(typescript@5.9.3) + '@typescript-eslint/types': 8.55.0 debug: 4.4.3 typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.52.0': + '@typescript-eslint/scope-manager@8.55.0': dependencies: - '@typescript-eslint/types': 8.52.0 - '@typescript-eslint/visitor-keys': 8.52.0 + '@typescript-eslint/types': 8.55.0 + '@typescript-eslint/visitor-keys': 8.55.0 - '@typescript-eslint/tsconfig-utils@8.52.0(typescript@5.9.3)': + '@typescript-eslint/tsconfig-utils@8.55.0(typescript@5.9.3)': dependencies: typescript: 5.9.3 - '@typescript-eslint/type-utils@8.52.0(eslint@9.39.2)(typescript@5.9.3)': + '@typescript-eslint/type-utils@8.55.0(eslint@9.39.2)(typescript@5.9.3)': dependencies: - '@typescript-eslint/types': 8.52.0 - '@typescript-eslint/typescript-estree': 8.52.0(typescript@5.9.3) - '@typescript-eslint/utils': 8.52.0(eslint@9.39.2)(typescript@5.9.3) + '@typescript-eslint/types': 8.55.0 + '@typescript-eslint/typescript-estree': 8.55.0(typescript@5.9.3) + '@typescript-eslint/utils': 8.55.0(eslint@9.39.2)(typescript@5.9.3) debug: 4.4.3 eslint: 9.39.2 ts-api-utils: 2.4.0(typescript@5.9.3) @@ -1925,93 +1986,90 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.52.0': {} + '@typescript-eslint/types@8.55.0': {} - '@typescript-eslint/typescript-estree@8.52.0(typescript@5.9.3)': + '@typescript-eslint/typescript-estree@8.55.0(typescript@5.9.3)': dependencies: - '@typescript-eslint/project-service': 8.52.0(typescript@5.9.3) - '@typescript-eslint/tsconfig-utils': 8.52.0(typescript@5.9.3) - '@typescript-eslint/types': 8.52.0 - '@typescript-eslint/visitor-keys': 8.52.0 + '@typescript-eslint/project-service': 8.55.0(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.55.0(typescript@5.9.3) + '@typescript-eslint/types': 8.55.0 + '@typescript-eslint/visitor-keys': 8.55.0 debug: 4.4.3 minimatch: 9.0.5 - semver: 7.7.3 + semver: 7.7.4 tinyglobby: 0.2.15 ts-api-utils: 2.4.0(typescript@5.9.3) typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.52.0(eslint@9.39.2)(typescript@5.9.3)': + '@typescript-eslint/utils@8.55.0(eslint@9.39.2)(typescript@5.9.3)': dependencies: '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.2) - '@typescript-eslint/scope-manager': 8.52.0 - '@typescript-eslint/types': 8.52.0 - '@typescript-eslint/typescript-estree': 8.52.0(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.55.0 + '@typescript-eslint/types': 8.55.0 + '@typescript-eslint/typescript-estree': 8.55.0(typescript@5.9.3) eslint: 9.39.2 typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.52.0': + '@typescript-eslint/visitor-keys@8.55.0': dependencies: - '@typescript-eslint/types': 8.52.0 + '@typescript-eslint/types': 8.55.0 eslint-visitor-keys: 4.2.1 - '@vitest/coverage-v8@4.0.16(vitest@4.0.16(@types/node@22.19.3)(yaml@2.8.2))': + '@vitest/coverage-v8@4.0.18(vitest@4.0.18(@types/node@22.19.11)(yaml@2.8.2))': dependencies: '@bcoe/v8-coverage': 1.0.2 - '@vitest/utils': 4.0.16 + '@vitest/utils': 4.0.18 ast-v8-to-istanbul: 0.3.10 istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 - istanbul-lib-source-maps: 5.0.6 istanbul-reports: 3.2.0 magicast: 0.5.1 obug: 2.1.1 std-env: 3.10.0 tinyrainbow: 3.0.3 - vitest: 4.0.16(@types/node@22.19.3)(yaml@2.8.2) - transitivePeerDependencies: - - supports-color + vitest: 4.0.18(@types/node@22.19.11)(yaml@2.8.2) - '@vitest/expect@4.0.16': + '@vitest/expect@4.0.18': dependencies: '@standard-schema/spec': 1.1.0 '@types/chai': 5.2.3 - '@vitest/spy': 4.0.16 - '@vitest/utils': 4.0.16 + '@vitest/spy': 4.0.18 + '@vitest/utils': 4.0.18 chai: 6.2.2 tinyrainbow: 3.0.3 - '@vitest/mocker@4.0.16(vite@7.3.1(@types/node@22.19.3)(yaml@2.8.2))': + '@vitest/mocker@4.0.18(vite@7.3.1(@types/node@22.19.11)(yaml@2.8.2))': dependencies: - '@vitest/spy': 4.0.16 + '@vitest/spy': 4.0.18 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 7.3.1(@types/node@22.19.3)(yaml@2.8.2) + vite: 7.3.1(@types/node@22.19.11)(yaml@2.8.2) - '@vitest/pretty-format@4.0.16': + '@vitest/pretty-format@4.0.18': dependencies: tinyrainbow: 3.0.3 - '@vitest/runner@4.0.16': + '@vitest/runner@4.0.18': dependencies: - '@vitest/utils': 4.0.16 + '@vitest/utils': 4.0.18 pathe: 2.0.3 - '@vitest/snapshot@4.0.16': + '@vitest/snapshot@4.0.18': dependencies: - '@vitest/pretty-format': 4.0.16 + '@vitest/pretty-format': 4.0.18 magic-string: 0.30.21 pathe: 2.0.3 - '@vitest/spy@4.0.16': {} + '@vitest/spy@4.0.18': {} - '@vitest/utils@4.0.16': + '@vitest/utils@4.0.18': dependencies: - '@vitest/pretty-format': 4.0.16 + '@vitest/pretty-format': 4.0.18 tinyrainbow: 3.0.3 acorn-jsx@5.3.2(acorn@8.15.0): @@ -2098,6 +2156,8 @@ snapshots: consola@3.4.2: {} + content-type@1.0.5: {} + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -2114,6 +2174,10 @@ snapshots: deep-is@0.1.4: {} + encoding@0.1.13: + dependencies: + iconv-lite: 0.6.3 + es-module-lexer@1.7.0: {} esbuild@0.27.2: @@ -2256,6 +2320,11 @@ snapshots: fsevents@2.3.3: optional: true + gettext-parser@9.0.1: + dependencies: + content-type: 1.0.5 + encoding: 0.1.13 + glob-parent@6.0.2: dependencies: is-glob: 4.0.3 @@ -2268,6 +2337,10 @@ snapshots: html-escaper@2.0.2: {} + iconv-lite@0.6.3: + dependencies: + safer-buffer: 2.1.2 + ignore@5.3.2: {} ignore@7.0.5: {} @@ -2279,11 +2352,11 @@ snapshots: imurmurhash@0.1.4: {} - intl-messageformat@11.0.9: + intl-messageformat@11.1.2: dependencies: - '@formatjs/ecma402-abstract': 3.0.8 - '@formatjs/fast-memoize': 3.0.3 - '@formatjs/icu-messageformat-parser': 3.3.0 + '@formatjs/ecma402-abstract': 3.1.1 + '@formatjs/fast-memoize': 3.1.0 + '@formatjs/icu-messageformat-parser': 3.5.1 tslib: 2.8.1 is-extglob@2.1.1: {} @@ -2302,14 +2375,6 @@ snapshots: make-dir: 4.0.0 supports-color: 7.2.0 - istanbul-lib-source-maps@5.0.6: - dependencies: - '@jridgewell/trace-mapping': 0.3.31 - debug: 4.4.3 - istanbul-lib-coverage: 3.2.2 - transitivePeerDependencies: - - supports-color - istanbul-reports@3.2.0: dependencies: html-escaper: 2.0.2 @@ -2490,7 +2555,7 @@ snapshots: prelude-ls@1.2.1: {} - prettier@3.7.4: {} + prettier@3.8.1: {} punycode@2.3.1: {} @@ -2541,12 +2606,16 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.55.1 fsevents: 2.3.3 + safer-buffer@2.1.2: {} + scheduler@0.23.2: dependencies: loose-envify: 1.4.0 semver@7.7.3: {} + semver@7.7.4: {} + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 @@ -2617,7 +2686,7 @@ snapshots: tslib@2.8.1: {} - tsup@8.5.1(@swc/core@1.15.8)(postcss@8.5.6)(typescript@5.9.3)(yaml@2.8.2): + tsup@8.5.1(@swc/core@1.15.11)(postcss@8.5.6)(typescript@5.9.3)(yaml@2.8.2): dependencies: bundle-require: 5.1.0(esbuild@0.27.2) cac: 6.7.14 @@ -2637,7 +2706,7 @@ snapshots: tinyglobby: 0.2.15 tree-kill: 1.2.2 optionalDependencies: - '@swc/core': 1.15.8 + '@swc/core': 1.15.11 postcss: 8.5.6 typescript: 5.9.3 transitivePeerDependencies: @@ -2650,12 +2719,12 @@ snapshots: dependencies: prelude-ls: 1.2.1 - typescript-eslint@8.52.0(eslint@9.39.2)(typescript@5.9.3): + typescript-eslint@8.55.0(eslint@9.39.2)(typescript@5.9.3): dependencies: - '@typescript-eslint/eslint-plugin': 8.52.0(@typescript-eslint/parser@8.52.0(eslint@9.39.2)(typescript@5.9.3))(eslint@9.39.2)(typescript@5.9.3) - '@typescript-eslint/parser': 8.52.0(eslint@9.39.2)(typescript@5.9.3) - '@typescript-eslint/typescript-estree': 8.52.0(typescript@5.9.3) - '@typescript-eslint/utils': 8.52.0(eslint@9.39.2)(typescript@5.9.3) + '@typescript-eslint/eslint-plugin': 8.55.0(@typescript-eslint/parser@8.55.0(eslint@9.39.2)(typescript@5.9.3))(eslint@9.39.2)(typescript@5.9.3) + '@typescript-eslint/parser': 8.55.0(eslint@9.39.2)(typescript@5.9.3) + '@typescript-eslint/typescript-estree': 8.55.0(typescript@5.9.3) + '@typescript-eslint/utils': 8.55.0(eslint@9.39.2)(typescript@5.9.3) eslint: 9.39.2 typescript: 5.9.3 transitivePeerDependencies: @@ -2671,7 +2740,7 @@ snapshots: dependencies: punycode: 2.3.1 - vite@7.3.1(@types/node@22.19.3)(yaml@2.8.2): + vite@7.3.1(@types/node@22.19.11)(yaml@2.8.2): dependencies: esbuild: 0.27.2 fdir: 6.5.0(picomatch@4.0.3) @@ -2680,19 +2749,19 @@ snapshots: rollup: 4.55.1 tinyglobby: 0.2.15 optionalDependencies: - '@types/node': 22.19.3 + '@types/node': 22.19.11 fsevents: 2.3.3 yaml: 2.8.2 - vitest@4.0.16(@types/node@22.19.3)(yaml@2.8.2): + vitest@4.0.18(@types/node@22.19.11)(yaml@2.8.2): dependencies: - '@vitest/expect': 4.0.16 - '@vitest/mocker': 4.0.16(vite@7.3.1(@types/node@22.19.3)(yaml@2.8.2)) - '@vitest/pretty-format': 4.0.16 - '@vitest/runner': 4.0.16 - '@vitest/snapshot': 4.0.16 - '@vitest/spy': 4.0.16 - '@vitest/utils': 4.0.16 + '@vitest/expect': 4.0.18 + '@vitest/mocker': 4.0.18(vite@7.3.1(@types/node@22.19.11)(yaml@2.8.2)) + '@vitest/pretty-format': 4.0.18 + '@vitest/runner': 4.0.18 + '@vitest/snapshot': 4.0.18 + '@vitest/spy': 4.0.18 + '@vitest/utils': 4.0.18 es-module-lexer: 1.7.0 expect-type: 1.3.0 magic-string: 0.30.21 @@ -2704,10 +2773,10 @@ snapshots: tinyexec: 1.0.2 tinyglobby: 0.2.15 tinyrainbow: 3.0.3 - vite: 7.3.1(@types/node@22.19.3)(yaml@2.8.2) + vite: 7.3.1(@types/node@22.19.11)(yaml@2.8.2) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.19.3 + '@types/node': 22.19.11 transitivePeerDependencies: - jiti - less diff --git a/package/src/__mocks__/i18n.config.ts b/package/src/__mocks__/i18n.config.ts index f8f713e..fe53586 100644 --- a/package/src/__mocks__/i18n.config.ts +++ b/package/src/__mocks__/i18n.config.ts @@ -1,6 +1,6 @@ -import type { UserConfig } from "~/config/types"; +import type { Config } from "~/config/types"; -const config: UserConfig = { +const config: Config = { domains: [ { domain: "en.example.com:3000", diff --git a/package/src/cli/commands/generate/errors.ts b/package/src/cli/commands/generate/errors.ts index d92b24f..e1f5e92 100644 --- a/package/src/cli/commands/generate/errors.ts +++ b/package/src/cli/commands/generate/errors.ts @@ -1,4 +1,4 @@ -import type { Config } from "~/config/types"; +import type { ResolvedConfig } from "~/config/types"; export const configNotFoundError = (configPath: string) => { return new Error( @@ -6,13 +6,13 @@ export const configNotFoundError = (configPath: string) => { ); }; -export const routesOriginDirNotFoundError = (config: Config) => { +export const routesOriginDirNotFoundError = (config: ResolvedConfig) => { return new Error( `Cannot find directory: ${config.routes.originDir}\nAre your App Router routes defined in the specified directory?`, ); }; -export const keyExtractionDirsNotFoundError = (config: Config) => { +export const keyExtractionDirsNotFoundError = (config: ResolvedConfig) => { return new Error( `Cannot find one or more key extraction directories: ${config.messages.keyExtractionDirs.join( ", ", @@ -20,7 +20,7 @@ export const keyExtractionDirsNotFoundError = (config: Config) => { ); }; -export const messagesOriginDirNotFoundError = (config: Config) => { +export const messagesOriginDirNotFoundError = (config: ResolvedConfig) => { return new Error( `Cannot find directory: ${config.messages.originDir}\nIs your messages origin directory correctly configured?`, ); diff --git a/package/src/cli/commands/generate/extractKeysFromSourceFiles.ts b/package/src/cli/commands/generate/extractKeysFromSourceFiles.ts index ee9c085..b1a13ac 100644 --- a/package/src/cli/commands/generate/extractKeysFromSourceFiles.ts +++ b/package/src/cli/commands/generate/extractKeysFromSourceFiles.ts @@ -3,18 +3,31 @@ import { readFileSync } from "fs"; import { readdirSync } from "node:fs"; import path from "path"; import { fileURLToPath } from "url"; -import type { Config, MessageEntry } from "~/config/types"; +import type { MessageEntry, ResolvedConfig } from "~/config/types"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const PLUGIN_PATH = path.resolve(__dirname, "key_extractor.wasm"); -export async function extractKeysFromSourceFiles(config: Config) { +const sourceFileKeysCache = new Map(); + +export async function extractKeysFromSourceFiles( + config: ResolvedConfig, + updatedFilePath?: string, +) { + const messagesOriginDir = path.resolve(config.messages.originDir); + const routesLocalizedDir = path.resolve(config.routes.localizedDir); const srcFiles = config.messages.keyExtractionDirs.flatMap((srcDir) => - collectSourceFiles(srcDir), + collectSourceFilesFromDir(srcDir, [messagesOriginDir, routesLocalizedDir]), ); const keysMap = new Map(); for (const filePath of srcFiles) { - const keys = await extractKeysFromSourceFile(filePath); + const cachedKeys = sourceFileKeysCache.get(filePath); + const useCachedKeys = + updatedFilePath && filePath !== updatedFilePath && cachedKeys; + const keys = useCachedKeys + ? cachedKeys + : await extractKeysFromSourceFile(filePath); + sourceFileKeysCache.set(filePath, keys); keys.forEach((k) => { const description = k.description ?? keysMap.get(k.key)?.description; keysMap.set(k.key, { ...k, description }); @@ -25,13 +38,14 @@ export async function extractKeysFromSourceFiles(config: Config) { const SOURCE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx"]; -function collectSourceFiles(directory: string) { +function collectSourceFilesFromDir(dir: string, excludedDirs: string[]) { const files: string[] = []; - const entries = readdirSync(directory, { withFileTypes: true }); + const entries = readdirSync(dir, { withFileTypes: true }); for (const entry of entries) { - const fullPath = `${directory}/${entry.name}`; + const fullPath = path.resolve(dir, entry.name); if (entry.isDirectory()) { - files.push(...collectSourceFiles(fullPath)); + if (excludedDirs.includes(fullPath)) continue; + files.push(...collectSourceFilesFromDir(fullPath, excludedDirs)); } else if (entry.isFile()) { const ext = path.extname(entry.name).toLowerCase(); if (SOURCE_EXTENSIONS.includes(ext)) files.push(fullPath); diff --git a/package/src/cli/commands/generate/generateDistFiles.ts b/package/src/cli/commands/generate/generateDistFiles.ts index f0f9982..287d94a 100644 --- a/package/src/cli/commands/generate/generateDistFiles.ts +++ b/package/src/cli/commands/generate/generateDistFiles.ts @@ -10,7 +10,7 @@ import { getRoutePath, isPageOriginRoute, } from "~/cli/utils/route-utils"; -import type { Config, MessageEntry } from "~/config/types"; +import type { MessageEntry, ResolvedConfig } from "~/config/types"; import { getLocales, getUnPrefixedLocales } from "~/config/utils"; import type { Schema } from "~/types/schema"; import { makeDirectory } from "~/utils/fs-utils"; @@ -27,7 +27,7 @@ const schemaAugmentationTemplate = "".concat( "\t\tschema: typeof schema;\n\t}\n}\n", ); -export function generateOutDir(config: Config) { +export function generateOutDir(config: ResolvedConfig) { makeDirectory(config.outDir); writeFileSync(path.join(config.outDir, ".gitignore"), "*"); } @@ -38,7 +38,7 @@ export function generateLocalizedDir(localizedDir: string) { } export function generateSchemaFiles( - config: Config, + config: ResolvedConfig, originRoutes?: OriginRoute[], ) { const schema = generateSchema(config, originRoutes); @@ -54,7 +54,7 @@ export function generateSchemaFiles( writeFileSync(filePath, schemaFile); } -function generateSchema(config: Config, originRoutes?: OriginRoute[]) { +function generateSchema(config: ResolvedConfig, originRoutes?: OriginRoute[]) { const routes: Schema["routes"] = {}; const unPrefixedLocales = getUnPrefixedLocales(config); originRoutes?.forEach((originRoute) => { @@ -118,7 +118,7 @@ const messagesAugmentationTemplate = "".concat( "\t\tmessagesParams: MessagesParams;\n\t}\n}\n", ); -export async function generateMessagesFiles(config: Config) { +export async function generateMessagesFiles(config: ResolvedConfig) { const { allMessageEntries, clientMessageEntries } = await getFilteredMessages(config); const jsonMessages = generateMessagesJson(allMessageEntries); @@ -140,7 +140,7 @@ export async function generateMessagesFiles(config: Config) { writeFileSync(augmentationFilePath, messagesAugmentationFile); } -async function getFilteredMessages(config: Config) { +async function getFilteredMessages(config: ResolvedConfig) { const allMessageEntries = await getMessageEntries(config); const clientKeys = config.messages.clientKeys instanceof RegExp diff --git a/package/src/cli/commands/generate/generateLocalizedRoutes.ts b/package/src/cli/commands/generate/generateLocalizedRoutes.ts index 46c196c..7af1489 100644 --- a/package/src/cli/commands/generate/generateLocalizedRoutes.ts +++ b/package/src/cli/commands/generate/generateLocalizedRoutes.ts @@ -7,7 +7,7 @@ import { } from "fs"; import path from "path"; import { toPascalCase } from "~/cli/utils/string-utils"; -import type { Config } from "~/config/types"; +import type { ResolvedConfig } from "~/config/types"; import { makeDirectory, toPosixPath } from "~/utils/fs-utils"; import type { OriginRoute } from "./getOriginRoutes"; import { getTemplateCompiler } from "./getTemplateCompiler"; @@ -15,7 +15,7 @@ import { getTemplateCompiler } from "./getTemplateCompiler"; let prevRoutes: OriginRoute[] = []; export function generateLocalizedRoutes( - config: Config, + config: ResolvedConfig, originRoutes: OriginRoute[], updatedOriginPath?: string, ) { @@ -81,7 +81,7 @@ function needsUpdate( return isUpdatedOriginRoute || hasNewLocalizedPaths; } -function deleteRemovedPaths(config: Config, removedPaths: Set) { +function deleteRemovedPaths(config: ResolvedConfig, removedPaths: Set) { removedPaths.forEach((localizedPath) => { try { const fullPath = path.join(config.routes.localizedDir, localizedPath); diff --git a/package/src/cli/commands/generate/getMessageEntries.ts b/package/src/cli/commands/generate/getMessageEntries.ts index b51cf8c..cf1107d 100644 --- a/package/src/cli/commands/generate/getMessageEntries.ts +++ b/package/src/cli/commands/generate/getMessageEntries.ts @@ -1,24 +1,26 @@ -import type { Config, MessageEntry } from "~/config/types"; +import type { MessageEntry, ResolvedConfig } from "~/config/types"; import { getLocales } from "~/config/utils"; import { flatten } from "~/utils/obj-utils"; -export async function getMessageEntries(config: Config) { +export async function getMessageEntries(config: ResolvedConfig) { const messagesMaps: Record = {}; const locales = getLocales(config); - for await (const locale of locales) { - if (config.messages.getMessages) { - const messages = await config.messages.getMessages(locale); - const messageEntries = Object.entries(flatten(messages)).map( - ([key, message]) => ({ - key, - message, - }), - ); + await Promise.all( + locales.map(async (locale) => { + if (config.messages.getMessages) { + const messages = await config.messages.getMessages(locale); + const messageEntries = Object.entries(flatten(messages)).map( + ([key, message]) => ({ + key, + message, + }), + ); + messagesMaps[locale] = messageEntries; + return; + } + const messageEntries = await config.messages.loadMessageEntries(locale); messagesMaps[locale] = messageEntries; - continue; - } - const messageEntries = await config.messages.loadMessageEntries(locale); - messagesMaps[locale] = messageEntries; - } + }), + ); return messagesMaps; } diff --git a/package/src/cli/commands/generate/getOriginRoutes.ts b/package/src/cli/commands/generate/getOriginRoutes.ts index 4d0d9a4..196ff30 100644 --- a/package/src/cli/commands/generate/getOriginRoutes.ts +++ b/package/src/cli/commands/generate/getOriginRoutes.ts @@ -1,6 +1,6 @@ import { readdirSync } from "fs"; import path from "path"; -import type { Config } from "~/config/types"; +import type { ResolvedConfig } from "~/config/types"; import { getLocales } from "~/config/utils"; import type { Locale } from "~/types/schema"; import { isDirectory, isFile } from "~/utils/fs-utils"; @@ -13,7 +13,7 @@ export type OriginRoute = { }; type GetOriginRoutesParams = { - config: Config; + config: ResolvedConfig; directory?: string; parentRoute?: OriginRoute; locales_?: Locale[]; diff --git a/package/src/cli/commands/generate/getTemplateCompiler.test.ts b/package/src/cli/commands/generate/getTemplateCompiler.test.ts index e33ffd0..00a5ef5 100644 --- a/package/src/cli/commands/generate/getTemplateCompiler.test.ts +++ b/package/src/cli/commands/generate/getTemplateCompiler.test.ts @@ -1,11 +1,11 @@ import { afterEach, describe, expect, test } from "vitest"; import { DEFAULT_CONFIG } from "~/config"; -import type { Config } from "~/config/types"; +import type { ResolvedConfig } from "~/config/types"; import { mergeConfigs } from "~/config/utils"; import type { OriginRoute } from "./getOriginRoutes"; import { getTemplateCompiler } from "./getTemplateCompiler"; -const mocks: { config: Config; originRoute: OriginRoute } = { +const mocks: { config: ResolvedConfig; originRoute: OriginRoute } = { config: mergeConfigs(DEFAULT_CONFIG, { routes: { originDir: "./src/__mocks__/_app", diff --git a/package/src/cli/commands/generate/getTemplateCompiler.ts b/package/src/cli/commands/generate/getTemplateCompiler.ts index 8394dfc..1060459 100644 --- a/package/src/cli/commands/generate/getTemplateCompiler.ts +++ b/package/src/cli/commands/generate/getTemplateCompiler.ts @@ -1,7 +1,7 @@ import { readFileSync } from "fs"; import path from "path"; import { getRouteName, isPageOriginRoute } from "~/cli/utils/route-utils"; -import type { Config } from "~/config/types"; +import type { ResolvedConfig } from "~/config/types"; import type { OriginRoute, RouteType } from "./getOriginRoutes"; type PatternKey = (typeof PATTERN_KEYS)[number]; @@ -72,7 +72,10 @@ const routeTypeTemplates: Record, string> = { "twitter-image": functionTemplate, }; -export function getTemplateCompiler(config: Config, originRoute: OriginRoute) { +export function getTemplateCompiler( + config: ResolvedConfig, + originRoute: OriginRoute, +) { if (originRoute.type === "copy") return () => ""; const originPath = path.join(config.routes.originDir, originRoute.path); const contents = readFileSync(originPath).toString(); @@ -107,7 +110,7 @@ function withMetadata( template: string, originRoute: OriginRoute, originContents: string, - config: Config, + config: ResolvedConfig, ) { const staticMetadataRegExp = new RegExp(`export const metadata`); const generateMetadataRegExp = new RegExp( diff --git a/package/src/cli/commands/generate/index.ts b/package/src/cli/commands/generate/index.ts index 529a1ce..98b2672 100644 --- a/package/src/cli/commands/generate/index.ts +++ b/package/src/cli/commands/generate/index.ts @@ -3,7 +3,7 @@ import { watch } from "fs"; import path from "path"; import { debounce } from "~/cli/utils/debounce"; import { DEFAULT_CONFIG } from "~/config"; -import type { Config, UserConfig } from "~/config/types"; +import type { Config, ResolvedConfig } from "~/config/types"; import { mergeConfigs } from "~/config/utils"; import { isDirectory, isFile, rmDirectory } from "~/utils/fs-utils"; import { compile } from "~/utils/ts-utils"; @@ -50,7 +50,7 @@ type Options = { async function generateAction(opts: Options) { if (!isFile(opts.config)) throw configNotFoundError(opts.config); - const userConfig = await compile<{ default: UserConfig }>(opts.config); + const userConfig = await compile<{ default: Config }>(opts.config); const config = mergeConfigs(DEFAULT_CONFIG, userConfig.default); generateOutDir(config); if (!opts.routes) generateSchemaFiles(config); @@ -58,7 +58,7 @@ async function generateAction(opts: Options) { if (opts.messages) await generateMessagesSubAction(config, opts); } -async function generateRoutesSubAction(config: Config, opts: Options) { +async function generateRoutesSubAction(config: ResolvedConfig, opts: Options) { if (!isDirectory(config.routes.originDir)) { throw routesOriginDirNotFoundError(config); } @@ -75,25 +75,27 @@ async function generateRoutesSubAction(config: Config, opts: Options) { } } -async function generateRoutes(config: Config, updatedOriginPath?: string) { - try { - const startTime = process.hrtime(); - const originRoutes = await getOriginRoutes({ config }); - generateLocalizedRoutes(config, originRoutes, updatedOriginPath); - generateSchemaFiles(config, originRoutes); - const endTime = process.hrtime(startTime); - const timeDiffInMs = (endTime[0] * 1000 + endTime[1] / 1000000).toFixed(2); - console.info( - `\x1b[32mNextGlobeGen\x1b[37m - Localized routes (${timeDiffInMs}ms)`, - ); - } catch (error: unknown) { - if (error instanceof Error) console.error(error.message); - } +async function generateRoutes( + config: ResolvedConfig, + updatedOriginPath?: string, +) { + const startTime = process.hrtime(); + const originRoutes = await getOriginRoutes({ config }); + generateLocalizedRoutes(config, originRoutes, updatedOriginPath); + generateSchemaFiles(config, originRoutes); + const endTime = process.hrtime(startTime); + const timeDiffInMs = (endTime[0] * 1000 + endTime[1] / 1000000).toFixed(2); + console.info( + `\x1b[32mNextGlobeGen\x1b[37m - Localized routes (${timeDiffInMs}ms)`, + ); } const debouncedGenerateRoutes = debounce(generateRoutes, DEBOUNCE_DELAY); -async function generateMessagesSubAction(config: Config, opts: Options) { +async function generateMessagesSubAction( + config: ResolvedConfig, + opts: Options, +) { const messagesOriginDir = config.messages.originDir; const keyExtractionDirs = config.messages.keyExtractionDirs; if (!isDirectory(messagesOriginDir)) { @@ -117,42 +119,34 @@ async function generateMessagesSubAction(config: Config, opts: Options) { const routesLocalizedDir = path.resolve(config.routes.localizedDir); if (filePath?.startsWith(messagesOriginDir)) return; if (filePath?.startsWith(routesLocalizedDir)) return; - debouncedExtractKeys(config); + debouncedExtractKeys(config, filePath); }); }); } } -async function generateMessages(config: Config) { - try { - const startTime = process.hrtime(); - await generateMessagesFiles(config); - const endTime = process.hrtime(startTime); - const timeDiffInMs = (endTime[0] * 1000 + endTime[1] / 1000000).toFixed(2); - console.info( - `\x1b[32mNextGlobeGen\x1b[37m - Compiled messages (${timeDiffInMs}ms)`, - ); - } catch (error: unknown) { - if (error instanceof Error) console.error(error.message); - } +async function generateMessages(config: ResolvedConfig) { + const startTime = process.hrtime(); + await generateMessagesFiles(config); + const endTime = process.hrtime(startTime); + const timeDiffInMs = (endTime[0] * 1000 + endTime[1] / 1000000).toFixed(2); + console.info( + `\x1b[32mNextGlobeGen\x1b[37m - Compiled messages (${timeDiffInMs}ms)`, + ); } const debouncedGenerateMessages = debounce(generateMessages, DEBOUNCE_DELAY); -async function extractKeys(config: Config) { +async function extractKeys(config: ResolvedConfig, filePath?: string) { if (config.messages.keyExtractionDirs.length === 0) return; - try { - const startTime = process.hrtime(); - const extractedKeys = await extractKeysFromSourceFiles(config); - await syncMessages(extractedKeys, config); - const endTime = process.hrtime(startTime); - const timeDiffInMs = (endTime[0] * 1000 + endTime[1] / 1000000).toFixed(2); - console.info( - `\x1b[32mNextGlobeGen\x1b[37m - Extracted keys (${timeDiffInMs}ms)`, - ); - } catch (error: unknown) { - if (error instanceof Error) console.error(error.message); - } + const startTime = process.hrtime(); + const extractedKeys = await extractKeysFromSourceFiles(config, filePath); + await syncMessages(extractedKeys, config); + const endTime = process.hrtime(startTime); + const timeDiffInMs = (endTime[0] * 1000 + endTime[1] / 1000000).toFixed(2); + console.info( + `\x1b[32mNextGlobeGen\x1b[37m - Extracted keys (${timeDiffInMs}ms)`, + ); } const debouncedExtractKeys = debounce(extractKeys, DEBOUNCE_DELAY); diff --git a/package/src/cli/commands/generate/syncMessages.ts b/package/src/cli/commands/generate/syncMessages.ts index 5a7d841..bc7ecdb 100644 --- a/package/src/cli/commands/generate/syncMessages.ts +++ b/package/src/cli/commands/generate/syncMessages.ts @@ -1,4 +1,4 @@ -import type { Config, MessageEntry } from "~/config/types"; +import type { MessageEntry, ResolvedConfig } from "~/config/types"; import { getLocales } from "~/config/utils"; import type { Locale } from "~/types/schema"; import { getMessageEntries } from "./getMessageEntries"; @@ -7,38 +7,42 @@ const prevStringifiedMessages: Record = {}; export async function syncMessages( extractedMessages: Map, - config: Config, + config: ResolvedConfig, ) { const locales = getLocales(config); const messageEntries = await getMessageEntries(config); - locales.forEach((locale) => { - const localeMessages = new Map(extractedMessages); - const entries = messageEntries[locale] || []; - const existingEntries = new Map(entries.map((entry) => [entry.key, entry])); - existingEntries.forEach((existingEntry, key) => { - if (localeMessages.has(key)) { - const extractedEntry = { ...localeMessages.get(key)! }; - extractedEntry.message = existingEntry.message; - extractedEntry.description ??= existingEntry.description; - localeMessages.set(key, extractedEntry); - return; - } - const whitelistedKeys = - config.messages.whitelistedKeys instanceof RegExp - ? [config.messages.whitelistedKeys] - : config.messages.whitelistedKeys; - const shouldBePruned = - config.messages.pruneUnusedKeys && - !whitelistedKeys?.some((regExp) => regExp.test(key)); - if (!shouldBePruned) localeMessages.set(key, existingEntry); - }); - const sortedMessages = localeMessages - .values() - .toArray() - .sort((a, b) => a.key.localeCompare(b.key)); - const stringifiedMessages = JSON.stringify(sortedMessages); - if (stringifiedMessages === prevStringifiedMessages[locale]) return; - prevStringifiedMessages[locale] = stringifiedMessages; - config.messages.writeMessageEntries(locale, sortedMessages); - }); + await Promise.all( + locales.map((locale) => { + const localeMessages = new Map(extractedMessages); + const entries = messageEntries[locale] || []; + const existingEntries = new Map( + entries.map((entry) => [entry.key, entry]), + ); + existingEntries.forEach((existingEntry, key) => { + if (localeMessages.has(key)) { + const extractedEntry = { ...localeMessages.get(key)! }; + extractedEntry.message = existingEntry.message; + extractedEntry.description ??= existingEntry.description; + localeMessages.set(key, extractedEntry); + return; + } + const whitelistedKeys = + config.messages.whitelistedKeys instanceof RegExp + ? [config.messages.whitelistedKeys] + : config.messages.whitelistedKeys; + const shouldBePruned = + config.messages.pruneUnusedKeys && + !whitelistedKeys?.some((regExp) => regExp.test(key)); + if (!shouldBePruned) localeMessages.set(key, existingEntry); + }); + const sortedMessages = localeMessages + .values() + .toArray() + .sort((a, b) => a.key.localeCompare(b.key)); + const stringifiedMessages = JSON.stringify(sortedMessages); + if (stringifiedMessages === prevStringifiedMessages[locale]) return; + prevStringifiedMessages[locale] = stringifiedMessages; + return config.messages.writeMessageEntries(locale, sortedMessages); + }), + ); } diff --git a/package/src/config/config.ts b/package/src/config/config.ts index 6ab139f..93272c0 100644 --- a/package/src/config/config.ts +++ b/package/src/config/config.ts @@ -1,13 +1,13 @@ import { loadMessageEntries } from "./loadMessageEntries"; -import type { Config } from "./types"; +import type { ResolvedConfig } from "./types"; import { writeMessageEntries } from "./writeMessageEntries"; -export const FILE_EXTENSIONS = [".json", ".yml", ".yaml"]; +export const FILE_EXTENSIONS = [".json", ".yml", ".yaml", ".po"]; /** * The default configuration for NextGlobeGen. */ -export const DEFAULT_CONFIG: Config = { +export const DEFAULT_CONFIG: ResolvedConfig = { locales: [], defaultLocale: "", prefixDefaultLocale: true, diff --git a/package/src/config/index.ts b/package/src/config/index.ts index 4fb4816..535a3b0 100644 --- a/package/src/config/index.ts +++ b/package/src/config/index.ts @@ -1,4 +1,3 @@ export { DEFAULT_CONFIG } from "./config"; export * from "./types"; -export type { UserConfig as Config, Config as ResolvedConfig } from "./types"; export * from "./utils"; diff --git a/package/src/config/loadMessageEntries.ts b/package/src/config/loadMessageEntries.ts index 25cb330..776ec17 100644 --- a/package/src/config/loadMessageEntries.ts +++ b/package/src/config/loadMessageEntries.ts @@ -1,4 +1,5 @@ import { readdirSync, readFileSync } from "fs"; +import { po, type GetTextTranslation } from "gettext-parser"; import path from "path"; import { isMap, isScalar, parseDocument, YAMLMap, type ParsedNode } from "yaml"; import { isDirectory, isFile } from "~/utils/fs-utils"; @@ -67,10 +68,17 @@ function loadFileMessageEntries( ) { const content = readFileSync(filePath).toString(); const extension = path.extname(filePath); - if (extension === ".json") { - loadJsonMessageEntries(content, messagesMap, namespace); - } else { - loadYamlMessageEntries(content, messagesMap, namespace); + switch (extension) { + case ".json": + loadJsonMessageEntries(content, messagesMap, namespace); + break; + case ".yml": + case ".yaml": + loadYamlMessageEntries(content, messagesMap, namespace); + break; + case ".po": + loadPoMessageEntries(content, messagesMap, namespace); + break; } } @@ -118,3 +126,20 @@ function getYamlMessageEntriesFromMap( messagesMap.set(key, { key, message, description }); }); } + +function loadPoMessageEntries( + content: string, + messagesMap: Map, + namespace?: string, +) { + const parsed = po.parse(content); + const translations = Object.values( + parsed.translations || {}, + ).flatMap(Object.values); + translations.forEach((t) => { + const key = namespace ? `${namespace}.${t.msgid}` : t.msgid; + const message = t.msgstr.at(0) || ""; + const description = t.comments?.extracted?.trim(); + messagesMap.set(key, { key, message, description }); + }); +} diff --git a/package/src/config/types.ts b/package/src/config/types.ts index 1330e41..1142400 100644 --- a/package/src/config/types.ts +++ b/package/src/config/types.ts @@ -90,8 +90,8 @@ export type MessagesConfig = { whitelistedKeys?: RegExp[] | RegExp; }; -/** Complete configuration for next-globe-gen */ -export type Config = { +/** Resolved configuration for next-globe-gen */ +export type ResolvedConfig = { outDir: string; routes: RoutesConfig; messages: MessagesConfig; @@ -122,7 +122,7 @@ export type DeepPartial = * ], * }; */ -export type UserConfig = DeepPartial<{ +export type Config = DeepPartial<{ /** Output directory for generated files (default: "./next-globe-gen") */ outDir: string; /** Configuration for route generation and localization */ diff --git a/package/src/config/utils.ts b/package/src/config/utils.ts index e93c0f5..63b5a97 100644 --- a/package/src/config/utils.ts +++ b/package/src/config/utils.ts @@ -1,9 +1,9 @@ import type { Formats } from "intl-messageformat"; import type { - Config, DeepPartial, DomainConfig, MessagesConfig, + ResolvedConfig, } from "./types"; /** @@ -13,7 +13,10 @@ import type { * @param b - The partial user configuration to merge * @returns The merged configuration object */ -export function mergeConfigs(a: Config, b: DeepPartial) { +export function mergeConfigs( + a: ResolvedConfig, + b: DeepPartial, +): ResolvedConfig { return { ...a, ...b, @@ -23,7 +26,7 @@ export function mergeConfigs(a: Config, b: DeepPartial) { b.messages as Partial | undefined, ), routes: { ...a.routes, ...b.routes }, - } as Config; + } as ResolvedConfig; } function mergeDomainConfigs(a?: DomainConfig[], b?: DomainConfig[]) { @@ -54,7 +57,7 @@ function mergeFormatsConfigs(a?: Partial, b?: Partial) { * @param config - The configuration object * @returns Array of locale codes */ -export function getLocales(config: Config) { +export function getLocales(config: ResolvedConfig) { if (!config.domains) return config.locales; return config.domains .flatMap(({ locales }) => locales) @@ -70,7 +73,7 @@ export function getLocales(config: Config) { * @param config - The configuration object * @returns A Set of locale codes that should not be prefixed */ -export function getUnPrefixedLocales(config: Config) { +export function getUnPrefixedLocales(config: ResolvedConfig) { const prefixDefaultLocale = typeof config.routes.prefixDefaultLocale === "boolean" ? config.routes.prefixDefaultLocale diff --git a/package/src/config/writeMessageEntries.ts b/package/src/config/writeMessageEntries.ts index 18148cc..28081b1 100644 --- a/package/src/config/writeMessageEntries.ts +++ b/package/src/config/writeMessageEntries.ts @@ -1,4 +1,9 @@ import { readdirSync, rmSync, writeFileSync } from "fs"; +import { + po, + type GetTextTranslationRecord, + type GetTextTranslations, +} from "gettext-parser"; import path from "path"; import { Document, isMap, isScalar } from "yaml"; import { isDirectory, isFile } from "~/utils/fs-utils"; @@ -13,7 +18,7 @@ export function writeMessageEntries( ) { const messagesMap = new Map(messages.map((msg) => [msg.key, msg])); const dirPath = path.join(this.originDir, locale); - writeMessageEntriesToDir(dirPath, messagesMap); + writeMessageEntriesToDir(dirPath, locale, messagesMap); writeMessageEntriesToRoot.bind(this)(locale, messagesMap); } @@ -25,15 +30,16 @@ function writeMessageEntriesToRoot( for (const extension of FILE_EXTENSIONS) { const filePath = path.join(this.originDir, `${locale}${extension}`); if (!isFile(filePath)) continue; - writeMessageEntriesToFile(filePath, messagesMap); + writeMessageEntriesToFile(filePath, locale, messagesMap); return; } const defaultFilePath = path.join(this.originDir, `${locale}.json`); - writeMessageEntriesToFile(defaultFilePath, messagesMap); + writeMessageEntriesToFile(defaultFilePath, locale, messagesMap); } function writeMessageEntriesToDir( dirPath: string, + locale: string, messages: Map, ns?: string, ) { @@ -49,7 +55,7 @@ function writeMessageEntriesToDir( subDirs?.forEach((subDir) => { const nestedDirPath = path.join(dirPath, subDir.name); const namespace = ns ? `${ns}.${subDir.name}` : subDir.name; - writeMessageEntriesToDir(nestedDirPath, messages, namespace); + writeMessageEntriesToDir(nestedDirPath, locale, messages, namespace); }); messageFiles?.forEach((file) => { const filePath = path.join(dirPath, file.name); @@ -59,12 +65,13 @@ function writeMessageEntriesToDir( if (fileName === "index") return ns; return ns ? `${ns}.${fileName}` : fileName; })(); - writeMessageEntriesToFile(filePath, messages, namespace); + writeMessageEntriesToFile(filePath, locale, messages, namespace); }); } function writeMessageEntriesToFile( filePath: string, + locale: string, messages: Map, namespace?: string, ) { @@ -87,10 +94,19 @@ function writeMessageEntriesToFile( return; } const extension = path.extname(filePath); - const content = - extension === ".json" - ? getJsonContent(namespaceMessages) - : getYamlContent(namespaceMessages); + const content = (() => { + switch (extension) { + case ".json": + return getJsonContent(namespaceMessages); + case ".yml": + case ".yaml": + return getYamlContent(namespaceMessages); + case ".po": + return getPoContent(namespaceMessages, locale); + default: + throw new Error(`Unsupported file extension: ${extension}`); + } + })(); writeFileSync(filePath, content); } @@ -122,3 +138,34 @@ function getYamlContent(messages: MessageEntry[]) { }); return doc.toString({ lineWidth: 0 }); } + +function getPoContent(messages: MessageEntry[], locale: string) { + const headersMessage = messages.find((msg) => msg.key === "")?.message; + const existingHeaders = headersMessage + ? po.parse(`msgid ""\nmsgstr "${headersMessage}"`).headers + : {}; + const headers: GetTextTranslations["headers"] = { + Language: locale, + "POT-Creation-Date": new Date().toISOString(), + "X-Generator": "NextGlobeGen (https://next-globe-gen.dev)", + "MIME-Version": "1.0", + "Content-Type": "text/plain; charset=UTF-8", + "Content-Transfer-Encoding": "8bit", + ...existingHeaders, + }; + const translations: GetTextTranslationRecord = { + "": Object.fromEntries( + messages.map((msg) => [ + msg.key, + { + msgid: msg.key, + msgstr: [msg.message], + comments: { extracted: msg.description }, + }, + ]), + ), + }; + return po + .compile({ charset: "UTF-8", headers, translations }, { foldLength: 0 }) + .toString(); +} diff --git a/package/src/plugin/plugin.ts b/package/src/plugin/plugin.ts index 0a26f12..6def83c 100644 --- a/package/src/plugin/plugin.ts +++ b/package/src/plugin/plugin.ts @@ -11,7 +11,7 @@ import type { NextJsWebpackConfig } from "next/dist/server/config-shared"; import { spawn, spawnSync } from "node:child_process"; import { createRequire } from "node:module"; import { resolve } from "node:path"; -import type { DomainConfig, UserConfig } from "~/config/types"; +import type { Config, DomainConfig } from "~/config/types"; import { compile } from "~/utils/ts-utils"; type Phase = @@ -36,7 +36,7 @@ export default function createNextGlobeGenPlugin( ) { return function withNextGlobeGen(config: NextConfig) { return async (phase: Phase) => { - const userConfig = await compile<{ default: UserConfig }>(configPath); + const userConfig = await compile<{ default: Config }>(configPath); const outDir = userConfig.default.outDir ?? "./next-globe-gen"; await useGenerator(configPath, phase); return addDomainRewrites( diff --git a/package/src/router/client/index.ts b/package/src/router/client/index.ts index f7a2083..f4da41d 100644 --- a/package/src/router/client/index.ts +++ b/package/src/router/client/index.ts @@ -1,4 +1,4 @@ -import type { UserConfig } from "~/config/types"; +import type { Config as UserConfig } from "~/config/types"; import type { createHref as $createHref, createTranslator as $createTranslator,