ExportNamedDeclaration() — svelte Function Reference
Architecture documentation for the ExportNamedDeclaration() function in ExportNamedDeclaration.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD e96115fe_8b72_b5a0_9f38_7fcb6136263b["ExportNamedDeclaration()"] 7e95d51f_5311_0710_b8b8_1d5f79e8b0a7["ExportNamedDeclaration.js"] e96115fe_8b72_b5a0_9f38_7fcb6136263b -->|defined in| 7e95d51f_5311_0710_b8b8_1d5f79e8b0a7 47746ef3_2023_7a7b_a76e_1a087ad67079["module_illegal_default_export()"] e96115fe_8b72_b5a0_9f38_7fcb6136263b -->|calls| 47746ef3_2023_7a7b_a76e_1a087ad67079 44a3e00f_3460_b306_bb17_dab77502632e["legacy_export_invalid()"] e96115fe_8b72_b5a0_9f38_7fcb6136263b -->|calls| 44a3e00f_3460_b306_bb17_dab77502632e c12e0147_3f27_cf17_5878_e54ffdc328d5["extract_identifiers()"] e96115fe_8b72_b5a0_9f38_7fcb6136263b -->|calls| c12e0147_3f27_cf17_5878_e54ffdc328d5 5a9713f3_442b_a254_3f51_b06e691a8e0d["derived_invalid_export()"] e96115fe_8b72_b5a0_9f38_7fcb6136263b -->|calls| 5a9713f3_442b_a254_3f51_b06e691a8e0d bd5eca30_3212_dd88_7501_cf245ff26ff4["state_invalid_export()"] e96115fe_8b72_b5a0_9f38_7fcb6136263b -->|calls| bd5eca30_3212_dd88_7501_cf245ff26ff4 style e96115fe_8b72_b5a0_9f38_7fcb6136263b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/visitors/ExportNamedDeclaration.js lines 10–70
export function ExportNamedDeclaration(node, context) {
// visit children, so bindings are correctly initialised
context.next();
if (
context.state.ast_type &&
node.specifiers.some((specifier) =>
specifier.exported.type === 'Identifier'
? specifier.exported.name === 'default'
: specifier.exported.value === 'default'
)
) {
e.module_illegal_default_export(node);
}
if (node.declaration?.type === 'VariableDeclaration') {
// in runes mode, forbid `export let`
if (
context.state.analysis.runes &&
context.state.ast_type === 'instance' &&
node.declaration.kind === 'let'
) {
e.legacy_export_invalid(node);
}
for (const declarator of node.declaration.declarations) {
for (const id of extract_identifiers(declarator.id)) {
const binding = context.state.scope.get(id.name);
if (!binding) continue;
if (binding.kind === 'derived') {
e.derived_invalid_export(node);
}
if ((binding.kind === 'state' || binding.kind === 'raw_state') && binding.reassigned) {
e.state_invalid_export(node);
}
}
}
}
if (context.state.analysis.runes) {
if (node.declaration && context.state.ast_type === 'instance') {
if (
node.declaration.type === 'FunctionDeclaration' ||
node.declaration.type === 'ClassDeclaration'
) {
context.state.analysis.exports.push({
name: /** @type {Identifier} */ (node.declaration.id).name,
alias: null
});
} else if (node.declaration.kind === 'const') {
for (const declarator of node.declaration.declarations) {
for (const node of extract_identifiers(declarator.id)) {
context.state.analysis.exports.push({ name: node.name, alias: null });
}
}
}
}
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does ExportNamedDeclaration() do?
ExportNamedDeclaration() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/ExportNamedDeclaration.js.
Where is ExportNamedDeclaration() defined?
ExportNamedDeclaration() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/ExportNamedDeclaration.js at line 10.
What does ExportNamedDeclaration() call?
ExportNamedDeclaration() calls 5 function(s): derived_invalid_export, extract_identifiers, legacy_export_invalid, module_illegal_default_export, state_invalid_export.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free