KeyBlock.js — svelte Source File
Architecture documentation for KeyBlock.js, a javascript file in the svelte codebase. 4 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR e4026a26_94fd_8cc0_83d1_b3563fd0ed95["KeyBlock.js"] d04d7971_88df_542d_dd4f_26170ce6f581["utils.js"] e4026a26_94fd_8cc0_83d1_b3563fd0ed95 --> d04d7971_88df_542d_dd4f_26170ce6f581 66243dec_e2be_a66d_3992_3ea42cf964b5["build_expression"] e4026a26_94fd_8cc0_83d1_b3563fd0ed95 --> 66243dec_e2be_a66d_3992_3ea42cf964b5 575bfb79_8777_5076_eda3_be015882482a["add_svelte_meta"] e4026a26_94fd_8cc0_83d1_b3563fd0ed95 --> 575bfb79_8777_5076_eda3_be015882482a 95c28355_f14c_c3cd_5a03_d5a53ca255bc["builders"] e4026a26_94fd_8cc0_83d1_b3563fd0ed95 --> 95c28355_f14c_c3cd_5a03_d5a53ca255bc 7665e008_f37d_b860_a594_f2539a66af4e["transform-client.js"] 7665e008_f37d_b860_a594_f2539a66af4e --> e4026a26_94fd_8cc0_83d1_b3563fd0ed95 style e4026a26_94fd_8cc0_83d1_b3563fd0ed95 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { Expression } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { ComponentContext } from '../types' */
import * as b from '#compiler/builders';
import { build_expression, add_svelte_meta } from './shared/utils.js';
/**
* @param {AST.KeyBlock} node
* @param {ComponentContext} context
*/
export function KeyBlock(node, context) {
context.state.template.push_comment();
const has_await = node.metadata.expression.has_await;
const has_blockers = node.metadata.expression.has_blockers();
const expression = build_expression(context, node.expression, node.metadata.expression);
const key = b.thunk(has_await ? b.call('$.get', b.id('$$key')) : expression);
const body = /** @type {Expression} */ (context.visit(node.fragment));
const statement = add_svelte_meta(
b.call('$.key', context.state.node, key, b.arrow([b.id('$$anchor')], body)),
node,
'key'
);
if (has_await || has_blockers) {
context.state.init.push(
b.stmt(
b.call(
'$.async',
context.state.node,
node.metadata.expression.blockers(),
has_await ? b.array([b.thunk(expression, true)]) : b.void0,
b.arrow(
has_await ? [context.state.node, b.id('$$key')] : [context.state.node],
b.block([statement])
)
)
)
);
} else {
context.state.init.push(statement);
}
}
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does KeyBlock.js do?
KeyBlock.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 KeyBlock.js?
KeyBlock.js defines 1 function(s): KeyBlock.
What does KeyBlock.js depend on?
KeyBlock.js imports 4 module(s): add_svelte_meta, build_expression, builders, utils.js.
What files import KeyBlock.js?
KeyBlock.js is imported by 1 file(s): transform-client.js.
Where is KeyBlock.js in the architecture?
KeyBlock.js is located at packages/svelte/src/compiler/phases/3-transform/client/visitors/KeyBlock.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/3-transform/client/visitors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free