template.js — svelte Source File
Architecture documentation for template.js, a javascript file in the svelte codebase. 8 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR c3ec4c82_ce35_6219_c232_12ebeea91443["template.js"] cb064307_faf7_de99_b8a6_9523086a7c01["escaping.js"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> cb064307_faf7_de99_b8a6_9523086a7c01 d6dfd043_7103_f2c7_aab3_9660fb0a5f75["escape_html"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> d6dfd043_7103_f2c7_aab3_9660fb0a5f75 2aa63f4e_82c9_33e3_ac6c_5f3d46250522["utils.js"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> 2aa63f4e_82c9_33e3_ac6c_5f3d46250522 02a8b5a2_13c5_e5b3_1ed2_617763d0904d["is_void"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> 02a8b5a2_13c5_e5b3_1ed2_617763d0904d 86d962e3_eb57_390f_97ea_99199c93bcfe["fix-attribute-casing.js"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> 86d962e3_eb57_390f_97ea_99199c93bcfe eb20d11e_39a8_398a_4e2c_12accd39ccdd["fix_attribute_casing"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> eb20d11e_39a8_398a_4e2c_12accd39ccdd ce051dbd_4cf1_f117_d66e_12cfa122de37["patterns.js"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> ce051dbd_4cf1_f117_d66e_12cfa122de37 95c28355_f14c_c3cd_5a03_d5a53ca255bc["builders"] c3ec4c82_ce35_6219_c232_12ebeea91443 --> 95c28355_f14c_c3cd_5a03_d5a53ca255bc e958f40a_bb26_89ce_018e_c2acc509a051["types.d.ts"] e958f40a_bb26_89ce_018e_c2acc509a051 --> c3ec4c82_ce35_6219_c232_12ebeea91443 96f4a58f_3498_1ea2_7ff9_3d805414893b["Fragment.js"] 96f4a58f_3498_1ea2_7ff9_3d805414893b --> c3ec4c82_ce35_6219_c232_12ebeea91443 4610488f_3cf2_5f73_043e_da0aa9d026fe["RegularElement.js"] 4610488f_3cf2_5f73_043e_da0aa9d026fe --> c3ec4c82_ce35_6219_c232_12ebeea91443 style c3ec4c82_ce35_6219_c232_12ebeea91443 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { AST } from '#compiler' */
/** @import { Node, Element } from './types'; */
import { escape_html } from '../../../../../escaping.js';
import { is_void } from '../../../../../utils.js';
import * as b from '#compiler/builders';
import fix_attribute_casing from './fix-attribute-casing.js';
import { regex_starts_with_newline } from '../../../patterns.js';
export class Template {
/**
* `true` if HTML template contains a `<script>` tag. In this case we need to invoke a special
* template instantiation function (see `create_fragment_with_script_from_html` for more info)
*/
contains_script_tag = false;
/** `true` if the HTML template needs to be instantiated with `importNode` */
needs_import_node = false;
/** @type {Node[]} */
nodes = [];
/** @type {Node[][]} */
#stack = [this.nodes];
/** @type {Element | undefined} */
#element;
#fragment = this.nodes;
/**
* @param {string} name
* @param {number} start
*/
push_element(name, start) {
this.#element = {
type: 'element',
name,
attributes: {},
children: [],
start
};
this.#fragment.push(this.#element);
this.#fragment = /** @type {Element} */ (this.#element).children;
this.#stack.push(this.#fragment);
}
/** @param {string} [data] */
push_comment(data) {
this.#fragment.push({ type: 'comment', data });
}
/** @param {AST.Text[]} nodes */
push_text(nodes) {
this.#fragment.push({ type: 'text', nodes });
}
pop_element() {
this.#stack.pop();
// ... (103 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
Imported By
Source
Frequently Asked Questions
What does template.js do?
template.js is a source file in the svelte codebase, written in javascript. It belongs to the Compiler domain, Parser subdomain.
What functions are defined in template.js?
template.js defines 2 function(s): objectify, stringify.
What does template.js depend on?
template.js imports 8 module(s): builders, escape_html, escaping.js, fix-attribute-casing.js, fix_attribute_casing, is_void, patterns.js, utils.js.
What files import template.js?
template.js is imported by 3 file(s): Fragment.js, RegularElement.js, types.d.ts.
Where is template.js in the architecture?
template.js is located at packages/svelte/src/compiler/phases/3-transform/client/transform-template/template.js (domain: Compiler, subdomain: Parser, directory: packages/svelte/src/compiler/phases/3-transform/client/transform-template).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free