Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
1fa3c412
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1fa3c412
编写于
10月 27, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(ssr): add tranform
上级
f338a300
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
57 addition
and
38 deletion
+57
-38
packages/uni-cli-shared/src/index.ts
packages/uni-cli-shared/src/index.ts
+2
-0
packages/uni-cli-shared/src/mp/template.ts
packages/uni-cli-shared/src/mp/template.ts
+1
-38
packages/uni-cli-shared/src/vue/transforms/index.ts
packages/uni-cli-shared/src/vue/transforms/index.ts
+2
-0
packages/uni-cli-shared/src/vue/transforms/transformComponent.ts
...s/uni-cli-shared/src/vue/transforms/transformComponent.ts
+38
-0
packages/uni-cli-shared/src/vue/transforms/transformPageHead.ts
...es/uni-cli-shared/src/vue/transforms/transformPageHead.ts
+5
-0
packages/uni-h5-vite/src/plugin/index.ts
packages/uni-h5-vite/src/plugin/index.ts
+2
-0
packages/uni-h5-vite/src/plugin/transforms/transformPageHead.ts
...es/uni-h5-vite/src/plugin/transforms/transformPageHead.ts
+7
-0
未找到文件。
packages/uni-cli-shared/src/index.ts
浏览文件 @
1fa3c412
...
...
@@ -15,6 +15,8 @@ export * from './preprocess'
export
*
from
'
./postcss
'
export
*
from
'
./filter
'
export
*
from
'
./esbuild
'
export
*
from
'
./vue/transforms
'
export
{
M
}
from
'
./messages
'
export
*
from
'
./exports
'
...
...
packages/uni-cli-shared/src/mp/template.ts
浏览文件 @
1fa3c412
import
path
from
'
path
'
import
{
EmittedAsset
}
from
'
rollup
'
import
{
isComponentTag
,
LINEFEED
}
from
'
@dcloudio/uni-shared
'
import
{
createSimpleExpression
,
ElementTypes
,
isCoreComponent
,
locStub
,
NodeTypes
,
RootNode
,
TemplateChildNode
,
TransformContext
,
}
from
'
@vue/compiler-core
'
import
{
LINEFEED
}
from
'
@dcloudio/uni-shared
'
import
{
normalizeMiniProgramFilename
}
from
'
../utils
'
export
interface
MiniProgramCompilerOptions
{
...
...
@@ -110,30 +100,3 @@ export function addMiniProgramTemplateFilter(
templateFiltersCache
.
set
(
filename
,
[
filter
])
}
}
export
function
addComponentBindLink
(
node
:
RootNode
|
TemplateChildNode
,
context
:
TransformContext
)
{
if
(
node
.
type
===
NodeTypes
.
ELEMENT
&&
node
.
tagType
===
ElementTypes
.
COMPONENT
)
{
const
{
tag
}
=
node
if
(
isComponentTag
(
tag
)
||
isCoreComponent
(
tag
)
||
context
.
isBuiltInComponent
(
tag
)
)
{
return
}
node
.
props
.
push
({
type
:
NodeTypes
.
DIRECTIVE
,
name
:
'
on
'
,
modifiers
:
[],
loc
:
locStub
,
arg
:
createSimpleExpression
(
'
__l
'
,
true
),
exp
:
createSimpleExpression
(
'
__l
'
,
true
),
})
}
}
packages/uni-cli-shared/src/vue/transforms/index.ts
0 → 100644
浏览文件 @
1fa3c412
export
*
from
'
./transformComponent
'
export
*
from
'
./transformPageHead
'
packages/uni-cli-shared/src/vue/transforms/transformComponent.ts
0 → 100644
浏览文件 @
1fa3c412
import
{
isComponentTag
}
from
'
@dcloudio/uni-shared
'
import
{
createSimpleExpression
,
ElementTypes
,
isCoreComponent
,
locStub
,
NodeTypes
,
RootNode
,
TemplateChildNode
,
TransformContext
,
}
from
'
@vue/compiler-core
'
export
function
addComponentBindLink
(
node
:
RootNode
|
TemplateChildNode
,
context
:
TransformContext
)
{
if
(
node
.
type
===
NodeTypes
.
ELEMENT
&&
node
.
tagType
===
ElementTypes
.
COMPONENT
)
{
const
{
tag
}
=
node
if
(
isComponentTag
(
tag
)
||
isCoreComponent
(
tag
)
||
context
.
isBuiltInComponent
(
tag
)
)
{
return
}
node
.
props
.
push
({
type
:
NodeTypes
.
DIRECTIVE
,
name
:
'
on
'
,
modifiers
:
[],
loc
:
locStub
,
arg
:
createSimpleExpression
(
'
__l
'
,
true
),
exp
:
createSimpleExpression
(
'
__l
'
,
true
),
})
}
}
packages/uni-cli-shared/src/vue/transforms/transformPageHead.ts
0 → 100644
浏览文件 @
1fa3c412
import
{
NodeTransform
}
from
'
@vue/compiler-core
'
export
const
transformPageHead
:
NodeTransform
=
(
_node
,
_context
)
=>
{
// 发现是page-meta下的page-head,直接remove该节点
}
packages/uni-h5-vite/src/plugin/index.ts
浏览文件 @
1fa3c412
...
...
@@ -13,6 +13,7 @@ import { isSsr } from '../utils'
import
{
esbuildPrePlugin
}
from
'
./esbuild/esbuildPrePlugin
'
import
{
external
}
from
'
./configureServer/ssr
'
import
{
createConfigureServer
}
from
'
./configureServer
'
import
{
transformPageHead
}
from
'
./transforms/transformPageHead
'
export
const
UniH5Plugin
:
UniVitePlugin
=
{
name
:
'
vite:uni-h5
'
,
...
...
@@ -26,6 +27,7 @@ export const UniH5Plugin: UniVitePlugin = {
compilerOptions
:
{
isNativeTag
:
isH5NativeTag
,
isCustomElement
:
isH5CustomElement
,
nodeTransforms
:
[
transformPageHead
],
},
},
config
(
config
,
env
)
{
...
...
packages/uni-h5-vite/src/plugin/transforms/transformPageHead.ts
0 → 100644
浏览文件 @
1fa3c412
import
{
NodeTransform
}
from
'
@vue/compiler-core
'
export
const
transformPageHead
:
NodeTransform
=
(
node
,
context
)
=>
{
if
(
!
context
.
ssr
)
{
return
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录