|
|
|
@ -1,13 +1,13 @@
|
|
|
|
/** @import { Expression, Statement } from 'estree' */
|
|
|
|
/** @import { Expression, Statement } from 'estree' */
|
|
|
|
/** @import { AST } from '#compiler' */
|
|
|
|
/** @import { AST } from '#compiler' */
|
|
|
|
/** @import { ComponentClientTransformState, ComponentContext } from '../types' */
|
|
|
|
/** @import { ComponentClientTransformState, ComponentContext } from '../types' */
|
|
|
|
import { TEMPLATE_FRAGMENT, TEMPLATE_USE_IMPORT_NODE } from '../../../../../constants.js';
|
|
|
|
|
|
|
|
import * as b from '#compiler/builders';
|
|
|
|
import * as b from '#compiler/builders';
|
|
|
|
|
|
|
|
import { TEMPLATE_FRAGMENT, TEMPLATE_USE_IMPORT_NODE } from '../../../../../constants.js';
|
|
|
|
import { clean_nodes, infer_namespace } from '../../utils.js';
|
|
|
|
import { clean_nodes, infer_namespace } from '../../utils.js';
|
|
|
|
import { transform_template } from '../transform-template/index.js';
|
|
|
|
import { transform_template } from '../transform-template/index.js';
|
|
|
|
|
|
|
|
import { Template } from '../transform-template/template.js';
|
|
|
|
import { process_children } from './shared/fragment.js';
|
|
|
|
import { process_children } from './shared/fragment.js';
|
|
|
|
import { build_render_statement, Memoizer } from './shared/utils.js';
|
|
|
|
import { build_render_statement, Memoizer } from './shared/utils.js';
|
|
|
|
import { Template } from '../transform-template/template.js';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param {AST.Fragment} node
|
|
|
|
* @param {AST.Fragment} node
|
|
|
|
@ -60,6 +60,7 @@ export function Fragment(node, context) {
|
|
|
|
const state = {
|
|
|
|
const state = {
|
|
|
|
...context.state,
|
|
|
|
...context.state,
|
|
|
|
init: [],
|
|
|
|
init: [],
|
|
|
|
|
|
|
|
snippets: [],
|
|
|
|
consts: [],
|
|
|
|
consts: [],
|
|
|
|
let_directives: [],
|
|
|
|
let_directives: [],
|
|
|
|
update: [],
|
|
|
|
update: [],
|
|
|
|
@ -150,7 +151,7 @@ export function Fragment(node, context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
body.push(...state.let_directives, ...state.consts);
|
|
|
|
body.push(...state.snippets, ...state.let_directives, ...state.consts);
|
|
|
|
|
|
|
|
|
|
|
|
if (state.async_consts && state.async_consts.thunks.length > 0) {
|
|
|
|
if (state.async_consts && state.async_consts.thunks.length > 0) {
|
|
|
|
body.push(b.var(state.async_consts.id, b.call('$.run', b.array(state.async_consts.thunks))));
|
|
|
|
body.push(b.var(state.async_consts.id, b.call('$.run', b.array(state.async_consts.thunks))));
|
|
|
|
|