Home / File/ state.js — svelte Source File

state.js — svelte Source File

Architecture documentation for state.js, a javascript file in the svelte codebase. 3 imports, 42 dependents.

File javascript Compiler Transformer 3 imports 42 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  62f818c8_e890_17ed_5ec1_92f953d4a7a6["state.js"]
  2aa63f4e_82c9_33e3_ac6c_5f3d46250522["utils.js"]
  62f818c8_e890_17ed_5ec1_92f953d4a7a6 --> 2aa63f4e_82c9_33e3_ac6c_5f3d46250522
  28c6afed_f4f8_7245_50fe_f12a7fd10cba["sanitize_location"]
  62f818c8_e890_17ed_5ec1_92f953d4a7a6 --> 28c6afed_f4f8_7245_50fe_f12a7fd10cba
  5415ae33_acc7_39bf_2a56_bf3800623713["locate-character"]
  62f818c8_e890_17ed_5ec1_92f953d4a7a6 --> 5415ae33_acc7_39bf_2a56_bf3800623713
  cc8de3ad_4bae_f883_44db_d90442053943["index.js"]
  cc8de3ad_4bae_f883_44db_d90442053943 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  cab41022_1b55_3b7a_06c6_b90763bbea47["index.js"]
  cab41022_1b55_3b7a_06c6_b90763bbea47 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  67d7170b_725b_33cc_868d_fad6ed435252["index.js"]
  67d7170b_725b_33cc_868d_fad6ed435252 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  90aa5201_1990_23b6_f05a_1ff5d9b22b14["script.js"]
  90aa5201_1990_23b6_f05a_1ff5d9b22b14 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  206889ff_1f9f_b6c1_d530_059d001e1cf4["element.js"]
  206889ff_1f9f_b6c1_d530_059d001e1cf4 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  4aa8a188_84d4_0274_ed83_cac0ab1d3572["index.js"]
  4aa8a188_84d4_0274_ed83_cac0ab1d3572 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  3f0209c9_7af2_542f_1c9c_3be0eb046971["CallExpression.js"]
  3f0209c9_7af2_542f_1c9c_3be0eb046971 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  6ee51e41_ae2d_bb6f_2e37_01a904669bc2["SvelteSelf.js"]
  6ee51e41_ae2d_bb6f_2e37_01a904669bc2 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  7665e008_f37d_b860_a594_f2539a66af4e["transform-client.js"]
  7665e008_f37d_b860_a594_f2539a66af4e --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  b14524b3_fb6c_95cc_463c_fff3e50c6bc6["index.js"]
  b14524b3_fb6c_95cc_463c_fff3e50c6bc6 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  96ee438d_6c6f_9aff_59f4_d00e63e9d98c["AssignmentExpression.js"]
  96ee438d_6c6f_9aff_59f4_d00e63e9d98c --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  style 62f818c8_e890_17ed_5ec1_92f953d4a7a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { Location } from 'locate-character' */
/** @import { CompileOptions } from './types' */
/** @import { AST, Warning } from '#compiler' */
import { getLocator } from 'locate-character';
import { sanitize_location } from '../utils.js';

/** @typedef {{ start?: number, end?: number }} NodeLike */

/** @type {Warning[]} */
export let warnings = [];

/**
 * The filename relative to the rootDir (if specified).
 * This should not be used in the compiler output except in dev mode
 * @type {string}
 */
export let filename;

/**
 * This is the fallback used when no filename is specified.
 */
export const UNKNOWN_FILENAME = '(unknown)';

/**
 * The name of the component that is used in the `export default function ...` statement.
 */
export let component_name = '<unknown>';

/**
 * The original source code
 * @type {string}
 */
export let source;

/**
 * True if compiling with `dev: true`
 * @type {boolean}
 */
export let dev;

export let runes = false;

/** @type {(index: number) => Location} */
export let locator;

/** @param {string} value */
export function set_source(value) {
	source = value;

	const l = getLocator(source, { offsetLine: 1 });

	locator = (i) => {
		const loc = l(i);
		if (!loc) throw new Error('An impossible situation occurred');

		return loc;
	};
}

/**
// ... (85 more lines)

Domain

Subdomains

Dependencies

Imported By

Frequently Asked Questions

What does state.js do?
state.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 state.js?
state.js defines 7 function(s): adjust, is_ignored, locate_node, pop_ignore, push_ignore, reset, set_source.
What does state.js depend on?
state.js imports 3 module(s): locate-character, sanitize_location, utils.js.
What files import state.js?
state.js is imported by 42 file(s): AssignmentExpression.js, AwaitExpression.js, BinaryExpression.js, BindDirective.js, CallExpression.js, CallExpression.js, CallExpression.js, ClassBody.js, and 34 more.
Where is state.js in the architecture?
state.js is located at packages/svelte/src/compiler/state.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