Home / File/ version.ts — astro Source File

version.ts — astro Source File

Architecture documentation for version.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.

File typescript CoreAstro CoreMiddleware 1 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  f9c1f41e_c529_cd5b_bb23_18e49f7a7055["version.ts"]
  199aee82_1d7c_c9e4_b390_1ce24eedb67e["react-dom"]
  f9c1f41e_c529_cd5b_bb23_18e49f7a7055 --> 199aee82_1d7c_c9e4_b390_1ce24eedb67e
  style f9c1f41e_c529_cd5b_bb23_18e49f7a7055 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { version as ReactVersion } from 'react-dom';

type SupportedReactVersion = keyof typeof versionsConfig;
export type ReactVersionConfig = (typeof versionsConfig)[SupportedReactVersion];

export function getReactMajorVersion(): number {
	const matches = /\d+\./.exec(ReactVersion);
	if (!matches) {
		return NaN;
	}
	return Number(matches[0]);
}

export function isSupportedReactVersion(
	majorVersion: number,
): majorVersion is SupportedReactVersion {
	return majorVersion in versionsConfig;
}

export const versionsConfig = {
	17: {
		server: '@astrojs/react/server-v17.js',
		client: '@astrojs/react/client-v17.js',
	},
	18: {
		server: '@astrojs/react/server.js',
		client: '@astrojs/react/client.js',
	},
	19: {
		server: '@astrojs/react/server.js',
		client: '@astrojs/react/client.js',
	},
};

Domain

Subdomains

Dependencies

  • react-dom

Frequently Asked Questions

What does version.ts do?
version.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in version.ts?
version.ts defines 2 function(s): getReactMajorVersion, isSupportedReactVersion.
What does version.ts depend on?
version.ts imports 1 module(s): react-dom.
Where is version.ts in the architecture?
version.ts is located at packages/integrations/react/src/version.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/integrations/react/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free