/
githubmirror
/
taro
Обзор
Документация
Войти
/
githubmirror
/
taro
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/babel-plugin-transform-solid-jsx/src/shared/postprocess.js
27 строк
1 KB
phy-lei
feat: [4.x]完成solid-componets-library 和 babel-plugin-transform-solid-jsx 两个包的开发 (#15539)
03 июн 2024, 18:40
Не верифицирован
03 июн 2024, 18:40
c768863
Код
Авторство
О чём код?
import * as t from '@babel/types' import { appendTemplates as appendTemplatesDOM } from '../dom/template' import { appendTemplates as appendTemplatesSSR } from '../ssr/template' import { getRendererConfig, getTaroComponentsMap, registerImportMethod } from './utils' // add to the top/bottom of the module. export default (path) => { if (path.scope.data.events) { path.node.body.push( t.expressionStatement( t.callExpression(registerImportMethod(path, 'delegateEvents', getRendererConfig(path, 'dom').moduleName), [ t.arrayExpression(Array.from(path.scope.data.events).map((e) => t.stringLiteral(e))), ]) ) ) } if (path.scope.data.templates?.length) { const domTemplates = path.scope.data.templates.filter((temp) => temp.renderer === 'dom') const ssrTemplates = path.scope.data.templates.filter((temp) => temp.renderer === 'ssr') domTemplates.length > 0 && appendTemplatesDOM(path, domTemplates) ssrTemplates.length > 0 && appendTemplatesSSR(path, ssrTemplates) } const taroComponentsMap = getTaroComponentsMap(path) taroComponentsMap.clear() }