fragment.js — svelte Source File
Architecture documentation for fragment.js, a javascript file in the svelte codebase. 10 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 2d9685c3_3dc6_7a1f_823b_1e70d1834927["fragment.js"] 2aa63f4e_82c9_33e3_ac6c_5f3d46250522["utils.js"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> 2aa63f4e_82c9_33e3_ac6c_5f3d46250522 236530b5_f75d_4a7b_e916_b2d6a6d54dfb["cannot_be_set_statically"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> 236530b5_f75d_4a7b_e916_b2d6a6d54dfb 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c["ast.js"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c e9a2c29e_d0ca_ab9f_b86f_f22ff802db91["is_event_attribute"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> e9a2c29e_d0ca_ab9f_b86f_f22ff802db91 653284b2_68fd_eee3_0064_918a4c065d4a["is_text_attribute"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> 653284b2_68fd_eee3_0064_918a4c065d4a bbca3d2a_42c8_b215_d3b5_5077ccaf0797["nodes.js"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> bbca3d2a_42c8_b215_d3b5_5077ccaf0797 76437ce7_73fa_a7f2_397a_1ddd381e8282["is_custom_element_node"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> 76437ce7_73fa_a7f2_397a_1ddd381e8282 d04d7971_88df_542d_dd4f_26170ce6f581["utils.js"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> d04d7971_88df_542d_dd4f_26170ce6f581 f3280f06_553d_66c3_8ca2_c3c36dcdda64["build_template_chunk"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> f3280f06_553d_66c3_8ca2_c3c36dcdda64 95c28355_f14c_c3cd_5a03_d5a53ca255bc["builders"] 2d9685c3_3dc6_7a1f_823b_1e70d1834927 --> 95c28355_f14c_c3cd_5a03_d5a53ca255bc 96f4a58f_3498_1ea2_7ff9_3d805414893b["Fragment.js"] 96f4a58f_3498_1ea2_7ff9_3d805414893b --> 2d9685c3_3dc6_7a1f_823b_1e70d1834927 4610488f_3cf2_5f73_043e_da0aa9d026fe["RegularElement.js"] 4610488f_3cf2_5f73_043e_da0aa9d026fe --> 2d9685c3_3dc6_7a1f_823b_1e70d1834927 style 2d9685c3_3dc6_7a1f_823b_1e70d1834927 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { Expression, Identifier, SourceLocation } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { ComponentContext } from '../../types' */
import { cannot_be_set_statically } from '../../../../../../utils.js';
import { is_event_attribute, is_text_attribute } from '../../../../../utils/ast.js';
import * as b from '#compiler/builders';
import { is_custom_element_node } from '../../../../nodes.js';
import { build_template_chunk } from './utils.js';
/**
* Processes an array of template nodes, joining sibling text/expression nodes
* (e.g. `{a} b {c}`) into a single update function. Along the way it creates
* corresponding template node references these updates are applied to.
* @param {AST.SvelteNode[]} nodes
* @param {(is_text: boolean) => Expression} initial
* @param {boolean} is_element
* @param {ComponentContext} context
*/
export function process_children(nodes, initial, is_element, context) {
const within_bound_contenteditable = context.state.metadata.bound_contenteditable;
let prev = initial;
let skipped = 0;
/** @typedef {Array<AST.Text | AST.ExpressionTag>} Sequence */
/** @type {Sequence} */
let sequence = [];
/** @param {boolean} is_text */
function get_node(is_text) {
if (skipped === 0) {
return prev(is_text);
}
return b.call(
'$.sibling',
prev(false),
(is_text || skipped !== 1) && b.literal(skipped),
is_text && b.true
);
}
/**
* @param {boolean} is_text
* @param {string} name
* @param {SourceLocation | null} [loc]
*/
function flush_node(is_text, name, loc) {
const expression = get_node(is_text);
let id = expression;
if (id.type !== 'Identifier') {
id = b.id(context.state.scope.generate(name), loc);
context.state.init.push(b.var(id, expression));
}
prev = () => id;
skipped = 1; // the next node is `$.sibling(id)`
return id;
}
// ... (126 more lines)
Domain
Subdomains
Functions
Dependencies
Imported By
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 2 function(s): is_static_element, process_children.
What does fragment.js depend on?
fragment.js imports 10 module(s): ast.js, build_template_chunk, builders, cannot_be_set_statically, is_custom_element_node, is_event_attribute, is_text_attribute, nodes.js, and 2 more.
What files import fragment.js?
fragment.js is imported by 2 file(s): Fragment.js, RegularElement.js.
Where is fragment.js in the architecture?
fragment.js is located at packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/3-transform/client/visitors/shared).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free