@@ -51,7 +51,7 @@ use turbopack_core::{
5151 error:: PrettyPrintError ,
5252 issue:: PlainIssue ,
5353 output:: { OutputAsset , OutputAssets } ,
54- source_map:: { OptionStringifiedSourceMap , SourceMap , Token } ,
54+ source_map:: { SourceMap , Token } ,
5555 version:: { PartialUpdate , TotalUpdate , Update , VersionState } ,
5656} ;
5757use turbopack_ecmascript_hmr_protocol:: { ClientUpdateInstruction , Issue , ResourceIdentifier } ;
@@ -1550,7 +1550,7 @@ pub struct OptionStackFrame(Option<StackFrame>);
15501550pub async fn get_source_map_rope (
15511551 container : Vc < ProjectContainer > ,
15521552 source_url : RcStr ,
1553- ) -> Result < Vc < OptionStringifiedSourceMap > > {
1553+ ) -> Result < Vc < FileContent > > {
15541554 let ( file_path_sys, module) = match Url :: parse ( & source_url) {
15551555 Ok ( url) => match url. scheme ( ) {
15561556 "file" => {
@@ -1579,7 +1579,7 @@ pub async fn get_source_map_rope(
15791579 Some ( relative_path) => sys_to_unix ( relative_path) ,
15801580 None => {
15811581 // File doesn't exist within the dist dir
1582- return Ok ( OptionStringifiedSourceMap :: none ( ) ) ;
1582+ return Ok ( FileContent :: NotFound . cell ( ) ) ;
15831583 }
15841584 } ;
15851585
@@ -1597,13 +1597,13 @@ pub async fn get_source_map_rope(
15971597
15981598 let mut map = container. get_source_map ( server_path, module. clone ( ) ) ;
15991599
1600- if map. await ?. is_none ( ) {
1600+ if ! map. await ?. is_content ( ) {
16011601 // If the chunk doesn't exist as a server chunk, try a client chunk.
16021602 // TODO: Properly tag all server chunks and use the `isServer` query param.
16031603 // Currently, this is inaccurate as it does not cover RSC server
16041604 // chunks.
16051605 map = container. get_source_map ( client_path, module) ;
1606- if map. await ?. is_none ( ) {
1606+ if ! map. await ?. is_content ( ) {
16071607 bail ! ( "chunk/module '{}' is missing a sourcemap" , source_url) ;
16081608 }
16091609 }
@@ -1615,7 +1615,7 @@ pub async fn get_source_map_rope(
16151615pub fn get_source_map_rope_operation (
16161616 container : ResolvedVc < ProjectContainer > ,
16171617 file_path : RcStr ,
1618- ) -> Vc < OptionStringifiedSourceMap > {
1618+ ) -> Vc < FileContent > {
16191619 get_source_map_rope ( * container, file_path)
16201620}
16211621
@@ -1782,13 +1782,13 @@ pub async fn project_get_source_map(
17821782 let ctx = & project. turbopack_ctx ;
17831783 ctx. turbo_tasks ( )
17841784 . run ( async move {
1785- let Some ( map ) = & * get_source_map_rope_operation ( container, file_path)
1785+ let source_map = get_source_map_rope_operation ( container, file_path)
17861786 . read_strongly_consistent ( )
1787- . await ?
1788- else {
1787+ . await ?;
1788+ let Some ( map ) = source_map . as_content ( ) else {
17891789 return Ok ( None ) ;
17901790 } ;
1791- Ok ( Some ( map. to_str ( ) ?. to_string ( ) ) )
1791+ Ok ( Some ( map. content ( ) . to_str ( ) ?. to_string ( ) ) )
17921792 } )
17931793 // HACK: Don't use `TurbopackInternalError`, this function is race-condition prone (the
17941794 // source files may have changed or been deleted), so these probably aren't internal errors?
0 commit comments