File tree Expand file tree Collapse file tree 1 file changed +19
-19
lines changed Expand file tree Collapse file tree 1 file changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -120,25 +120,25 @@ impl PackageJson {
120120
121121 #[ cfg( feature = "package_json_raw_json_api" ) ]
122122 fn init_serde_json ( & mut self , value : & JSONMap ) {
123- // const KEYS_TO_KEEP: [&str; 9] = [
124- // "name",
125- // "version",
126- // "sideEffects",
127- // "type",
128- // "main",
129- // "module",
130- // "exports",
131- // "imports",
132- // "browser",
133- // ];
134- // let mut json_map = serde_json::value::Map::with_capacity(KEYS_TO_KEEP.len());
135- //
136- // for key in KEYS_TO_KEEP {
137- // if let Some(name) = value.get(key).and_then(|v| from_refborrowed_value(v).ok()) {
138- // json_map.insert(key.to_string(), name);
139- // }
140- // }
141- // self.serde_json = std::sync::Arc::new(serde_json::Value::Object(json_map));
123+ const KEYS_TO_KEEP : [ & str ; 9 ] = [
124+ "name" ,
125+ "version" ,
126+ "sideEffects" ,
127+ "type" ,
128+ "main" ,
129+ "module" ,
130+ "exports" ,
131+ "imports" ,
132+ "browser" ,
133+ ] ;
134+ let mut json_map = serde_json:: value:: Map :: with_capacity ( KEYS_TO_KEEP . len ( ) ) ;
135+
136+ for key in KEYS_TO_KEEP {
137+ if let Some ( name) = value. get ( key) . and_then ( |v| from_refborrowed_value ( v) . ok ( ) ) {
138+ json_map. insert ( key. to_string ( ) , name) ;
139+ }
140+ }
141+ self . serde_json = std:: sync:: Arc :: new ( serde_json:: Value :: Object ( json_map) ) ;
142142 }
143143
144144 fn get_value_by_paths < ' a > ( fields : & ' a JSONMap , paths : & [ String ] ) -> Option < & ' a JSONValue < ' a > > {
You can’t perform that action at this time.
0 commit comments