instance_script.ImportDeclaration() — svelte Function Reference
Architecture documentation for the instance_script.ImportDeclaration() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 6287713e_bbf0_a142_26ad_837d3f81d477["instance_script.ImportDeclaration()"] cab41022_1b55_3b7a_06c6_b90763bbea47["index.js"] 6287713e_bbf0_a142_26ad_837d3f81d477 -->|defined in| cab41022_1b55_3b7a_06c6_b90763bbea47 627dc2f8_4dbc_5bb1_8f54_cee503e17098["get()"] 6287713e_bbf0_a142_26ad_837d3f81d477 -->|calls| 627dc2f8_4dbc_5bb1_8f54_cee503e17098 style 6287713e_bbf0_a142_26ad_837d3f81d477 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/migrate/index.js lines 504–541
ImportDeclaration(node, { state }) {
state.props_insertion_point = node.end ?? state.props_insertion_point;
if (node.source.value === 'svelte') {
let illegal_specifiers = [];
let removed_specifiers = 0;
for (let specifier of node.specifiers) {
if (
specifier.type === 'ImportSpecifier' &&
specifier.imported.type === 'Identifier' &&
['beforeUpdate', 'afterUpdate'].includes(specifier.imported.name)
) {
const references = state.scope.references.get(specifier.local.name);
if (!references) {
let end = /** @type {number} */ (
state.str.original.indexOf(',', specifier.end) !== -1 &&
state.str.original.indexOf(',', specifier.end) <
state.str.original.indexOf('}', specifier.end)
? state.str.original.indexOf(',', specifier.end) + 1
: specifier.end
);
while (state.str.original[end].trim() === '') end++;
state.str.remove(/** @type {number} */ (specifier.start), end);
removed_specifiers++;
continue;
}
illegal_specifiers.push(specifier.imported.name);
}
}
if (removed_specifiers === node.specifiers.length) {
state.str.remove(/** @type {number} */ (node.start), /** @type {number} */ (node.end));
}
if (illegal_specifiers.length > 0) {
throw new MigrationError(
`Can't migrate code with ${illegal_specifiers.join(' and ')}. Please migrate by hand.`
);
}
}
},
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does instance_script.ImportDeclaration() do?
instance_script.ImportDeclaration() is a function in the svelte codebase, defined in packages/svelte/src/compiler/migrate/index.js.
Where is instance_script.ImportDeclaration() defined?
instance_script.ImportDeclaration() is defined in packages/svelte/src/compiler/migrate/index.js at line 504.
What does instance_script.ImportDeclaration() call?
instance_script.ImportDeclaration() calls 1 function(s): get.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free