features-validation.ts — astro Source File
Architecture documentation for features-validation.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 66c4596f_b3a5_daf2_22c7_dc5b1ad0471c["features-validation.ts"] d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"] 66c4596f_b3a5_daf2_22c7_dc5b1ad0471c --> d3861967_b647_84d2_ff48_15013353bd56 e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"] 66c4596f_b3a5_daf2_22c7_dc5b1ad0471c --> e9b74c5a_8d34_34a7_e196_5e41b87214aa 4c453c0b_17bb_ebc3_f7de_e2a632e42c1e["../types/public/integrations.js"] 66c4596f_b3a5_daf2_22c7_dc5b1ad0471c --> 4c453c0b_17bb_ebc3_f7de_e2a632e42c1e style 66c4596f_b3a5_daf2_22c7_dc5b1ad0471c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { Logger } from '../core/logger/core.js';
import type { AstroSettings } from '../types/astro.js';
import type {
AdapterSupport,
AdapterSupportsKind,
AstroAdapterFeatureMap,
} from '../types/public/integrations.js';
export const AdapterFeatureStability = {
STABLE: 'stable',
DEPRECATED: 'deprecated',
UNSUPPORTED: 'unsupported',
EXPERIMENTAL: 'experimental',
LIMITED: 'limited',
} as const;
type ValidationResult = {
[Property in keyof AstroAdapterFeatureMap]: boolean;
};
/**
* Checks whether an adapter supports certain features that are enabled via Astro configuration.
*
* If a configuration is enabled and "unlocks" a feature, but the adapter doesn't support, the function
* will throw a runtime error.
*
*/
export function validateSupportedFeatures(
adapterName: string,
featureMap: AstroAdapterFeatureMap,
settings: AstroSettings,
logger: Logger,
): ValidationResult {
const {
serverOutput = AdapterFeatureStability.UNSUPPORTED,
staticOutput = AdapterFeatureStability.UNSUPPORTED,
hybridOutput = AdapterFeatureStability.UNSUPPORTED,
i18nDomains = AdapterFeatureStability.UNSUPPORTED,
envGetSecret = AdapterFeatureStability.UNSUPPORTED,
sharpImageService = AdapterFeatureStability.UNSUPPORTED,
} = featureMap;
const validationResult: ValidationResult = {};
validationResult.staticOutput = validateSupportKind(
staticOutput,
adapterName,
logger,
'staticOutput',
() => settings.buildOutput === 'static',
);
validationResult.hybridOutput = validateSupportKind(
hybridOutput,
adapterName,
logger,
'hybridOutput',
() => settings.config.output == 'static' && settings.buildOutput === 'server',
);
validationResult.serverOutput = validateSupportKind(
// ... (131 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- ../core/logger/core.js
- ../types/astro.js
- ../types/public/integrations.js
Source
Frequently Asked Questions
What does features-validation.ts do?
features-validation.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in features-validation.ts?
features-validation.ts defines 7 function(s): getAdapterStaticRecommendation, getSupportMessage, getSupportMessageSuppression, logFeatureSupport, unwrapSupportKind, validateSupportKind, validateSupportedFeatures.
What does features-validation.ts depend on?
features-validation.ts imports 3 module(s): ../core/logger/core.js, ../types/astro.js, ../types/public/integrations.js.
Where is features-validation.ts in the architecture?
features-validation.ts is located at packages/astro/src/integrations/features-validation.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/integrations).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free