@@ -21,6 +21,8 @@ use super::PackageEntry;
21
21
impl Serialize for PackageEntry {
22
22
fn serialize < S : serde:: Serializer > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error > {
23
23
let mut tuple = serializer. serialize_tuple ( 4 ) ?;
24
+
25
+ // First value is always the package key
24
26
tuple. serialize_element ( & self . ident ) ?;
25
27
26
28
// For root packages, only thing left to serialize is the root info
@@ -50,16 +52,13 @@ impl Serialize for PackageEntry {
50
52
51
53
#[ cfg( test) ]
52
54
mod test {
53
- use std:: { str :: FromStr , sync:: OnceLock } ;
55
+ use std:: sync:: OnceLock ;
54
56
55
57
use serde_json:: json;
56
58
use test_case:: test_case;
57
59
58
60
use super :: * ;
59
- use crate :: {
60
- bun:: { PackageInfo , RootInfo , WorkspaceEntry } ,
61
- BunLockfile ,
62
- } ;
61
+ use crate :: bun:: { PackageInfo , RootInfo , WorkspaceEntry } ;
63
62
64
63
macro_rules! fixture {
65
64
( $name: ident, $kind: ty, $cons: expr) => {
@@ -147,7 +146,7 @@ mod test {
147
146
#[ test_case( json!( [ "[email protected] " , "" , { "dependencies" : { "is-number" : "^6.0.0" } } , "sha" ] ) , registry_pkg( ) ; "registry package" ) ]
148
147
#[ test_case( json!( [ "docs" , { "dependencies" : { "is-odd" : "3.0.1" } } ] ) , workspace_pkg( ) ; "workspace package" ) ]
149
148
#[ test_case( json!( [ "some-package@root:" , { "bin" : "bin" , "binDir" : "binDir" } ] ) , root_pkg( ) ; "root package" ) ]
150
- fn test_serialization < T : for < ' a > Serialize + PartialEq + std:: fmt:: Debug > (
149
+ fn test_serialization < T : Serialize + PartialEq + std:: fmt:: Debug > (
151
150
expected : serde_json:: Value ,
152
151
input : & T ,
153
152
) {
0 commit comments