BindDirective.js — svelte Source File
Architecture documentation for BindDirective.js, a javascript file in the svelte codebase. 18 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2["BindDirective.js"] 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c["ast.js"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c f37fcfdb_9d8e_8c81_7fc8_e49a289d52bc["extract_all_identifiers_from_expression"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> f37fcfdb_9d8e_8c81_7fc8_e49a289d52bc 653284b2_68fd_eee3_0064_918a4c065d4a["is_text_attribute"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 653284b2_68fd_eee3_0064_918a4c065d4a 804afe56_25d1_9f41_dafe_adc75e952134["object"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 804afe56_25d1_9f41_dafe_adc75e952134 bf0d8f1b_17da_970d_bf44_fbcf099d5371["utils.js"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> bf0d8f1b_17da_970d_bf44_fbcf099d5371 5ebdf508_43c0_4c5b_b633_950058ffd709["validate_assignment"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 5ebdf508_43c0_4c5b_b633_950058ffd709 495501a4_a342_6a4d_ac11_e3e2fee8b218["errors.js"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 495501a4_a342_6a4d_ac11_e3e2fee8b218 a146f6ac_0088_8736_b6ce_318f9f115170["e"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> a146f6ac_0088_8736_b6ce_318f9f115170 56a689f9_11c0_cc76_bd60_41bb6dc96475["warnings.js"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 56a689f9_11c0_cc76_bd60_41bb6dc96475 3246e0bc_b9fc_f638_5e35_41e8c39a2408["w"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 3246e0bc_b9fc_f638_5e35_41e8c39a2408 70f59999_db72_c4f6_2b0c_4234646f3763["bindings.js"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 70f59999_db72_c4f6_2b0c_4234646f3763 4057eb45_ab28_d989_1209_dfae45d590c0["fuzzymatch.js"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 4057eb45_ab28_d989_1209_dfae45d590c0 0913e53f_3cfc_070a_7b42_568cf6860af3["fuzzymatch"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 0913e53f_3cfc_070a_7b42_568cf6860af3 2aa63f4e_82c9_33e3_ac6c_5f3d46250522["utils.js"] 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 --> 2aa63f4e_82c9_33e3_ac6c_5f3d46250522 style 6b8c189e_23e1_77d3_9ee3_3eec5012a9b2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { AST } from '#compiler' */
/** @import { Context } from '../types' */
import {
extract_all_identifiers_from_expression,
is_text_attribute,
object
} from '../../../utils/ast.js';
import { validate_assignment } from './shared/utils.js';
import * as e from '../../../errors.js';
import * as w from '../../../warnings.js';
import { binding_properties } from '../../bindings.js';
import fuzzymatch from '../../1-parse/utils/fuzzymatch.js';
import { is_content_editable_binding, is_svg } from '../../../../utils.js';
import { mark_subtree_dynamic } from './shared/fragment.js';
/**
* @param {AST.BindDirective} node
* @param {Context} context
*/
export function BindDirective(node, context) {
const parent = context.path.at(-1);
if (
parent?.type === 'RegularElement' ||
parent?.type === 'SvelteElement' ||
parent?.type === 'SvelteWindow' ||
parent?.type === 'SvelteDocument' ||
parent?.type === 'SvelteBody'
) {
if (node.name in binding_properties) {
const property = binding_properties[node.name];
if (property.valid_elements && !property.valid_elements.includes(parent.name)) {
e.bind_invalid_target(
node,
node.name,
property.valid_elements.map((valid_element) => `\`<${valid_element}>\``).join(', ')
);
}
if (property.invalid_elements && property.invalid_elements.includes(parent.name)) {
const valid_bindings = Object.entries(binding_properties)
.filter(([_, binding_property]) => {
return (
binding_property.valid_elements?.includes(parent.name) ||
(!binding_property.valid_elements &&
!binding_property.invalid_elements?.includes(parent.name))
);
})
.map(([property_name]) => property_name)
.sort();
e.bind_invalid_name(
node,
node.name,
`Possible bindings for <${parent.name}> are ${valid_bindings.join(', ')}`
);
}
if (parent.name === 'input' && node.name !== 'this') {
const type = /** @type {AST.Attribute | undefined} */ (
// ... (221 more lines)
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does BindDirective.js do?
BindDirective.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 BindDirective.js?
BindDirective.js defines 1 function(s): BindDirective.
What does BindDirective.js depend on?
BindDirective.js imports 18 module(s): ast.js, bindings.js, e, errors.js, extract_all_identifiers_from_expression, fragment.js, fuzzymatch, fuzzymatch.js, and 10 more.
What files import BindDirective.js?
BindDirective.js is imported by 1 file(s): index.js.
Where is BindDirective.js in the architecture?
BindDirective.js is located at packages/svelte/src/compiler/phases/2-analyze/visitors/BindDirective.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