ConstTag.js — svelte Source File
Architecture documentation for ConstTag.js, a javascript file in the svelte codebase. 4 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR a66fc5da_2bb3_93a3_20d8_c2990acb1c31["ConstTag.js"] 495501a4_a342_6a4d_ac11_e3e2fee8b218["errors.js"] a66fc5da_2bb3_93a3_20d8_c2990acb1c31 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218 a146f6ac_0088_8736_b6ce_318f9f115170["e"] a66fc5da_2bb3_93a3_20d8_c2990acb1c31 --> a146f6ac_0088_8736_b6ce_318f9f115170 bf0d8f1b_17da_970d_bf44_fbcf099d5371["utils.js"] a66fc5da_2bb3_93a3_20d8_c2990acb1c31 --> bf0d8f1b_17da_970d_bf44_fbcf099d5371 7148e639_69d8_a03d_3f08_bd23f41e718a["validate_opening_tag"] a66fc5da_2bb3_93a3_20d8_c2990acb1c31 --> 7148e639_69d8_a03d_3f08_bd23f41e718a 4aa8a188_84d4_0274_ed83_cac0ab1d3572["index.js"] 4aa8a188_84d4_0274_ed83_cac0ab1d3572 --> a66fc5da_2bb3_93a3_20d8_c2990acb1c31 style a66fc5da_2bb3_93a3_20d8_c2990acb1c31 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { AST } from '#compiler' */
/** @import { Context } from '../types' */
import * as e from '../../../errors.js';
import { validate_opening_tag } from './shared/utils.js';
/**
* @param {AST.ConstTag} node
* @param {Context} context
*/
export function ConstTag(node, context) {
if (context.state.analysis.runes) {
validate_opening_tag(node, context.state, '@');
}
const parent = context.path.at(-1);
const grand_parent = context.path.at(-2);
if (
parent?.type !== 'Fragment' ||
(grand_parent?.type !== 'IfBlock' &&
grand_parent?.type !== 'SvelteFragment' &&
grand_parent?.type !== 'Component' &&
grand_parent?.type !== 'SvelteComponent' &&
grand_parent?.type !== 'EachBlock' &&
grand_parent?.type !== 'AwaitBlock' &&
grand_parent?.type !== 'SnippetBlock' &&
grand_parent?.type !== 'SvelteBoundary' &&
grand_parent?.type !== 'KeyBlock' &&
((grand_parent?.type !== 'RegularElement' && grand_parent?.type !== 'SvelteElement') ||
!grand_parent.attributes.some((a) => a.type === 'Attribute' && a.name === 'slot')))
) {
e.const_tag_invalid_placement(node);
}
const declaration = node.declaration.declarations[0];
context.visit(declaration.id);
context.visit(declaration.init, {
...context.state,
expression: node.metadata.expression,
// We're treating this like a $derived under the hood
function_depth: context.state.function_depth + 1,
derived_function_depth: context.state.function_depth + 1
});
}
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does ConstTag.js do?
ConstTag.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 ConstTag.js?
ConstTag.js defines 1 function(s): ConstTag.
What does ConstTag.js depend on?
ConstTag.js imports 4 module(s): e, errors.js, utils.js, validate_opening_tag.
What files import ConstTag.js?
ConstTag.js is imported by 1 file(s): index.js.
Where is ConstTag.js in the architecture?
ConstTag.js is located at packages/svelte/src/compiler/phases/2-analyze/visitors/ConstTag.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/2-analyze/visitors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free