use crate::stage::Stage;
mod fold;
pub use fold::{InputSet, KeyManifest, ManifestError};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum AmbientInput {
ProjectIdentity,
TsconfigContent,
ProjectConfig,
ToolchainVersion,
CorsaVersion,
FeatureFlags,
Platform,
PluginIdentity,
PluginVersion,
PluginCode,
PluginVisits,
PluginDemands,
PluginInputs,
}
impl AmbientInput {
pub const ALL: [Self; 13] = [
Self::ProjectIdentity,
Self::TsconfigContent,
Self::ProjectConfig,
Self::ToolchainVersion,
Self::CorsaVersion,
Self::FeatureFlags,
Self::Platform,
Self::PluginIdentity,
Self::PluginVersion,
Self::PluginCode,
Self::PluginVisits,
Self::PluginDemands,
Self::PluginInputs,
];
#[must_use]
pub const fn name(self) -> &'static str {
match self {
Self::ProjectIdentity => "project-identity",
Self::TsconfigContent => "tsconfig-content",
Self::ProjectConfig => "project-config",
Self::ToolchainVersion => "toolchain-version",
Self::CorsaVersion => "corsa-version",
Self::FeatureFlags => "feature-flags",
Self::Platform => "platform",
Self::PluginIdentity => "plugin-identity",
Self::PluginVersion => "plugin-version",
Self::PluginCode => "plugin-code",
Self::PluginVisits => "plugin-visits",
Self::PluginDemands => "plugin-demands",
Self::PluginInputs => "plugin-inputs",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum CachedArtifact {
SourceBlock,
SurfacePage,
SemanticPage,
VirtualTsProjection,
CorsaSession,
PluginResult,
}
impl CachedArtifact {
pub const ALL: [Self; 6] = [
Self::SourceBlock,
Self::SurfacePage,
Self::SemanticPage,
Self::VirtualTsProjection,
Self::CorsaSession,
Self::PluginResult,
];
#[must_use]
pub const fn name(self) -> &'static str {
match self {
Self::SourceBlock => "l0.source-block",
Self::SurfacePage => "l1.surface-page",
Self::SemanticPage => "l2.page",
Self::VirtualTsProjection => "projection.virtual-ts",
Self::CorsaSession => "corsa.session",
Self::PluginResult => "plugin.result",
}
}
#[must_use]
pub const fn content_stages(self) -> &'static [Stage] {
match self {
Self::SourceBlock => &[Stage::Source],
Self::SurfacePage => &[Stage::Surface],
Self::SemanticPage => &[Stage::Semantic],
Self::VirtualTsProjection => &[Stage::Source, Stage::Semantic],
Self::CorsaSession => &[],
Self::PluginResult => &[Stage::Source],
}
}
#[must_use]
pub const fn inputs(self) -> &'static [AmbientInput] {
use AmbientInput::{
CorsaVersion, FeatureFlags, Platform, PluginCode, PluginDemands, PluginIdentity,
PluginInputs, PluginVersion, PluginVisits, ProjectConfig, ProjectIdentity,
ToolchainVersion, TsconfigContent,
};
match self {
Self::SourceBlock => &[ToolchainVersion],
Self::SurfacePage => &[ToolchainVersion, FeatureFlags],
Self::SemanticPage => &[ProjectConfig, ToolchainVersion, FeatureFlags],
Self::VirtualTsProjection => &[
TsconfigContent,
ProjectConfig,
ToolchainVersion,
FeatureFlags,
],
Self::CorsaSession => &[
ProjectIdentity,
TsconfigContent,
ToolchainVersion,
CorsaVersion,
FeatureFlags,
Platform,
],
Self::PluginResult => &[
ToolchainVersion,
FeatureFlags,
PluginIdentity,
PluginVersion,
PluginCode,
PluginVisits,
PluginDemands,
PluginInputs,
],
}
}
}