|
|
|
@ -203,9 +203,9 @@ function js(script, root, allow_reactive_declarations, parent) {
|
|
|
|
|
body: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const { scope, scopes } = create_scopes(ast, root, allow_reactive_declarations, parent);
|
|
|
|
|
const { scope, scopes, is_async } = create_scopes(ast, root, allow_reactive_declarations, parent);
|
|
|
|
|
|
|
|
|
|
return { ast, scope, scopes };
|
|
|
|
|
return { ast, scope, scopes, is_async };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -230,7 +230,7 @@ const RESERVED = ['$$props', '$$restProps', '$$slots'];
|
|
|
|
|
* @returns {Analysis}
|
|
|
|
|
*/
|
|
|
|
|
export function analyze_module(ast, options) {
|
|
|
|
|
const { scope, scopes } = create_scopes(ast, new ScopeRoot(), false, null);
|
|
|
|
|
const { scope, scopes, is_async } = create_scopes(ast, new ScopeRoot(), false, null);
|
|
|
|
|
|
|
|
|
|
for (const [name, references] of scope.references) {
|
|
|
|
|
if (name[0] !== '$' || RESERVED.includes(name)) continue;
|
|
|
|
@ -259,7 +259,7 @@ export function analyze_module(ast, options) {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
module: { ast, scope, scopes },
|
|
|
|
|
module: { ast, scope, scopes, is_async },
|
|
|
|
|
name: options.filename,
|
|
|
|
|
accessors: false,
|
|
|
|
|
runes: true,
|
|
|
|
@ -282,7 +282,12 @@ export function analyze_component(root, source, options) {
|
|
|
|
|
const module = js(root.module, scope_root, false, null);
|
|
|
|
|
const instance = js(root.instance, scope_root, true, module.scope);
|
|
|
|
|
|
|
|
|
|
const { scope, scopes } = create_scopes(root.fragment, scope_root, false, instance.scope);
|
|
|
|
|
const { scope, scopes, is_async } = create_scopes(
|
|
|
|
|
root.fragment,
|
|
|
|
|
scope_root,
|
|
|
|
|
false,
|
|
|
|
|
instance.scope
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/** @type {Template} */
|
|
|
|
|
const template = { ast: root.fragment, scope, scopes };
|
|
|
|
@ -390,7 +395,9 @@ export function analyze_component(root, source, options) {
|
|
|
|
|
|
|
|
|
|
const component_name = get_component_name(options.filename);
|
|
|
|
|
|
|
|
|
|
const runes = options.runes ?? Array.from(module.scope.references.keys()).some(is_rune);
|
|
|
|
|
const runes =
|
|
|
|
|
options.runes ??
|
|
|
|
|
(is_async || instance.is_async || Array.from(module.scope.references.keys()).some(is_rune));
|
|
|
|
|
|
|
|
|
|
if (!runes) {
|
|
|
|
|
for (let check of synthetic_stores_legacy_check) {
|
|
|
|
|