Fragment() — svelte Function Reference
Architecture documentation for the Fragment() function in Fragment.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 018cf13b_00c1_1002_de36_76e71d0a0a5e["Fragment()"] eb8f9886_6e75_3f24_8ead_079204f4d4d6["Fragment.js"] 018cf13b_00c1_1002_de36_76e71d0a0a5e -->|defined in| eb8f9886_6e75_3f24_8ead_079204f4d4d6 19ba44b1_ed7b_aeee_985f_f1c151bf7e44["infer_namespace()"] 018cf13b_00c1_1002_de36_76e71d0a0a5e -->|calls| 19ba44b1_ed7b_aeee_985f_f1c151bf7e44 48b02cf8_c90b_7278_8655_c24e3431a4b3["clean_nodes()"] 018cf13b_00c1_1002_de36_76e71d0a0a5e -->|calls| 48b02cf8_c90b_7278_8655_c24e3431a4b3 4ec029f0_bbf8_66de_0dbf_d15eef3e10a0["process_children()"] 018cf13b_00c1_1002_de36_76e71d0a0a5e -->|calls| 4ec029f0_bbf8_66de_0dbf_d15eef3e10a0 49bc6956_1326_e1db_837c_bb4db2493060["build_template()"] 018cf13b_00c1_1002_de36_76e71d0a0a5e -->|calls| 49bc6956_1326_e1db_837c_bb4db2493060 style 018cf13b_00c1_1002_de36_76e71d0a0a5e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/3-transform/server/visitors/Fragment.js lines 11–53
export function Fragment(node, context) {
const parent = context.path.at(-1) ?? node;
const namespace = infer_namespace(context.state.namespace, parent, node.nodes);
const { hoisted, trimmed, is_standalone, is_text_first } = clean_nodes(
parent,
node.nodes,
context.path,
namespace,
context.state,
context.state.preserve_whitespace,
context.state.options.preserveComments
);
/** @type {ComponentServerTransformState} */
const state = {
...context.state,
init: [],
template: [],
namespace,
is_standalone,
async_consts: undefined
};
for (const node of hoisted) {
context.visit(node, state);
}
if (is_text_first) {
// insert `<!---->` to prevent this from being glued to the previous fragment
state.template.push(empty_comment);
}
process_children(trimmed, { ...context, state });
if (state.async_consts && state.async_consts.thunks.length > 0) {
state.init.push(
b.var(state.async_consts.id, b.call('$$renderer.run', b.array(state.async_consts.thunks)))
);
}
return b.block([...state.init, ...build_template(state.template)]);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does Fragment() do?
Fragment() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/server/visitors/Fragment.js.
Where is Fragment() defined?
Fragment() is defined in packages/svelte/src/compiler/phases/3-transform/server/visitors/Fragment.js at line 11.
What does Fragment() call?
Fragment() calls 4 function(s): build_template, clean_nodes, infer_namespace, process_children.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free