transform_module() — svelte Function Reference
Architecture documentation for the transform_module() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 0ccad5bf_e752_7e10_164a_ca0ec818db6f["transform_module()"] f1cb032f_d7a0_6877_cebc_2e5f4505e958["index.js"] 0ccad5bf_e752_7e10_164a_ca0ec818db6f -->|defined in| f1cb032f_d7a0_6877_cebc_2e5f4505e958 39054977_bbc9_e3d5_4935_6918741df7be["compileModule()"] 39054977_bbc9_e3d5_4935_6918741df7be -->|calls| 0ccad5bf_e752_7e10_164a_ca0ec818db6f c54f6fdd_cd90_f775_fe11_a4c398d8d8e5["server_module()"] 0ccad5bf_e752_7e10_164a_ca0ec818db6f -->|calls| c54f6fdd_cd90_f775_fe11_a4c398d8d8e5 f67152db_9574_dae2_c7ba_381253877c55["client_module()"] 0ccad5bf_e752_7e10_164a_ca0ec818db6f -->|calls| f67152db_9574_dae2_c7ba_381253877c55 8164d272_5d30_264a_68d0_0339d7d146e1["get_source_name()"] 0ccad5bf_e752_7e10_164a_ca0ec818db6f -->|calls| 8164d272_5d30_264a_68d0_0339d7d146e1 style 0ccad5bf_e752_7e10_164a_ca0ec818db6f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/3-transform/index.js lines 70–118
export function transform_module(analysis, source, options) {
if (options.generate === false) {
return {
js: /** @type {any} */ (null),
css: null,
warnings: state.warnings, // set afterwards
metadata: {
runes: true
},
ast: /** @type {any} */ (null) // set afterwards
};
}
const program =
options.generate === 'server'
? server_module(analysis, options)
: client_module(analysis, options);
const basename = options.filename.split(/[/\\]/).at(-1);
if (program.body.length > 0) {
program.body[0].leadingComments = [
{
type: 'Block',
value: ` ${basename} generated by Svelte v${VERSION} `
}
];
}
const js = print(/** @type {Node} */ (program), ts({ comments: analysis.comments }), {
// include source content; makes it easier/more robust looking up the source map code
// (else esrap does return null for source and sourceMapContent which may trip up tooling)
sourceMapContent: source,
sourceMapSource: get_source_name(options.filename, undefined, 'input.svelte.js')
});
// prepend comment
js.code = `/* ${basename} generated by Svelte v${VERSION} */\n${js.code}`;
js.map.mappings = ';' + js.map.mappings;
return {
js,
css: null,
metadata: {
runes: true
},
warnings: state.warnings, // set afterwards
ast: /** @type {any} */ (null) // set afterwards
};
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does transform_module() do?
transform_module() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/index.js.
Where is transform_module() defined?
transform_module() is defined in packages/svelte/src/compiler/phases/3-transform/index.js at line 70.
What does transform_module() call?
transform_module() calls 3 function(s): client_module, get_source_name, server_module.
What calls transform_module()?
transform_module() is called by 1 function(s): compileModule.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free