@@ -48,8 +48,8 @@ export class WebAssemblyResourceLoader {
48
48
// Try to load from cache
49
49
const cachedResponse = await this . cache . match ( cacheKey ) ;
50
50
if ( cachedResponse ) {
51
- const transferredBytes = parseInt ( cachedResponse . headers . get ( 'content-length' ) || '0' ) ;
52
- this . cacheLoads [ name ] = { transferredBytes } ;
51
+ const responseBytes = parseInt ( cachedResponse . headers . get ( 'content-length' ) || '0' ) ;
52
+ this . cacheLoads [ name ] = { responseBytes } ;
53
53
return { response : cachedResponse , isNetworkResponse : false } ;
54
54
}
55
55
@@ -74,21 +74,21 @@ export class WebAssemblyResourceLoader {
74
74
logToConsole ( ) {
75
75
const cacheLoadsEntries = Object . values ( this . cacheLoads ) ;
76
76
const networkLoadsEntries = Object . values ( this . networkLoads ) ;
77
- const cacheTransferredBytes = countTotalBytes ( cacheLoadsEntries ) ;
78
- const networkTransferredBytes = countTotalBytes ( networkLoadsEntries ) ;
79
- const totalTransferredBytes = cacheTransferredBytes + networkTransferredBytes ;
77
+ const cacheResponseBytes = countTotalBytes ( cacheLoadsEntries ) ;
78
+ const networkResponseBytes = countTotalBytes ( networkLoadsEntries ) ;
79
+ const totalResponseBytes = cacheResponseBytes + networkResponseBytes ;
80
80
const linkerDisabledWarning = this . bootConfig . linkerEnabled ? '%c' : '\n%cThis application was built with linking (tree shaking) disabled. Published applications will be significantly smaller.' ;
81
81
82
- console . groupCollapsed ( `%cblazor%c Loaded ${ toDataSizeString ( totalTransferredBytes ) } resources${ linkerDisabledWarning } ` , 'background: purple; color: white; padding: 1px 3px; border-radius: 3px;' , 'font-weight: bold;' , 'font-weight: normal;' ) ;
82
+ console . groupCollapsed ( `%cblazor%c Loaded ${ toDataSizeString ( totalResponseBytes ) } resources${ linkerDisabledWarning } ` , 'background: purple; color: white; padding: 1px 3px; border-radius: 3px;' , 'font-weight: bold;' , 'font-weight: normal;' ) ;
83
83
84
84
if ( cacheLoadsEntries . length ) {
85
- console . groupCollapsed ( `Loaded ${ toDataSizeString ( cacheTransferredBytes ) } resources from cache` ) ;
85
+ console . groupCollapsed ( `Loaded ${ toDataSizeString ( cacheResponseBytes ) } resources from cache` ) ;
86
86
console . table ( this . cacheLoads ) ;
87
87
console . groupEnd ( ) ;
88
88
}
89
89
90
90
if ( networkLoadsEntries . length ) {
91
- console . groupCollapsed ( `Loaded ${ toDataSizeString ( networkTransferredBytes ) } resources from network` ) ;
91
+ console . groupCollapsed ( `Loaded ${ toDataSizeString ( networkResponseBytes ) } resources from network` ) ;
92
92
console . table ( this . networkLoads ) ;
93
93
console . groupEnd ( ) ;
94
94
}
@@ -117,20 +117,20 @@ export class WebAssemblyResourceLoader {
117
117
// only done on a 'best effort' basis. Even if we do receive an entry, some of its
118
118
// properties may be blanked out if it was a CORS request.
119
119
const performanceEntry = getPerformanceEntry ( networkResponse . url ) ;
120
- const transferredBytes = ( performanceEntry && performanceEntry . encodedBodySize ) || undefined ;
121
- this . networkLoads [ name ] = { transferredBytes } ;
120
+ const responseBytes = ( performanceEntry && performanceEntry . encodedBodySize ) || undefined ;
121
+ this . networkLoads [ name ] = { responseBytes } ;
122
122
123
123
// crypto.subtle is only enabled on localhost and HTTPS origins
124
124
// We only write to the cache if we can validate the content hashes
125
125
if ( typeof crypto !== 'undefined' && ! ! crypto . subtle ) {
126
126
await assertContentHashMatchesAsync ( name , responseBuffer , expectedContentHash ) ;
127
127
128
- // Build a custom response object so we can track extra data such as transferredBytes
128
+ // Build a custom response object so we can track extra data such as responseBytes
129
129
// We can't rely on the server sending content-length (ASP.NET Core doesn't by default)
130
130
await this . cache . put ( cacheKey , new Response ( responseBuffer , {
131
131
headers : {
132
132
'content-type' : networkResponse . headers . get ( 'content-type' ) || '' ,
133
- 'content-length' : ( transferredBytes || networkResponse . headers . get ( 'content-length' ) || '' ) . toString ( )
133
+ 'content-length' : ( responseBytes || networkResponse . headers . get ( 'content-length' ) || '' ) . toString ( )
134
134
}
135
135
} ) ) ;
136
136
}
@@ -140,7 +140,7 @@ export class WebAssemblyResourceLoader {
140
140
}
141
141
142
142
function countTotalBytes ( loads : LoadLogEntry [ ] ) {
143
- return loads . reduce ( ( prev , item ) => prev + ( item . transferredBytes || 0 ) , 0 ) ;
143
+ return loads . reduce ( ( prev , item ) => prev + ( item . responseBytes || 0 ) , 0 ) ;
144
144
}
145
145
146
146
function toDataSizeString ( byteCount : number ) {
@@ -182,7 +182,7 @@ interface ResourceGroups {
182
182
}
183
183
184
184
interface LoadLogEntry {
185
- transferredBytes : number | undefined ;
185
+ responseBytes : number | undefined ;
186
186
}
187
187
188
188
export interface LoadingResource {
0 commit comments