File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ impl ParsedSourceCacheModuleAnalyzer {
191191 let mut stmt = self . conn . prepare_cached ( query) ?;
192192 let mut rows = stmt. query ( params ! [
193193 & specifier. as_str( ) ,
194- & media_type . to_string ( ) ,
194+ serialize_media_type ( media_type ) ,
195195 & expected_source_hash,
196196 ] ) ?;
197197 if let Some ( row) = rows. next ( ) ? {
@@ -218,14 +218,38 @@ impl ParsedSourceCacheModuleAnalyzer {
218218 let mut stmt = self . conn . prepare_cached ( sql) ?;
219219 stmt. execute ( params ! [
220220 specifier. as_str( ) ,
221- & media_type . to_string ( ) ,
221+ serialize_media_type ( media_type ) ,
222222 & source_hash,
223223 & serde_json:: to_string( & module_info) ?,
224224 ] ) ?;
225225 Ok ( ( ) )
226226 }
227227}
228228
229+ // todo(dsherret): change this to be stored as an integer next time
230+ // the cache version is bumped
231+ fn serialize_media_type ( media_type : MediaType ) -> & ' static str {
232+ use MediaType :: * ;
233+ match media_type {
234+ JavaScript => "1" ,
235+ Jsx => "2" ,
236+ Mjs => "3" ,
237+ Cjs => "4" ,
238+ TypeScript => "5" ,
239+ Mts => "6" ,
240+ Cts => "7" ,
241+ Dts => "8" ,
242+ Dmts => "9" ,
243+ Dcts => "10" ,
244+ Tsx => "11" ,
245+ Json => "12" ,
246+ Wasm => "13" ,
247+ TsBuildInfo => "14" ,
248+ SourceMap => "15" ,
249+ Unknown => "16" ,
250+ }
251+ }
252+
229253impl deno_graph:: ModuleAnalyzer for ParsedSourceCacheModuleAnalyzer {
230254 fn analyze (
231255 & self ,
You can’t perform that action at this time.
0 commit comments