get_node_range() — svelte Function Reference
Architecture documentation for the get_node_range() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 7b7a865f_d980_e5dd_7be6_9dbf5e90264f["get_node_range()"] cab41022_1b55_3b7a_06c6_b90763bbea47["index.js"] 7b7a865f_d980_e5dd_7be6_9dbf5e90264f -->|defined in| cab41022_1b55_3b7a_06c6_b90763bbea47 ffed8565_a534_8183_a11f_bcffae15897e["migrate()"] ffed8565_a534_8183_a11f_bcffae15897e -->|calls| 7b7a865f_d980_e5dd_7be6_9dbf5e90264f style 7b7a865f_d980_e5dd_7be6_9dbf5e90264f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/migrate/index.js lines 1820–1843
function get_node_range(source, node) {
const first_leading_comment = node.leadingComments?.[0];
const last_trailing_comment = node.trailingComments?.[node.trailingComments.length - 1];
// @ts-expect-error the type of `Comment` seems to be wrong...the node actually contains
// start and end but the type seems to only contain a `range` (which doesn't actually exists)
let start = /** @type {number} */ (first_leading_comment?.start ?? node.start);
// @ts-expect-error the type of `Comment` seems to be wrong...the node actually contains
// start and end but the type seems to only contain a `range` (which doesn't actually exists)
let end = /** @type {number} */ (last_trailing_comment?.end ?? node.end);
let idx = start;
while (source[idx - 1] !== '\n' && source[idx - 1] !== '\r') {
idx--;
if (source[idx] !== ' ' && source[idx] !== '\t') {
idx = start;
break;
}
}
start = idx;
return { start, end };
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does get_node_range() do?
get_node_range() is a function in the svelte codebase, defined in packages/svelte/src/compiler/migrate/index.js.
Where is get_node_range() defined?
get_node_range() is defined in packages/svelte/src/compiler/migrate/index.js at line 1820.
What calls get_node_range()?
get_node_range() is called by 1 function(s): migrate.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free