Home / File/ validate-options.js — svelte Source File

validate-options.js — svelte Source File

Architecture documentation for validate-options.js, a javascript file in the svelte codebase. 4 imports, 2 dependents.

File javascript Compiler Transformer 4 imports 2 dependents 11 functions

Entity Profile

Dependency Diagram

graph LR
  1c00ccb7_a603_4a1b_e865_0343036fc5ca["validate-options.js"]
  495501a4_a342_6a4d_ac11_e3e2fee8b218["errors.js"]
  1c00ccb7_a603_4a1b_e865_0343036fc5ca --> 495501a4_a342_6a4d_ac11_e3e2fee8b218
  a146f6ac_0088_8736_b6ce_318f9f115170["e"]
  1c00ccb7_a603_4a1b_e865_0343036fc5ca --> a146f6ac_0088_8736_b6ce_318f9f115170
  56a689f9_11c0_cc76_bd60_41bb6dc96475["warnings.js"]
  1c00ccb7_a603_4a1b_e865_0343036fc5ca --> 56a689f9_11c0_cc76_bd60_41bb6dc96475
  3246e0bc_b9fc_f638_5e35_41e8c39a2408["w"]
  1c00ccb7_a603_4a1b_e865_0343036fc5ca --> 3246e0bc_b9fc_f638_5e35_41e8c39a2408
  cc8de3ad_4bae_f883_44db_d90442053943["index.js"]
  cc8de3ad_4bae_f883_44db_d90442053943 --> 1c00ccb7_a603_4a1b_e865_0343036fc5ca
  cab41022_1b55_3b7a_06c6_b90763bbea47["index.js"]
  cab41022_1b55_3b7a_06c6_b90763bbea47 --> 1c00ccb7_a603_4a1b_e865_0343036fc5ca
  style 1c00ccb7_a603_4a1b_e865_0343036fc5ca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { ModuleCompileOptions, ValidatedModuleCompileOptions, CompileOptions, ValidatedCompileOptions } from '#compiler' */
import * as e from './errors.js';
import * as w from './warnings.js';

/**
 * @template [Input=any]
 * @template [Output=Input]
 * @typedef {(input: Input, keypath: string) => Required<Output>} Validator
 */

const common_options = {
	filename: string('(unknown)'),

	// default to process.cwd() where it exists to replicate svelte4 behavior (and make Deno work with this as well)
	// see https://github.com/sveltejs/svelte/blob/b62fc8c8fd2640c9b99168f01b9d958cb2f7574f/packages/svelte/src/compiler/compile/Component.js#L211
	/* eslint-disable */
	rootDir: string(
		typeof process !== 'undefined'
			? process.cwd?.()
			: // @ts-expect-error
				typeof Deno !== 'undefined'
				? // @ts-expect-error
					Deno.cwd()
				: undefined
	),
	/* eslint-enable */

	dev: boolean(false),

	generate: validator('client', (input, keypath) => {
		if (input === 'dom' || input === 'ssr') {
			warn_once(w.options_renamed_ssr_dom);
			return input === 'dom' ? 'client' : 'server';
		}

		// TODO deprecate `false` in favour of `analyze`/`analyzeModule` https://github.com/sveltejs/svelte-octane/issues/655
		if (input !== 'client' && input !== 'server' && input !== false) {
			throw_error(`${keypath} must be "client", "server" or false`);
		}

		return input;
	}),

	warningFilter: fun(() => true),

	experimental: object({
		async: boolean(false)
	})
};

const component_options = {
	accessors: deprecate(w.options_deprecated_accessors, boolean(false)),

	css: validator('external', (input) => {
		if (input === true || input === false) {
			throw_error(
				'The boolean options have been removed from the css option. Use "external" instead of false and "injected" instead of true'
			);
		}
		if (input === 'none') {
// ... (265 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does validate-options.js do?
validate-options.js is a source file in the svelte codebase, written in javascript. It belongs to the Compiler domain, Transformer subdomain.
What functions are defined in validate-options.js?
validate-options.js defines 11 function(s): boolean, deprecate, fun, list, object, removed, string, throw_error, validator, warn_once, and 1 more.
What does validate-options.js depend on?
validate-options.js imports 4 module(s): e, errors.js, w, warnings.js.
What files import validate-options.js?
validate-options.js is imported by 2 file(s): index.js, index.js.
Where is validate-options.js in the architecture?
validate-options.js is located at packages/svelte/src/compiler/validate-options.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free