Home / File/ types.d.ts — svelte Source File

types.d.ts — svelte Source File

Architecture documentation for types.d.ts, a typescript file in the svelte codebase. 6 imports, 0 dependents.

File typescript Compiler Transformer 6 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  e958f40a_bb26_89ce_018e_c2acc509a051["types.d.ts"]
  019586ac_15d9_0ba3_9c1a_d93ec6d59612["../types.js"]
  e958f40a_bb26_89ce_018e_c2acc509a051 --> 019586ac_15d9_0ba3_9c1a_d93ec6d59612
  bc60b394_bb59_4918_bced_e2346543a798["../types.js"]
  e958f40a_bb26_89ce_018e_c2acc509a051 --> bc60b394_bb59_4918_bced_e2346543a798
  c3ec4c82_ce35_6219_c232_12ebeea91443["template.js"]
  e958f40a_bb26_89ce_018e_c2acc509a051 --> c3ec4c82_ce35_6219_c232_12ebeea91443
  d04d7971_88df_542d_dd4f_26170ce6f581["utils.js"]
  e958f40a_bb26_89ce_018e_c2acc509a051 --> d04d7971_88df_542d_dd4f_26170ce6f581
  4291260f_9c68_db0f_e313_37187427eeb3["estree"]
  e958f40a_bb26_89ce_018e_c2acc509a051 --> 4291260f_9c68_db0f_e313_37187427eeb3
  c696582a_9f3f_d301_2824_cb3de66aa770["#compiler"]
  e958f40a_bb26_89ce_018e_c2acc509a051 --> c696582a_9f3f_d301_2824_cb3de66aa770
  style e958f40a_bb26_89ce_018e_c2acc509a051 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type {
	ModuleDeclaration,
	Statement,
	LabeledStatement,
	Identifier,
	Expression,
	AssignmentExpression,
	UpdateExpression,
	VariableDeclaration
} from 'estree';
import type { AST, Namespace, ValidatedCompileOptions } from '#compiler';
import type { TransformState } from '../types.js';
import type { ComponentAnalysis } from '../../types.js';
import type { Template } from './transform-template/template.js';
import type { Memoizer } from './visitors/shared/utils.js';

export interface ClientTransformState extends TransformState {
	/**
	 * `true` if the current lexical scope belongs to a class constructor. this allows
	 * us to rewrite `this.foo` as `this.#foo.value`
	 */
	readonly in_constructor: boolean;

	readonly transform: Record<
		string,
		{
			/** turn `foo` into e.g. `$.get(foo)` */
			read: (id: Identifier) => Expression;
			/** turn `foo = bar` into e.g. `$.set(foo, bar)` */
			assign?: (node: Identifier, value: Expression, proxy?: boolean) => Expression;
			/** turn `foo.bar = baz` into e.g. `$.mutate(foo, $.get(foo).bar = baz);` */
			mutate?: (node: Identifier, mutation: AssignmentExpression | UpdateExpression) => Expression;
			/** turn `foo++` into e.g. `$.update(foo)` */
			update?: (node: UpdateExpression) => Expression;
		}
	>;
}

export interface ComponentClientTransformState extends ClientTransformState {
	readonly analysis: ComponentAnalysis;
	readonly options: ValidatedCompileOptions;
	readonly hoisted: Array<Statement | ModuleDeclaration>;
	readonly events: Set<string>;
	readonly store_to_invalidate?: string;

	/** Stuff that happens before the render effect(s) */
	readonly init: Statement[];
	/** Stuff that happens inside the render effect */
	readonly update: Statement[];
	/** Stuff that happens after the render effect (control blocks, dynamic elements, bindings, actions, etc) */
	readonly after_update: Statement[];
	/** Transformed `{#snippets }` declarations */
	readonly snippets: Statement[];
	/** Transformed `{@const }` declarations */
	readonly consts: Statement[];
	/** Transformed async `{@const }` declarations (if any) and those coming after them */
	async_consts?: {
		id: Identifier;
		thunks: Expression[];
	};
	/** Transformed `let:` directives */
	readonly let_directives: Statement[];
	/** Memoized expressions */
	readonly memoizer: Memoizer;
	/** The HTML template string */
	readonly template: Template;
	readonly metadata: {
		namespace: Namespace;
		bound_contenteditable: boolean;
	};
	readonly preserve_whitespace: boolean;

	/** The anchor node for the current context */
	readonly node: Identifier;

	/** Imports that should be re-evaluated in legacy mode following a mutation */
	readonly legacy_reactive_imports: Statement[];

	/** The $: calls, which will be ordered in the end */
	readonly legacy_reactive_statements: Map<LabeledStatement, Statement>;

	/** Snippets hoisted to the instance */
	readonly instance_level_snippets: VariableDeclaration[];
	/** Snippets hoisted to the module */
	readonly module_level_snippets: VariableDeclaration[];

	/** True if the current node is a) a component or render tag and b) the sole child of a block  */
	readonly is_standalone: boolean;
}

export type Context = import('zimmerframe').Context<AST.SvelteNode, ClientTransformState>;
export type Visitors = import('zimmerframe').Visitors<AST.SvelteNode, any>;

export type ComponentContext = import('zimmerframe').Context<
	AST.SvelteNode,
	ComponentClientTransformState
>;
export type ComponentVisitors = import('zimmerframe').Visitors<
	AST.SvelteNode,
	ComponentClientTransformState
>;

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does types.d.ts do?
types.d.ts is a source file in the svelte codebase, written in typescript. It belongs to the Compiler domain, Transformer subdomain.
What functions are defined in types.d.ts?
types.d.ts defines 1 function(s): Expression.
What does types.d.ts depend on?
types.d.ts imports 6 module(s): #compiler, ../types.js, ../types.js, estree, template.js, utils.js.
Where is types.d.ts in the architecture?
types.d.ts is located at packages/svelte/src/compiler/phases/3-transform/client/types.d.ts (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/3-transform/client).

Analyze Your Own Codebase

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

Try Supermodel Free