put path on analysis.elements instead of metadata

pull/14395/head
Rich Harris 1 month ago
parent 8f02f1e8e4
commit c0c7ab8bd1

@ -151,8 +151,7 @@ export default function element(parser) {
svg: false, svg: false,
mathml: false, mathml: false,
scoped: false, scoped: false,
has_spread: false, has_spread: false
path: []
}, },
parent: null parent: null
} }

@ -724,7 +724,7 @@ export function analyze_component(root, source, options) {
warn_unused(analysis.css.ast); warn_unused(analysis.css.ast);
} }
outer: for (const { node } of analysis.elements) { outer: for (const { node, path } of analysis.elements) {
if (node.type === 'RenderTag') continue; if (node.type === 'RenderTag') continue;
if (node.metadata.scoped) { if (node.metadata.scoped) {
@ -780,8 +780,9 @@ export function analyze_component(root, source, options) {
} }
]) ])
); );
if (is_custom_element_node(node) && node.attributes.length === 1) { if (is_custom_element_node(node) && node.attributes.length === 1) {
mark_subtree_dynamic(node.metadata.path); mark_subtree_dynamic(path);
} }
} }
} }

@ -22,9 +22,7 @@ export function RegularElement(node, context) {
check_element(node, context); check_element(node, context);
node.metadata.path = [...context.path]; context.state.analysis.elements.push({ node, path: [...context.path] });
context.state.analysis.elements.push({ node, path: context.path });
// Special case: Move the children of <textarea> into a value attribute if they are dynamic // Special case: Move the children of <textarea> into a value attribute if they are dynamic
if (node.name === 'textarea' && node.fragment.nodes.length > 0) { if (node.name === 'textarea' && node.fragment.nodes.length > 0) {

@ -303,7 +303,6 @@ export namespace AST {
/** `true` if contains a SpreadAttribute */ /** `true` if contains a SpreadAttribute */
has_spread: boolean; has_spread: boolean;
scoped: boolean; scoped: boolean;
path: SvelteNode[];
}; };
} }

Loading…
Cancel
Save