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

Rename analysis-only source map mode

Co-authored-by: 's avatarWill Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
parent 753a7554
...@@ -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::Internal, (false, _) if self.build_analyze => SourceMapsType::AnalyzeOnly,
(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::Internal, (false, _) if self.build_analyze => SourceMapsType::AnalyzeOnly,
(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::Internal => true, SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => true,
SourceMapsType::None => false, SourceMapsType::None => false,
}) })
} }
...@@ -791,14 +791,17 @@ impl ChunkingContext for BrowserChunkingContext { ...@@ -791,14 +791,17 @@ impl ChunkingContext for BrowserChunkingContext {
#[turbo_tasks::function] #[turbo_tasks::function]
fn emit_pure_import_annotations(&self) -> Vc<bool> { fn emit_pure_import_annotations(&self) -> Vc<bool> {
Vc::cell(!matches!(self.source_maps_type, SourceMapsType::Internal)) Vc::cell(!matches!(
self.source_maps_type,
SourceMapsType::AnalyzeOnly
))
} }
#[turbo_tasks::function] #[turbo_tasks::function]
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::Internal => true, SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => true,
SourceMapsType::None => false, SourceMapsType::None => false,
}) })
} }
......
...@@ -63,7 +63,7 @@ pub enum SourceMapsType { ...@@ -63,7 +63,7 @@ pub enum SourceMapsType {
/// 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 for analysis without writing source maps for output files.
Internal, AnalyzeOnly,
/// 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.
/// Internal mappings may still be computed for analysis when this is false. /// Analyze-only mappings may still be computed 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; internal mappings must /// the SWC printer drops synthesized PURE spans; analyze-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.
// Internal mappings must not change emitted build bytes. // Analyze-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::Internal => true, SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => true,
SourceMapsType::None => false, SourceMapsType::None => false,
}) })
} }
...@@ -505,14 +505,17 @@ impl ChunkingContext for NodeJsChunkingContext { ...@@ -505,14 +505,17 @@ impl ChunkingContext for NodeJsChunkingContext {
#[turbo_tasks::function] #[turbo_tasks::function]
fn emit_pure_import_annotations(&self) -> Vc<bool> { fn emit_pure_import_annotations(&self) -> Vc<bool> {
Vc::cell(!matches!(self.source_maps_type, SourceMapsType::Internal)) Vc::cell(!matches!(
self.source_maps_type,
SourceMapsType::AnalyzeOnly
))
} }
#[turbo_tasks::function] #[turbo_tasks::function]
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::Internal => true, SourceMapsType::Partial | SourceMapsType::AnalyzeOnly => 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