Fragment.js — svelte Source File
Architecture documentation for Fragment.js, a javascript file in the svelte codebase. 7 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR eb8f9886_6e75_3f24_8ead_079204f4d4d6["Fragment.js"] f3fad5a9_6b91_ed4f_9331_7f9fc18491c3["utils.js"] eb8f9886_6e75_3f24_8ead_079204f4d4d6 --> f3fad5a9_6b91_ed4f_9331_7f9fc18491c3 48b02cf8_c90b_7278_8655_c24e3431a4b3["clean_nodes"] eb8f9886_6e75_3f24_8ead_079204f4d4d6 --> 48b02cf8_c90b_7278_8655_c24e3431a4b3 19ba44b1_ed7b_aeee_985f_f1c151bf7e44["infer_namespace"] eb8f9886_6e75_3f24_8ead_079204f4d4d6 --> 19ba44b1_ed7b_aeee_985f_f1c151bf7e44 74eddc85_a390_2aab_af5a_ef32b77d5430["utils.js"] eb8f9886_6e75_3f24_8ead_079204f4d4d6 --> 74eddc85_a390_2aab_af5a_ef32b77d5430 4ec029f0_bbf8_66de_0dbf_d15eef3e10a0["process_children"] eb8f9886_6e75_3f24_8ead_079204f4d4d6 --> 4ec029f0_bbf8_66de_0dbf_d15eef3e10a0 49bc6956_1326_e1db_837c_bb4db2493060["build_template"] eb8f9886_6e75_3f24_8ead_079204f4d4d6 --> 49bc6956_1326_e1db_837c_bb4db2493060 95c28355_f14c_c3cd_5a03_d5a53ca255bc["builders"] eb8f9886_6e75_3f24_8ead_079204f4d4d6 --> 95c28355_f14c_c3cd_5a03_d5a53ca255bc 86cf8685_38fa_3a1c_9b81_21c452968289["transform-server.js"] 86cf8685_38fa_3a1c_9b81_21c452968289 --> eb8f9886_6e75_3f24_8ead_079204f4d4d6 style eb8f9886_6e75_3f24_8ead_079204f4d4d6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { AST } from '#compiler' */
/** @import { ComponentContext, ComponentServerTransformState } from '../types.js' */
import { clean_nodes, infer_namespace } from '../../utils.js';
import * as b from '#compiler/builders';
import { empty_comment, process_children, build_template } from './shared/utils.js';
/**
* @param {AST.Fragment} node
* @param {ComponentContext} context
*/
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
Functions
Dependencies
Source
Frequently Asked Questions
What does Fragment.js do?
Fragment.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 Fragment.js?
Fragment.js defines 1 function(s): Fragment.
What does Fragment.js depend on?
Fragment.js imports 7 module(s): build_template, builders, clean_nodes, infer_namespace, process_children, utils.js, utils.js.
What files import Fragment.js?
Fragment.js is imported by 1 file(s): transform-server.js.
Where is Fragment.js in the architecture?
Fragment.js is located at packages/svelte/src/compiler/phases/3-transform/server/visitors/Fragment.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