Home / Function/ client_module() — svelte Function Reference

client_module() — svelte Function Reference

Architecture documentation for the client_module() function in transform-client.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  f67152db_9574_dae2_c7ba_381253877c55["client_module()"]
  7665e008_f37d_b860_a594_f2539a66af4e["transform-client.js"]
  f67152db_9574_dae2_c7ba_381253877c55 -->|defined in| 7665e008_f37d_b860_a594_f2539a66af4e
  0ccad5bf_e752_7e10_164a_ca0ec818db6f["transform_module()"]
  0ccad5bf_e752_7e10_164a_ca0ec818db6f -->|calls| f67152db_9574_dae2_c7ba_381253877c55
  style f67152db_9574_dae2_c7ba_381253877c55 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/3-transform/client/transform-client.js lines 691–719

export function client_module(analysis, options) {
	/** @type {ClientTransformState} */
	const state = {
		analysis,
		options,
		scope: analysis.module.scope,
		scopes: analysis.module.scopes,
		state_fields: new Map(),
		transform: {},
		in_constructor: false,
		is_instance: false
	};

	const module = /** @type {ESTree.Program} */ (
		walk(/** @type {AST.SvelteNode} */ (analysis.module.ast), state, visitors)
	);

	const body = [b.import_all('$', 'svelte/internal/client')];

	if (analysis.tracing) {
		body.push(b.imports([], 'svelte/internal/flags/tracing'));
	}

	return {
		type: 'Program',
		sourceType: 'module',
		body: [...body, ...module.body]
	};
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does client_module() do?
client_module() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/client/transform-client.js.
Where is client_module() defined?
client_module() is defined in packages/svelte/src/compiler/phases/3-transform/client/transform-client.js at line 691.
What calls client_module()?
client_module() is called by 1 function(s): transform_module.

Analyze Your Own Codebase

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

Try Supermodel Free