Home / Function/ apply_preprocessor_sourcemap() — svelte Function Reference

apply_preprocessor_sourcemap() — svelte Function Reference

Architecture documentation for the apply_preprocessor_sourcemap() function in mapped_code.js from the svelte codebase.

Function javascript Compiler Migrator calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  75dd917c_6b23_2b41_3ed7_e5aa56348c12["apply_preprocessor_sourcemap()"]
  d383a41d_5383_ee86_cab6_03bf1a2daf93["mapped_code.js"]
  75dd917c_6b23_2b41_3ed7_e5aa56348c12 -->|defined in| d383a41d_5383_ee86_cab6_03bf1a2daf93
  cbb1ee69_356b_2015_1118_b75b5cb5088f["merge_with_preprocessor_map()"]
  cbb1ee69_356b_2015_1118_b75b5cb5088f -->|calls| 75dd917c_6b23_2b41_3ed7_e5aa56348c12
  c005db55_c14e_aa09_dbae_d0b302ec93df["combine_sourcemaps()"]
  75dd917c_6b23_2b41_3ed7_e5aa56348c12 -->|calls| c005db55_c14e_aa09_dbae_d0b302ec93df
  501b8a9f_e42f_5500_1d05_720f16a714b4["b64enc()"]
  75dd917c_6b23_2b41_3ed7_e5aa56348c12 -->|calls| 501b8a9f_e42f_5500_1d05_720f16a714b4
  style 75dd917c_6b23_2b41_3ed7_e5aa56348c12 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/utils/mapped_code.js lines 308–332

function apply_preprocessor_sourcemap(filename, svelte_map, preprocessor_map_input) {
	if (!svelte_map || !preprocessor_map_input) return svelte_map;
	const preprocessor_map =
		typeof preprocessor_map_input === 'string'
			? JSON.parse(preprocessor_map_input)
			: preprocessor_map_input;
	const result_map = combine_sourcemaps(filename, [svelte_map, preprocessor_map]);
	// Svelte expects a SourceMap which includes toUrl and toString. Instead of wrapping our output in a class,
	// we just tack on the extra properties.
	Object.defineProperties(result_map, {
		toString: {
			enumerable: false,
			value: function toString() {
				return JSON.stringify(this);
			}
		},
		toUrl: {
			enumerable: false,
			value: function toUrl() {
				return 'data:application/json;charset=utf-8;base64,' + b64enc(this.toString());
			}
		}
	});
	return /** @type {any} */ (result_map);
}

Domain

Subdomains

Frequently Asked Questions

What does apply_preprocessor_sourcemap() do?
apply_preprocessor_sourcemap() is a function in the svelte codebase, defined in packages/svelte/src/compiler/utils/mapped_code.js.
Where is apply_preprocessor_sourcemap() defined?
apply_preprocessor_sourcemap() is defined in packages/svelte/src/compiler/utils/mapped_code.js at line 308.
What does apply_preprocessor_sourcemap() call?
apply_preprocessor_sourcemap() calls 2 function(s): b64enc, combine_sourcemaps.
What calls apply_preprocessor_sourcemap()?
apply_preprocessor_sourcemap() is called by 1 function(s): merge_with_preprocessor_map.

Analyze Your Own Codebase

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

Try Supermodel Free