Home / File/ AwaitBlock.js — svelte Source File

AwaitBlock.js — svelte Source File

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

File javascript Compiler Transformer 3 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  ccf22860_d73b_017a_0108_0629fdde9ca9["AwaitBlock.js"]
  74eddc85_a390_2aab_af5a_ef32b77d5430["utils.js"]
  ccf22860_d73b_017a_0108_0629fdde9ca9 --> 74eddc85_a390_2aab_af5a_ef32b77d5430
  6487918e_a8f7_315c_caf5_9694fc4edde7["create_child_block"]
  ccf22860_d73b_017a_0108_0629fdde9ca9 --> 6487918e_a8f7_315c_caf5_9694fc4edde7
  95c28355_f14c_c3cd_5a03_d5a53ca255bc["builders"]
  ccf22860_d73b_017a_0108_0629fdde9ca9 --> 95c28355_f14c_c3cd_5a03_d5a53ca255bc
  86cf8685_38fa_3a1c_9b81_21c452968289["transform-server.js"]
  86cf8685_38fa_3a1c_9b81_21c452968289 --> ccf22860_d73b_017a_0108_0629fdde9ca9
  style ccf22860_d73b_017a_0108_0629fdde9ca9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { BlockStatement, Expression, Pattern, Statement } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { ComponentContext } from '../types.js' */
import * as b from '#compiler/builders';
import { block_close, create_child_block } from './shared/utils.js';

/**
 * @param {AST.AwaitBlock} node
 * @param {ComponentContext} context
 */
export function AwaitBlock(node, context) {
	/** @type {Statement} */
	let statement = b.stmt(
		b.call(
			'$.await',
			b.id('$$renderer'),
			/** @type {Expression} */ (context.visit(node.expression)),
			b.thunk(
				node.pending ? /** @type {BlockStatement} */ (context.visit(node.pending)) : b.block([])
			),
			b.arrow(
				node.value ? [/** @type {Pattern} */ (context.visit(node.value))] : [],
				node.then ? /** @type {BlockStatement} */ (context.visit(node.then)) : b.block([])
			)
		)
	);

	context.state.template.push(
		...create_child_block(
			[statement],
			node.metadata.expression.blockers(),
			node.metadata.expression.has_await
		),
		block_close
	);
}

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does AwaitBlock.js do?
AwaitBlock.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 AwaitBlock.js?
AwaitBlock.js defines 1 function(s): AwaitBlock.
What does AwaitBlock.js depend on?
AwaitBlock.js imports 3 module(s): builders, create_child_block, utils.js.
What files import AwaitBlock.js?
AwaitBlock.js is imported by 1 file(s): transform-server.js.
Where is AwaitBlock.js in the architecture?
AwaitBlock.js is located at packages/svelte/src/compiler/phases/3-transform/server/visitors/AwaitBlock.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/3-transform/server/visitors).

Analyze Your Own Codebase

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

Try Supermodel Free