Unverified Commit d014bbb9 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

Name computed-only source map mode by behavior

Co-authored-by: 's avatarWill Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
parent 4646978b
...@@ -2606,7 +2606,7 @@ impl NextConfig { ...@@ -2606,7 +2606,7 @@ impl NextConfig {
Ok(match (source_maps, input_source_maps) { Ok(match (source_maps, input_source_maps) {
(true, true) => SourceMapsType::Full, (true, true) => SourceMapsType::Full,
(true, false) => SourceMapsType::Partial, (true, false) => SourceMapsType::Partial,
(false, _) if self.build_analyze => SourceMapsType::AnalyzeOnly, (false, _) if self.build_analyze => SourceMapsType::ComputeOnly,
(false, _) => SourceMapsType::None, (false, _) => SourceMapsType::None,
} }
.cell()) .cell())
...@@ -2626,7 +2626,7 @@ impl NextConfig { ...@@ -2626,7 +2626,7 @@ impl NextConfig {
Ok(match (source_maps, input_source_maps) { Ok(match (source_maps, input_source_maps) {
(true, true) => SourceMapsType::Full, (true, true) => SourceMapsType::Full,
(true, false) => SourceMapsType::Partial, (true, false) => SourceMapsType::Partial,
(false, _) if self.build_analyze => SourceMapsType::AnalyzeOnly, (false, _) if self.build_analyze => SourceMapsType::ComputeOnly,
(false, _) => SourceMapsType::None, (false, _) => SourceMapsType::None,
} }
.cell()) .cell())
......
...@@ -776,7 +776,7 @@ impl ChunkingContext for BrowserChunkingContext { ...@@ -776,7 +776,7 @@ impl ChunkingContext for BrowserChunkingContext {
fn reference_chunk_source_maps(&self, _chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool> { fn reference_chunk_source_maps(&self, _chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool> {
Vc::cell(match self.source_maps_type { Vc::cell(match self.source_maps_type {
SourceMapsType::Full => true, SourceMapsType::Full => true,
SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => true, SourceMapsType::Partial | SourceMapsType::ComputeOnly => true,
SourceMapsType::None => false, SourceMapsType::None => false,
}) })
} }
...@@ -793,7 +793,7 @@ impl ChunkingContext for BrowserChunkingContext { ...@@ -793,7 +793,7 @@ impl ChunkingContext for BrowserChunkingContext {
fn emit_pure_import_annotations(&self) -> Vc<bool> { fn emit_pure_import_annotations(&self) -> Vc<bool> {
Vc::cell(!matches!( Vc::cell(!matches!(
self.source_maps_type, self.source_maps_type,
SourceMapsType::AnalyzeOnly SourceMapsType::ComputeOnly
)) ))
} }
...@@ -801,7 +801,7 @@ impl ChunkingContext for BrowserChunkingContext { ...@@ -801,7 +801,7 @@ impl ChunkingContext for BrowserChunkingContext {
fn reference_module_source_maps(&self, _module: Vc<Box<dyn Module>>) -> Vc<bool> { fn reference_module_source_maps(&self, _module: Vc<Box<dyn Module>>) -> Vc<bool> {
Vc::cell(match self.source_maps_type { Vc::cell(match self.source_maps_type {
SourceMapsType::Full => true, SourceMapsType::Full => true,
SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => true, SourceMapsType::Partial | SourceMapsType::ComputeOnly => true,
SourceMapsType::None => false, SourceMapsType::None => false,
}) })
} }
......
...@@ -62,8 +62,8 @@ pub enum SourceMapsType { ...@@ -62,8 +62,8 @@ pub enum SourceMapsType {
Full, Full,
/// Ignores existing input source maps, but writes source maps for output files. /// Ignores existing input source maps, but writes source maps for output files.
Partial, Partial,
/// Computes mappings for analysis without writing source maps for output files. /// Computes mappings without writing source maps for output files.
AnalyzeOnly, ComputeOnly,
/// Ignores the existence of source maps and does not write source maps for output files. /// Ignores the existence of source maps and does not write source maps for output files.
None, None,
} }
...@@ -378,12 +378,12 @@ pub trait ChunkingContext { ...@@ -378,12 +378,12 @@ pub trait ChunkingContext {
fn reference_chunk_source_maps(self: Vc<Self>, chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool>; fn reference_chunk_source_maps(self: Vc<Self>, chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool>;
/// Whether to publish a chunk's source map and reference it from the output. /// Whether to publish a chunk's source map and reference it from the output.
/// Analyze-only mappings may still be computed when this is false. /// Compute-only mappings may still be available when this is false.
#[turbo_tasks::function] #[turbo_tasks::function]
fn publish_chunk_source_maps(self: Vc<Self>, chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool>; fn publish_chunk_source_maps(self: Vc<Self>, chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool>;
/// Keep generated PURE markers in the emitted code. Without source maps, /// Keep generated PURE markers in the emitted code. Without source maps,
/// the SWC printer drops synthesized PURE spans; analyze-only mappings must /// the SWC printer drops synthesized PURE spans; compute-only mappings must
/// preserve that output behavior even while retaining source attribution. /// preserve that output behavior even while retaining source attribution.
#[turbo_tasks::function] #[turbo_tasks::function]
fn emit_pure_import_annotations(self: Vc<Self>) -> Vc<bool>; fn emit_pure_import_annotations(self: Vc<Self>) -> Vc<bool>;
......
...@@ -1010,7 +1010,7 @@ impl EsmAssetReference { ...@@ -1010,7 +1010,7 @@ impl EsmAssetReference {
} }
}; };
// SWC drops synthesized PURE spans when there are no maps. // SWC drops synthesized PURE spans when there are no maps.
// Analyze-only mappings must not change emitted build bytes. // Compute-only mappings must not change emitted build bytes.
if this.is_pure_import if this.is_pure_import
&& *chunking_context.emit_pure_import_annotations().await? && *chunking_context.emit_pure_import_annotations().await?
{ {
......
...@@ -490,7 +490,7 @@ impl ChunkingContext for NodeJsChunkingContext { ...@@ -490,7 +490,7 @@ impl ChunkingContext for NodeJsChunkingContext {
fn reference_chunk_source_maps(&self, _chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool> { fn reference_chunk_source_maps(&self, _chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool> {
Vc::cell(match self.source_maps_type { Vc::cell(match self.source_maps_type {
SourceMapsType::Full => true, SourceMapsType::Full => true,
SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => true, SourceMapsType::Partial | SourceMapsType::ComputeOnly => true,
SourceMapsType::None => false, SourceMapsType::None => false,
}) })
} }
...@@ -507,7 +507,7 @@ impl ChunkingContext for NodeJsChunkingContext { ...@@ -507,7 +507,7 @@ impl ChunkingContext for NodeJsChunkingContext {
fn emit_pure_import_annotations(&self) -> Vc<bool> { fn emit_pure_import_annotations(&self) -> Vc<bool> {
Vc::cell(!matches!( Vc::cell(!matches!(
self.source_maps_type, self.source_maps_type,
SourceMapsType::AnalyzeOnly SourceMapsType::ComputeOnly
)) ))
} }
...@@ -515,7 +515,7 @@ impl ChunkingContext for NodeJsChunkingContext { ...@@ -515,7 +515,7 @@ impl ChunkingContext for NodeJsChunkingContext {
fn reference_module_source_maps(&self, _module: Vc<Box<dyn Module>>) -> Vc<bool> { fn reference_module_source_maps(&self, _module: Vc<Box<dyn Module>>) -> Vc<bool> {
Vc::cell(match self.source_maps_type { Vc::cell(match self.source_maps_type {
SourceMapsType::Full => true, SourceMapsType::Full => true,
SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => true, SourceMapsType::Partial | SourceMapsType::ComputeOnly => true,
SourceMapsType::None => false, SourceMapsType::None => false,
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment