component.js — svelte Source File
Architecture documentation for component.js, a javascript file in the svelte codebase. 7 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR 45451ab6_59fb_d444_3c97_cd74d7768f0c["component.js"] 74eddc85_a390_2aab_af5a_ef32b77d5430["utils.js"] 45451ab6_59fb_d444_3c97_cd74d7768f0c --> 74eddc85_a390_2aab_af5a_ef32b77d5430 9f24c33c_da34_a132_f273_3ffd2f6e5cf8["build_attribute_value"] 45451ab6_59fb_d444_3c97_cd74d7768f0c --> 9f24c33c_da34_a132_f273_3ffd2f6e5cf8 89f84d70_5c6c_1980_33f9_650ce42a04ab["PromiseOptimiser"] 45451ab6_59fb_d444_3c97_cd74d7768f0c --> 89f84d70_5c6c_1980_33f9_650ce42a04ab bbca3d2a_42c8_b215_d3b5_5077ccaf0797["nodes.js"] 45451ab6_59fb_d444_3c97_cd74d7768f0c --> bbca3d2a_42c8_b215_d3b5_5077ccaf0797 313a36c6_761f_13b2_e8d6_c0f84cd81a9a["is_element_node"] 45451ab6_59fb_d444_3c97_cd74d7768f0c --> 313a36c6_761f_13b2_e8d6_c0f84cd81a9a 62f818c8_e890_17ed_5ec1_92f953d4a7a6["state.js"] 45451ab6_59fb_d444_3c97_cd74d7768f0c --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6 95c28355_f14c_c3cd_5a03_d5a53ca255bc["builders"] 45451ab6_59fb_d444_3c97_cd74d7768f0c --> 95c28355_f14c_c3cd_5a03_d5a53ca255bc 882c42d0_d6ba_d72f_9511_0a3b9b11a3be["Component.js"] 882c42d0_d6ba_d72f_9511_0a3b9b11a3be --> 45451ab6_59fb_d444_3c97_cd74d7768f0c cf6a78fe_55c7_8837_83a2_6f1118b9b29a["SvelteComponent.js"] cf6a78fe_55c7_8837_83a2_6f1118b9b29a --> 45451ab6_59fb_d444_3c97_cd74d7768f0c 13b77450_c0b4_30ed_7a51_49b72fcc7c2d["SvelteSelf.js"] 13b77450_c0b4_30ed_7a51_49b72fcc7c2d --> 45451ab6_59fb_d444_3c97_cd74d7768f0c style 45451ab6_59fb_d444_3c97_cd74d7768f0c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { BlockStatement, Expression, Pattern, Property, SequenceExpression, Statement } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { ComponentContext } from '../../types.js' */
import { empty_comment, build_attribute_value, PromiseOptimiser } from './utils.js';
import * as b from '#compiler/builders';
import { is_element_node } from '../../../../nodes.js';
import { dev } from '../../../../../state.js';
/**
* @param {AST.Component | AST.SvelteComponent | AST.SvelteSelf} node
* @param {Expression} expression
* @param {ComponentContext} context
*/
export function build_inline_component(node, expression, context) {
/** @type {Array<Property[] | Expression>} */
const props_and_spreads = [];
/** @type {Array<() => void>} */
const delayed_props = [];
/** @type {Property[]} */
const custom_css_props = [];
/** @type {Record<string, AST.LetDirective[]>} */
const lets = { default: [] };
/**
* Children in the default slot are evaluated in the component scope,
* children in named slots are evaluated in the parent scope
*/
const child_state = {
...context.state,
scope: node.metadata.scopes.default
};
/** @type {Record<string, AST.TemplateNode[]>} */
const children = {};
/**
* If this component has a slot property, it is a named slot within another component. In this case
* the slot scope applies to the component itself, too, and not just its children.
*/
const slot_scope_applies_to_itself = node.attributes.some(
(node) => node.type === 'Attribute' && node.name === 'slot'
);
/**
* Components may have a children prop and also have child nodes. In this case, we assume
* that the child component isn't using render tags yet and pass the slot as $$slots.default.
* We're not doing it for spread attributes, as this would result in too many false positives.
*/
let has_children_prop = false;
/**
* @param {Property} prop
* @param {boolean} [delay]
*/
function push_prop(prop, delay = false) {
const do_push = () => {
const current = props_and_spreads.at(-1);
const current_is_props = Array.isArray(current);
// ... (282 more lines)
Domain
Subdomains
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does component.js do?
component.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 component.js?
component.js defines 1 function(s): build_inline_component.
What does component.js depend on?
component.js imports 7 module(s): PromiseOptimiser, build_attribute_value, builders, is_element_node, nodes.js, state.js, utils.js.
What files import component.js?
component.js is imported by 3 file(s): Component.js, SvelteComponent.js, SvelteSelf.js.
Where is component.js in the architecture?
component.js is located at packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/component.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/3-transform/server/visitors/shared).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free