SnippetBlock.js — svelte Source File
Architecture documentation for SnippetBlock.js, a javascript file in the svelte codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 4017addc_67a0_74ad_63c4_cd8e00ec8c49["SnippetBlock.js"] 62f818c8_e890_17ed_5ec1_92f953d4a7a6["state.js"] 4017addc_67a0_74ad_63c4_cd8e00ec8c49 --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6 95c28355_f14c_c3cd_5a03_d5a53ca255bc["builders"] 4017addc_67a0_74ad_63c4_cd8e00ec8c49 --> 95c28355_f14c_c3cd_5a03_d5a53ca255bc 86cf8685_38fa_3a1c_9b81_21c452968289["transform-server.js"] 86cf8685_38fa_3a1c_9b81_21c452968289 --> 4017addc_67a0_74ad_63c4_cd8e00ec8c49 style 4017addc_67a0_74ad_63c4_cd8e00ec8c49 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { BlockStatement } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { ComponentContext } from '../types.js' */
import { dev } from '../../../../state.js';
import * as b from '#compiler/builders';
/**
* @param {AST.SnippetBlock} node
* @param {ComponentContext} context
*/
export function SnippetBlock(node, context) {
let fn = b.function_declaration(
node.expression,
[b.id('$$renderer'), ...node.parameters],
/** @type {BlockStatement} */ (context.visit(node.body))
);
// @ts-expect-error - TODO remove this hack once $$render_inner for legacy bindings is gone
fn.___snippet = true;
const statements = node.metadata.can_hoist ? context.state.hoisted : context.state.init;
if (dev) {
fn.body.body.unshift(b.stmt(b.call('$.validate_snippet_args', b.id('$$renderer'))));
statements.push(b.stmt(b.call('$.prevent_snippet_stringification', fn.id)));
}
statements.push(fn);
}
Domain
Subdomains
Functions
Dependencies
- builders
- state.js
Source
Frequently Asked Questions
What does SnippetBlock.js do?
SnippetBlock.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 SnippetBlock.js?
SnippetBlock.js defines 1 function(s): SnippetBlock.
What does SnippetBlock.js depend on?
SnippetBlock.js imports 2 module(s): builders, state.js.
What files import SnippetBlock.js?
SnippetBlock.js is imported by 1 file(s): transform-server.js.
Where is SnippetBlock.js in the architecture?
SnippetBlock.js is located at packages/svelte/src/compiler/phases/3-transform/server/visitors/SnippetBlock.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/3-transform/server/visitors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free