@@ -775,13 +775,13 @@ pub async fn version_publish_handler(
775
775
776
776
// If there is a content-length header, check it isn't too big.
777
777
// We don't rely on this, we will also check MAX_PAYLOAD_SIZE later.
778
- if let Some ( size) = req. body ( ) . size_hint ( ) . upper ( ) {
779
- if size > MAX_PUBLISH_TARBALL_SIZE {
780
- return Err ( ApiError :: TarballSizeLimitExceeded {
781
- size ,
782
- max_size : MAX_PUBLISH_TARBALL_SIZE ,
783
- } ) ;
784
- }
778
+ if let Some ( size) = req. body ( ) . size_hint ( ) . upper ( )
779
+ && size > MAX_PUBLISH_TARBALL_SIZE
780
+ {
781
+ return Err ( ApiError :: TarballSizeLimitExceeded {
782
+ size ,
783
+ max_size : MAX_PUBLISH_TARBALL_SIZE ,
784
+ } ) ;
785
785
}
786
786
787
787
// Ensure the upload is gzip encoded.
@@ -869,14 +869,14 @@ pub async fn version_publish_handler(
869
869
870
870
let hash = hash. lock ( ) . unwrap ( ) . take ( ) . unwrap ( ) . finalize ( ) ;
871
871
let hash = format ! ( "sha256-{:02x}" , hash) ;
872
- if let Some ( tarball_hash) = access_restriction. tarball_hash {
873
- if tarball_hash != hash {
874
- error ! (
875
- "Tarball hash mismatch: expected {}, got {}" ,
876
- tarball_hash , hash
877
- ) ;
878
- return Err ( ApiError :: MissingPermission ) ;
879
- }
872
+ if let Some ( tarball_hash) = access_restriction. tarball_hash
873
+ && tarball_hash != hash
874
+ {
875
+ error ! (
876
+ "Tarball hash mismatch: expected {}, got {}" ,
877
+ tarball_hash , hash
878
+ ) ;
879
+ return Err ( ApiError :: MissingPermission ) ;
880
880
}
881
881
882
882
// If the upload failed due to the size limit, we can cancel the task.
@@ -1830,23 +1830,23 @@ impl DepTreeLoader {
1830
1830
return Ok ( None ) ;
1831
1831
} ;
1832
1832
1833
- if version. is_none ( ) {
1834
- if let Some ( captures) = JSR_DEP_META_RE . captures ( path. as_str ( ) ) {
1835
- let version = captures . name ( "version" ) . unwrap ( ) ;
1836
- let meta =
1837
- serde_json :: from_slice :: < VersionMetadata > ( & bytes ) . unwrap ( ) ;
1838
-
1839
- let mut lock = exports . lock ( ) . await ;
1840
- lock. insert (
1841
- format ! (
1842
- "@{}/{}@{}" ,
1843
- scope . as_str ( ) ,
1844
- package . as_str( ) ,
1845
- version . as_str( )
1846
- ) ,
1847
- meta . exports ,
1848
- ) ;
1849
- }
1833
+ if version. is_none ( )
1834
+ && let Some ( captures) = JSR_DEP_META_RE . captures ( path. as_str ( ) )
1835
+ {
1836
+ let version = captures . name ( "version" ) . unwrap ( ) ;
1837
+ let meta =
1838
+ serde_json :: from_slice :: < VersionMetadata > ( & bytes ) . unwrap ( ) ;
1839
+
1840
+ let mut lock = exports . lock ( ) . await ;
1841
+ lock . insert (
1842
+ format ! (
1843
+ "@{}/{}@{}" ,
1844
+ scope . as_str( ) ,
1845
+ package . as_str( ) ,
1846
+ version . as_str ( )
1847
+ ) ,
1848
+ meta . exports ,
1849
+ ) ;
1850
1850
}
1851
1851
1852
1852
Ok ( Some ( deno_graph:: source:: LoadResponse :: Module {
@@ -2005,6 +2005,7 @@ async fn analyze_deps_tree(
2005
2005
module_info_cacher : Default :: default ( ) ,
2006
2006
unstable_bytes_imports : false ,
2007
2007
unstable_text_imports : false ,
2008
+ jsr_metadata_store : None ,
2008
2009
} ,
2009
2010
)
2010
2011
. await ;
@@ -2158,22 +2159,21 @@ impl<'a> GraphDependencyCollector<'a> {
2158
2159
let mut children = IndexSet :: new ( ) ;
2159
2160
match module {
2160
2161
Module :: Js ( module) => {
2161
- if let Some ( types_dep) = & module. maybe_types_dependency {
2162
- if let Some ( child) = self . build_resolved_info ( & types_dep. dependency )
2163
- {
2164
- children. insert ( child) ;
2165
- }
2162
+ if let Some ( types_dep) = & module. maybe_types_dependency
2163
+ && let Some ( child) = self . build_resolved_info ( & types_dep. dependency )
2164
+ {
2165
+ children. insert ( child) ;
2166
2166
}
2167
2167
for dep in module. dependencies . values ( ) {
2168
- if !dep. maybe_code . is_none ( ) {
2169
- if let Some ( child) = self . build_resolved_info ( & dep. maybe_code ) {
2170
- children . insert ( child ) ;
2171
- }
2168
+ if !dep. maybe_code . is_none ( )
2169
+ && let Some ( child) = self . build_resolved_info ( & dep. maybe_code )
2170
+ {
2171
+ children . insert ( child ) ;
2172
2172
}
2173
- if !dep. maybe_type . is_none ( ) {
2174
- if let Some ( child) = self . build_resolved_info ( & dep. maybe_type ) {
2175
- children . insert ( child ) ;
2176
- }
2173
+ if !dep. maybe_type . is_none ( )
2174
+ && let Some ( child) = self . build_resolved_info ( & dep. maybe_type )
2175
+ {
2176
+ children . insert ( child ) ;
2177
2177
}
2178
2178
}
2179
2179
}
0 commit comments