Home / File/ settings.ts — astro Source File

settings.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 15 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f["settings.ts"]
  ca498ea5_adca_33b2_ab82_832064ec49f1["../../content/index.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> ca498ea5_adca_33b2_ab82_832064ec49f1
  a170ca6a_e9d2_0356_ff6d_60b52ee58679["../preferences/index.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> a170ca6a_e9d2_0356_ff6d_60b52ee58679
  e9b74c5a_8d34_34a7_e196_5e41b87214aa["../types/astro.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> e9b74c5a_8d34_34a7_e196_5e41b87214aa
  c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> c32d12e2_d85e_28c0_eea7_9b29629857e0
  792d9be4_c5cc_1d9c_1275_8fb0a2cd15ec["../../vite-plugin-markdown/content-entry-type.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> 792d9be4_c5cc_1d9c_1275_8fb0a2cd15ec
  fb66cdc7_16ad_43ba_51ae_37a26501b497["../core/client-directive/index.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> fb66cdc7_16ad_43ba_51ae_37a26501b497
  7216d952_4e4a_2d18_a85b_74b4ace79e2b["../core/constants.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> 7216d952_4e4a_2d18_a85b_74b4ace79e2b
  ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9
  91e2aae7_9271_3bbb_4d0e_63fd50e547d0["./utils.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> 91e2aae7_9271_3bbb_4d0e_63fd50e547d0
  e2c4dc3c_f14d_92d4_6dd6_1f5b627d5893["../core/config/timer.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> e2c4dc3c_f14d_92d4_6dd6_1f5b627d5893
  8553f8df_4d06_7e90_1fbb_4d832af79e06["../core/config/tsconfig.js"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> 8553f8df_4d06_7e90_1fbb_4d832af79e06
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> d9a92db9_c95e_9165_13ac_24b3d859d946
  38ee36f6_1b8f_5a62_1295_989b44329ca0["js-yaml"]
  b5841de7_4ddd_6101_37ae_9e92ac43fb0f --> 38ee36f6_1b8f_5a62_1295_989b44329ca0
  style b5841de7_4ddd_6101_37ae_9e92ac43fb0f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import yaml from 'js-yaml';
import toml from 'smol-toml';
import { getContentPaths } from '../../content/index.js';
import createPreferences from '../../preferences/index.js';
import type { AstroSettings } from '../../types/astro.js';
import type { AstroConfig, AstroInlineConfig } from '../../types/public/config.js';
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
import { getDefaultClientDirectives } from '../client-directive/index.js';
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import {
	formatTOMLError,
	formatYAMLException,
	isTOMLError,
	isYAMLException,
} from '../errors/utils.js';
import { AstroTimer } from './timer.js';
import { loadTSConfig } from './tsconfig.js';

export function createBaseSettings(
	config: AstroConfig,
	logLevel: AstroInlineConfig['logLevel'],
): AstroSettings {
	const { contentDir } = getContentPaths(
		config,
		undefined,
		config.legacy?.collectionsBackwardsCompat,
	);
	const dotAstroDir = new URL('.astro/', config.root);
	const preferences = createPreferences(config, dotAstroDir);
	return {
		config,
		preferences,
		tsConfig: undefined,
		tsConfigPath: undefined,
		adapter: undefined,
		prerenderer: undefined,
		injectedRoutes: [],
		resolvedInjectedRoutes: [],
		pageExtensions: ['.astro', '.html', ...SUPPORTED_MARKDOWN_FILE_EXTENSIONS],
		contentEntryTypes: [markdownContentEntryType],
		dataEntryTypes: [
			{
				extensions: ['.json'],
				getEntryInfo({ contents, fileUrl }) {
					if (contents === undefined || contents === '') return { data: {} };

					const pathRelToContentDir = path.relative(
						fileURLToPath(contentDir),
						fileURLToPath(fileUrl),
					);
					let data;
					try {
						data = JSON.parse(contents);
					} catch (e) {
						throw new AstroError({
							...AstroErrorData.DataCollectionEntryParseError,
							message: AstroErrorData.DataCollectionEntryParseError.message(
// ... (132 more lines)

Domain

Subdomains

Dependencies

  • ../../content/index.js
  • ../../vite-plugin-markdown/content-entry-type.js
  • ../core/client-directive/index.js
  • ../core/config/timer.js
  • ../core/config/tsconfig.js
  • ../core/constants.js
  • ../core/errors/index.js
  • ../preferences/index.js
  • ../types/astro.js
  • ../types/public/config.js
  • ./utils.js
  • js-yaml
  • node:path
  • node:url
  • smol-toml

Frequently Asked Questions

What does settings.ts do?
settings.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 settings.ts?
settings.ts defines 2 function(s): createBaseSettings, createSettings.
What does settings.ts depend on?
settings.ts imports 15 module(s): ../../content/index.js, ../../vite-plugin-markdown/content-entry-type.js, ../core/client-directive/index.js, ../core/config/timer.js, ../core/config/tsconfig.js, ../core/constants.js, ../core/errors/index.js, ../preferences/index.js, and 7 more.
Where is settings.ts in the architecture?
settings.ts is located at packages/astro/src/core/config/settings.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/config).

Analyze Your Own Codebase

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

Try Supermodel Free