message:`${this.name.name} has unused export property '${name}'. If it is for external reference only, please consider using \`export const '${name}'\``
});
}
});
});
});
});
}else{
}else{
@ -492,18 +490,24 @@ export default class Component {
message:`${this.name.name} has unused export property '${specifier.exported.name}'. If it is for external reference only, please consider using \`export const '${specifier.exported.name}'\``
});
}
}
}
});
});
content.body.splice(i,1);
returnnull;
}
}
}
}
}
}
}
@ -522,7 +526,7 @@ export default class Component {
});
});
}
}
walk_module_js() {
walk_module_js_pre_template() {
constcomponent=this;
constcomponent=this;
constscript=this.ast.module;
constscript=this.ast.module;
if(!script)return;
if(!script)return;
@ -573,9 +577,6 @@ export default class Component {
});
});
}
}
});
});
this.extract_imports(script.content);
this.extract_exports(script.content);
}
}
walk_instance_js_pre_template() {
walk_instance_js_pre_template() {
@ -657,7 +658,10 @@ export default class Component {
this.add_reference(name.slice(1));
this.add_reference(name.slice(1));
constvariable=this.var_lookup.get(name.slice(1));
constvariable=this.var_lookup.get(name.slice(1));
if(variable)variable.subscribable=true;
if(variable){
variable.subscribable=true;
variable.referenced_from_script=true;
}
}else{
}else{
this.add_var({
this.add_var({
name,
name,
@ -667,29 +671,115 @@ export default class Component {
}
}
});
});
this.extract_imports(script.content);
this.track_references_and_mutations();
this.extract_exports(script.content);
}
this.track_mutations();
walk_module_js_post_template() {
constscript=this.ast.module;
if(!script)return;
const{body}=script.content;
leti=body.length;
while(--i>=0){
constnode=body[i];
if(node.type==='ImportDeclaration'){
this.extract_imports(node);
body.splice(i,1);
}
if(/^Export/.test(node.type)){
constreplacement=this.extract_exports(node);
if(replacement){
body[i]=replacement;
}else{
body.splice(i,1);
}
}
}
}
}
walk_instance_js_post_template() {
walk_instance_js_post_template() {
constscript=this.ast.instance;
constscript=this.ast.instance;
if(!script)return;
if(!script)return;
this.warn_on_undefined_store_value_references();
this.post_template_walk();
this.hoist_instance_declarations();
this.hoist_instance_declarations();
this.extract_reactive_declarations();
this.extract_reactive_declarations();
}
}
// TODO merge this with other walks that are independent