Home / File/ index.js — svelte Source File

index.js — svelte Source File

Architecture documentation for index.js, a javascript file in the svelte codebase. 12 imports, 0 dependents.

File javascript Compiler Migrator 12 imports 7 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  ccf6927a_1f1b_1dda_8616_80903a72ba16["index.js"]
  d383a41d_5383_ee86_cab6_03bf1a2daf93["mapped_code.js"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> d383a41d_5383_ee86_cab6_03bf1a2daf93
  fd3be7c7_b876_965d_9025_a9b9bd4c6aaf["MappedCode"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> fd3be7c7_b876_965d_9025_a9b9bd4c6aaf
  b39edb0f_ea67_1ea3_e86a_954e5131b3cd["parse_attached_sourcemap"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> b39edb0f_ea67_1ea3_e86a_954e5131b3cd
  43e78aae_3ec8_4918_115c_186127bac060["sourcemap_add_offset"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> 43e78aae_3ec8_4918_115c_186127bac060
  c005db55_c14e_aa09_dbae_d0b302ec93df["combine_sourcemaps"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> c005db55_c14e_aa09_dbae_d0b302ec93df
  fee21348_d647_ae03_a75d_4957b319966c["get_basename"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> fee21348_d647_ae03_a75d_4957b319966c
  1351e89f_1c35_8e97_8067_5913392f2985["decode_sourcemap.js"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> 1351e89f_1c35_8e97_8067_5913392f2985
  10d4a3f8_0b0d_01ad_be21_df83b1c0be75["decode_map"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> 10d4a3f8_0b0d_01ad_be21_df83b1c0be75
  76cde72f_b08b_6c0b_1e04_dda16a7ac104["replace_in_code.js"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> 76cde72f_b08b_6c0b_1e04_dda16a7ac104
  e504078b_ad3f_7265_675b_c14b85115247["replace_in_code"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> e504078b_ad3f_7265_675b_c14b85115247
  2f8f22ce_6b99_47f9_f47d_9e47a039bde4["slice_source"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> 2f8f22ce_6b99_47f9_f47d_9e47a039bde4
  5415ae33_acc7_39bf_2a56_bf3800623713["locate-character"]
  ccf6927a_1f1b_1dda_8616_80903a72ba16 --> 5415ae33_acc7_39bf_2a56_bf3800623713
  style ccf6927a_1f1b_1dda_8616_80903a72ba16 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { Processed, Preprocessor, MarkupPreprocessor, PreprocessorGroup } from './public.js' */
/** @import { SourceUpdate, Source } from './private.js' */
/** @import { DecodedSourceMap, RawSourceMap } from '@jridgewell/remapping' */
import { getLocator } from 'locate-character';
import {
	MappedCode,
	parse_attached_sourcemap,
	sourcemap_add_offset,
	combine_sourcemaps,
	get_basename
} from '../utils/mapped_code.js';
import { decode_map } from './decode_sourcemap.js';
import { replace_in_code, slice_source } from './replace_in_code.js';

/**
 * Represents intermediate states of the preprocessing.
 * Implements the Source interface.
 */
class PreprocessResult {
	/** @type {string} */
	source;

	/** @type {string | undefined} The filename passed as-is to preprocess */
	filename;

	// sourcemap_list is sorted in reverse order from last map (index 0) to first map (index -1)
	// so we use sourcemap_list.unshift() to add new maps
	// https://github.com/jridgewell/sourcemaps/tree/main/packages/remapping#multiple-transformations-of-a-file

	/**
	 * @default []
	 * @type {Array<DecodedSourceMap | RawSourceMap>}
	 */
	sourcemap_list = [];

	/**
	 * @default []
	 * @type {string[]}
	 */
	dependencies = [];

	/**
	 * @type {string | null} last part of the filename, as used for `sources` in sourcemaps
	 */
	file_basename = /** @type {any} */ (undefined);

	/**
	 * @type {ReturnType<typeof getLocator>}
	 */
	get_location = /** @type {any} */ (undefined);

	/**
	 * @param {string} source
	 * @param {string} [filename]
	 */
	constructor(source, filename) {
		this.source = source;
		this.filename = filename;
		this.update_source({ string: source });
		// preprocess source must be relative to itself or equal null
// ... (309 more lines)

Domain

Subdomains

Frequently Asked Questions

What does index.js do?
index.js is a source file in the svelte codebase, written in javascript. It belongs to the Compiler domain, Migrator subdomain.
What functions are defined in index.js?
index.js defines 7 function(s): parse_tag_attributes, preprocess, process_markup, process_tag, processed_content_to_code, processed_tag_to_code, stringify_tag_attributes.
What does index.js depend on?
index.js imports 12 module(s): MappedCode, combine_sourcemaps, decode_map, decode_sourcemap.js, get_basename, locate-character, mapped_code.js, parse_attached_sourcemap, and 4 more.
Where is index.js in the architecture?
index.js is located at packages/svelte/src/compiler/preprocess/index.js (domain: Compiler, subdomain: Migrator, directory: packages/svelte/src/compiler/preprocess).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free