@@ -32,61 +32,154 @@ fn builtin_rules() -> HashMap<String, CompatEntry> {
3232 ( "tracing" , "compatible" , None , None , None ) ,
3333 ( "sqlx" , "compatible" , None , None , None ) ,
3434 ( "rustls" , "compatible" , None , None , None ) ,
35- ( "openssl-sys" , "incompatible" , Some ( "FFI to native OpenSSL" ) , Some ( "rustls" ) , None ) ,
36- ( "openssl" , "incompatible" , Some ( "FFI to native OpenSSL" ) , Some ( "rustls" ) , None ) ,
37- ( "libz-sys" , "incompatible" , Some ( "FFI to native zlib" ) , Some ( "flate2 with rust backend" ) , None ) ,
38- ( "ring" , "incompatible" , Some ( "Contains platform-specific assembly" ) , Some ( "aws-lc-rs or rustls" ) , None ) ,
39- ( "nix" , "incompatible" , Some ( "Direct Unix syscall wrappers" ) , None , None ) ,
35+ (
36+ "openssl-sys" ,
37+ "incompatible" ,
38+ Some ( "FFI to native OpenSSL" ) ,
39+ Some ( "rustls" ) ,
40+ None ,
41+ ) ,
42+ (
43+ "openssl" ,
44+ "incompatible" ,
45+ Some ( "FFI to native OpenSSL" ) ,
46+ Some ( "rustls" ) ,
47+ None ,
48+ ) ,
49+ (
50+ "libz-sys" ,
51+ "incompatible" ,
52+ Some ( "FFI to native zlib" ) ,
53+ Some ( "flate2 with rust backend" ) ,
54+ None ,
55+ ) ,
56+ (
57+ "ring" ,
58+ "incompatible" ,
59+ Some ( "Contains platform-specific assembly" ) ,
60+ Some ( "aws-lc-rs or rustls" ) ,
61+ None ,
62+ ) ,
63+ (
64+ "nix" ,
65+ "incompatible" ,
66+ Some ( "Direct Unix syscall wrappers" ) ,
67+ None ,
68+ None ,
69+ ) ,
4070 ( "libc" , "shim_compatible" , None , None , Some ( "filesystem" ) ) ,
4171 ] ;
4272 for ( name, verdict, reason, alt, shim) in rust_rules {
43- rules. insert ( name. to_string ( ) , CompatEntry {
44- name : name. to_string ( ) ,
45- verdict : verdict. to_string ( ) ,
46- reason : reason. map ( String :: from) ,
47- alternative : alt. map ( String :: from) ,
48- shim : shim. map ( String :: from) ,
49- migration_guide : None ,
50- } ) ;
73+ rules. insert (
74+ name. to_string ( ) ,
75+ CompatEntry {
76+ name : name. to_string ( ) ,
77+ verdict : verdict. to_string ( ) ,
78+ reason : reason. map ( String :: from) ,
79+ alternative : alt. map ( String :: from) ,
80+ shim : shim. map ( String :: from) ,
81+ migration_guide : None ,
82+ } ,
83+ ) ;
5184 }
5285
5386 // Go ecosystem
5487 let go_rules = vec ! [
55- ( "github.com/gin-gonic/gin" , "incompatible" , Some ( "Uses net/http extensively" ) , Some ( "TinyGo-compatible HTTP framework" ) , None ) ,
56- ( "github.com/lib/pq" , "shim_compatible" , Some ( "Raw TCP via net.Dial" ) , None , Some ( "database_proxy" ) ) ,
57- ( "github.com/jackc/pgx" , "shim_compatible" , Some ( "TCP sockets" ) , None , Some ( "database_proxy" ) ) ,
58- ( "github.com/go-sql-driver/mysql" , "shim_compatible" , Some ( "TCP sockets via net.Dial" ) , None , Some ( "database_proxy" ) ) ,
59- ( "github.com/redis/go-redis/v9" , "shim_compatible" , Some ( "TCP sockets via net.Dial" ) , None , Some ( "database_proxy" ) ) ,
88+ (
89+ "github.com/gin-gonic/gin" ,
90+ "incompatible" ,
91+ Some ( "Uses net/http extensively" ) ,
92+ Some ( "TinyGo-compatible HTTP framework" ) ,
93+ None ,
94+ ) ,
95+ (
96+ "github.com/lib/pq" ,
97+ "shim_compatible" ,
98+ Some ( "Raw TCP via net.Dial" ) ,
99+ None ,
100+ Some ( "database_proxy" ) ,
101+ ) ,
102+ (
103+ "github.com/jackc/pgx" ,
104+ "shim_compatible" ,
105+ Some ( "TCP sockets" ) ,
106+ None ,
107+ Some ( "database_proxy" ) ,
108+ ) ,
109+ (
110+ "github.com/go-sql-driver/mysql" ,
111+ "shim_compatible" ,
112+ Some ( "TCP sockets via net.Dial" ) ,
113+ None ,
114+ Some ( "database_proxy" ) ,
115+ ) ,
116+ (
117+ "github.com/redis/go-redis/v9" ,
118+ "shim_compatible" ,
119+ Some ( "TCP sockets via net.Dial" ) ,
120+ None ,
121+ Some ( "database_proxy" ) ,
122+ ) ,
60123 ] ;
61124 for ( name, verdict, reason, alt, shim) in go_rules {
62- rules. insert ( name. to_string ( ) , CompatEntry {
63- name : name. to_string ( ) ,
64- verdict : verdict. to_string ( ) ,
65- reason : reason. map ( String :: from) ,
66- alternative : alt. map ( String :: from) ,
67- shim : shim. map ( String :: from) ,
68- migration_guide : None ,
69- } ) ;
125+ rules. insert (
126+ name. to_string ( ) ,
127+ CompatEntry {
128+ name : name. to_string ( ) ,
129+ verdict : verdict. to_string ( ) ,
130+ reason : reason. map ( String :: from) ,
131+ alternative : alt. map ( String :: from) ,
132+ shim : shim. map ( String :: from) ,
133+ migration_guide : None ,
134+ } ,
135+ ) ;
70136 }
71137
72138 // TypeScript ecosystem
73139 let ts_rules = vec ! [
74140 ( "express" , "compatible" , None , None , None ) ,
75141 ( "hono" , "compatible" , None , None , None ) ,
76- ( "sharp" , "incompatible" , Some ( "Native C++ binding (libvips)" ) , Some ( "wasm-vips" ) , None ) ,
77- ( "bcrypt" , "incompatible" , Some ( "Native C binding" ) , Some ( "bcryptjs" ) , None ) ,
78- ( "better-sqlite3" , "incompatible" , Some ( "Native C binding" ) , Some ( "sql.js" ) , None ) ,
79- ( "pg" , "shim_compatible" , Some ( "TCP sockets" ) , None , Some ( "database_proxy" ) ) ,
142+ (
143+ "sharp" ,
144+ "incompatible" ,
145+ Some ( "Native C++ binding (libvips)" ) ,
146+ Some ( "wasm-vips" ) ,
147+ None ,
148+ ) ,
149+ (
150+ "bcrypt" ,
151+ "incompatible" ,
152+ Some ( "Native C binding" ) ,
153+ Some ( "bcryptjs" ) ,
154+ None ,
155+ ) ,
156+ (
157+ "better-sqlite3" ,
158+ "incompatible" ,
159+ Some ( "Native C binding" ) ,
160+ Some ( "sql.js" ) ,
161+ None ,
162+ ) ,
163+ (
164+ "pg" ,
165+ "shim_compatible" ,
166+ Some ( "TCP sockets" ) ,
167+ None ,
168+ Some ( "database_proxy" ) ,
169+ ) ,
80170 ] ;
81171 for ( name, verdict, reason, alt, shim) in ts_rules {
82- rules. insert ( name. to_string ( ) , CompatEntry {
83- name : name. to_string ( ) ,
84- verdict : verdict. to_string ( ) ,
85- reason : reason. map ( String :: from) ,
86- alternative : alt. map ( String :: from) ,
87- shim : shim. map ( String :: from) ,
88- migration_guide : None ,
89- } ) ;
172+ rules. insert (
173+ name. to_string ( ) ,
174+ CompatEntry {
175+ name : name. to_string ( ) ,
176+ verdict : verdict. to_string ( ) ,
177+ reason : reason. map ( String :: from) ,
178+ alternative : alt. map ( String :: from) ,
179+ shim : shim. map ( String :: from) ,
180+ migration_guide : None ,
181+ } ,
182+ ) ;
90183 }
91184
92185 rules
@@ -149,7 +242,9 @@ pub fn evaluate_dependencies(
149242 blockers. push ( Blocker {
150243 dependency : dep. name . clone ( ) ,
151244 reason : entry. reason . clone ( ) . unwrap_or_default ( ) ,
152- fix : entry. alternative . as_ref ( )
245+ fix : entry
246+ . alternative
247+ . as_ref ( )
153248 . map ( |a| format ! ( "Replace with: {a}" ) )
154249 . unwrap_or_else ( || "No known alternative" . to_string ( ) ) ,
155250 effort_hours : Some ( 2.0 ) ,
@@ -239,7 +334,10 @@ mod tests {
239334 let rules = bun_compat_rules ( ) ;
240335 assert ! ( !rules. is_empty( ) , "Bun compat rules should not be empty" ) ;
241336 assert ! ( rules. contains_key( "hono" ) , "Should contain hono" ) ;
242- assert ! ( rules. contains_key( "marked" ) , "Should contain marked (failing)" ) ;
337+ assert ! (
338+ rules. contains_key( "marked" ) ,
339+ "Should contain marked (failing)"
340+ ) ;
243341 }
244342
245343 #[ test]
@@ -270,10 +368,10 @@ mod tests {
270368 #[ test]
271369 fn test_bun_mixed_deps ( ) {
272370 let deps = vec ! [
273- make_dep( "hono" ) , // pass
274- make_dep( "zod" ) , // pass
275- make_dep( "marked" ) , // fail
276- make_dep( "unknown" ) , // not in DB
371+ make_dep( "hono" ) , // pass
372+ make_dep( "zod" ) , // pass
373+ make_dep( "marked" ) , // fail
374+ make_dep( "unknown" ) , // not in DB
277375 ] ;
278376 let ( blockers, _) = evaluate_dependencies ( & deps, "bun" ) ;
279377 assert_eq ! ( blockers. len( ) , 1 ) ;
0 commit comments