Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzb_79
uni-app
提交
9b23e528
U
uni-app
项目概览
lzb_79
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9b23e528
编写于
1月 22, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(cli): transform App.vue
上级
dbc1bc9d
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
62 addition
and
34 deletion
+62
-34
packages/uni-cli-shared/src/index.ts
packages/uni-cli-shared/src/index.ts
+1
-4
packages/uni-cli-shared/src/transforms/transformBuiltInEasycom.ts
.../uni-cli-shared/src/transforms/transformBuiltInEasycom.ts
+0
-11
packages/uni-cli-shared/src/vue/index.ts
packages/uni-cli-shared/src/vue/index.ts
+4
-5
packages/uni-cli-shared/src/vue/transforms/builtInComponent.ts
...ges/uni-cli-shared/src/vue/transforms/builtInComponent.ts
+4
-1
packages/uni-cli-shared/src/vue/transforms/easycom.ts
packages/uni-cli-shared/src/vue/transforms/easycom.ts
+10
-1
packages/uni-h5/package.json
packages/uni-h5/package.json
+2
-1
packages/uni-h5/src/framework/components/app/index.vue
packages/uni-h5/src/framework/components/app/index.vue
+0
-10
packages/uni-h5/style/base.css
packages/uni-h5/style/base.css
+9
-0
packages/vite-plugin-uni/src/env.ts
packages/vite-plugin-uni/src/env.ts
+7
-0
packages/vite-plugin-uni/src/index.ts
packages/vite-plugin-uni/src/index.ts
+2
-0
packages/vite-plugin-uni/src/load/app.ts
packages/vite-plugin-uni/src/load/app.ts
+21
-0
packages/vite-plugin-uni/src/load/index.ts
packages/vite-plugin-uni/src/load/index.ts
+2
-1
未找到文件。
packages/uni-cli-shared/src/index.ts
浏览文件 @
9b23e528
export
*
from
'
./vue
'
export
*
from
'
./json
'
export
*
from
'
./easycom/index
'
export
*
from
'
./vueCompilerOptions
'
export
*
from
'
./preprocess/index
'
export
*
from
'
./transforms/transformBuiltInComponent
'
export
*
from
'
./transforms/transformBuiltInEasycom
'
export
*
from
'
./transforms/transformEasycom
'
packages/uni-cli-shared/src/transforms/transformBuiltInEasycom.ts
已删除
100644 → 0
浏览文件 @
dbc1bc9d
import
{
NodeTransform
}
from
'
@vue/compiler-core
'
import
{
isComponentNode
}
from
'
../easycom/index
'
export
const
transformBuiltInEasycom
:
NodeTransform
=
(
node
)
=>
{
if
(
!
isComponentNode
(
node
))
{
return
}
if
(
node
.
tag
===
'
match-media
'
&&
process
.
env
.
UNI_PLATFORM
!==
'
mp-weixin
'
)
{
node
.
tag
=
'
uni-match-media
'
}
}
packages/uni-cli-shared/src/vue
CompilerOptions
.ts
→
packages/uni-cli-shared/src/vue
/index
.ts
浏览文件 @
9b23e528
...
...
@@ -2,14 +2,13 @@ import { CompilerOptions } from '@vue/compiler-sfc'
import
{
COMPONENT_PREFIX
,
isBuiltInComponent
,
isNativeTag
,
isBuiltInComponent
,
}
from
'
@dcloudio/uni-shared
'
import
{
transformBuiltInComponent
}
from
'
./transforms/transformBuiltInComponent
'
import
{
transformBuiltInEasycom
}
from
'
./transforms/transformBuiltInEasycom
'
import
{
transformEasycom
}
from
'
./transforms/transformEasycom
'
import
{
isEasycomTag
}
from
'
./easycom
'
import
{
isEasycomTag
}
from
'
../easycom
'
import
{
transformEasycom
,
transformBuiltInEasycom
}
from
'
./transforms/easycom
'
import
{
transformBuiltInComponent
}
from
'
./transforms/builtInComponent
'
interface
CodegenContext
{
push
:
(
code
:
string
,
node
:
any
)
=>
void
...
...
packages/uni-cli-shared/src/
transforms/transformB
uiltInComponent.ts
→
packages/uni-cli-shared/src/
vue/transforms/b
uiltInComponent.ts
浏览文件 @
9b23e528
...
...
@@ -10,7 +10,7 @@ import {
import
{
COMPONENT_PREFIX
,
isBuiltInComponent
}
from
'
@dcloudio/uni-shared
'
import
{
addAutoImport
,
isComponentNode
}
from
'
../easycom
'
import
{
addAutoImport
,
isComponentNode
}
from
'
../
../
easycom
'
const
COMPONENTS_PATH
=
'
@dcloudio/uni-h5/dist/uni-h5.esm.js
'
...
...
@@ -44,6 +44,9 @@ function createStyleImportItem(oldTag: string, node: ElementNode) {
}
export
const
transformBuiltInComponent
:
NodeTransform
=
(
node
,
context
)
=>
{
if
(
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
)
{
return
}
if
(
!
isComponentNode
(
node
))
{
return
}
...
...
packages/uni-cli-shared/src/
transforms/transformE
asycom.ts
→
packages/uni-cli-shared/src/
vue/transforms/e
asycom.ts
浏览文件 @
9b23e528
...
...
@@ -16,7 +16,7 @@ import {
matchEasycom
,
addAutoImport
,
isComponentNode
,
}
from
'
../easycom
'
}
from
'
../
../
easycom
'
function
createImportItem
(
path
:
string
,
node
:
ComponentNode
)
{
const
tag
=
node
.
tag
...
...
@@ -69,3 +69,12 @@ export const transformEasycom: NodeTransform = (node, context) => {
addAutoImport
(
createImportItem
(
path
,
node
),
context
)
}
}
export
const
transformBuiltInEasycom
:
NodeTransform
=
(
node
)
=>
{
if
(
!
isComponentNode
(
node
))
{
return
}
if
(
node
.
tag
===
'
match-media
'
&&
process
.
env
.
UNI_PLATFORM
!==
'
mp-weixin
'
)
{
node
.
tag
=
'
uni-match-media
'
}
}
packages/uni-h5/package.json
浏览文件 @
9b23e528
...
...
@@ -5,7 +5,8 @@
"main"
:
"dist/uni-h5.esm.js"
,
"module"
:
"dist/uni-h5.esm.js"
,
"files"
:
[
"dist"
"dist"
,
"style"
],
"sideEffects"
:
[
"dist/uni-h5.css"
...
...
packages/uni-h5/src/framework/components/app/index.vue
浏览文件 @
9b23e528
...
...
@@ -132,13 +132,3 @@ export default {
}
}
</
script
>
<
style
>
@import
url('./index.css')
;
uni-app
{
display
:
block
;
box-sizing
:
border-box
;
width
:
100%
;
height
:
100%
;
}
</
style
>
packages/uni-h5/style/base.css
浏览文件 @
9b23e528
...
...
@@ -177,3 +177,12 @@ uni-page {
[
nvue
]
uni-swiper-item
{
position
:
absolute
;
}
uni-app
{
display
:
block
;
box-sizing
:
border-box
;
width
:
100%
;
height
:
100%
;
}
\ No newline at end of file
packages/vite-plugin-uni/src/env.ts
0 → 100644
浏览文件 @
9b23e528
import
{
VitePluginUniResolvedOptions
}
from
'
.
'
const
defaultPlatform
=
'
h5
'
export
function
initEnv
(
_options
:
VitePluginUniResolvedOptions
)
{
process
.
env
.
UNI_PLATFORM
=
process
.
env
.
UNI_PLATFORM
||
defaultPlatform
}
packages/vite-plugin-uni/src/index.ts
浏览文件 @
9b23e528
...
...
@@ -2,6 +2,7 @@ import path from 'path'
import
{
Plugin
,
ViteDevServer
}
from
'
vite
'
import
{
initEnv
}
from
'
./env
'
import
{
createLoad
}
from
'
./load
'
import
{
createConfig
}
from
'
./config
'
import
{
createResolveId
}
from
'
./resolveId
'
...
...
@@ -28,6 +29,7 @@ export default function uniPlugin(
root
:
process
.
cwd
(),
inputDir
:
rawOptions
.
inputDir
||
path
.
resolve
(
process
.
cwd
(),
'
src
'
),
}
initEnv
(
options
)
return
{
name
:
'
vite:uni
'
,
config
:
createConfig
(
options
),
...
...
packages/vite-plugin-uni/src/load/app.ts
0 → 100644
浏览文件 @
9b23e528
import
fs
from
'
fs
'
import
path
from
'
path
'
import
slash
from
'
slash
'
import
{
VitePluginUniResolvedOptions
}
from
'
..
'
let
appVuePath
:
string
export
const
app
=
{
test
(
id
:
string
,
inputDir
:
string
)
{
if
(
!
appVuePath
)
{
appVuePath
=
slash
(
path
.
resolve
(
inputDir
,
'
App.vue
'
))
}
return
id
===
appVuePath
},
load
(
filename
:
string
,
_options
:
VitePluginUniResolvedOptions
)
{
// TODO 等待plugin-vue修复node_modules中资源引用失败的Bug
// <style src="@dcloudio/uni-h5/style/base.css"/>
return
`<template><VUniApp/></template>
${
fs
.
readFileSync
(
filename
,
'
utf-8
'
)
.
toString
()}
`
},
}
packages/vite-plugin-uni/src/load/index.ts
浏览文件 @
9b23e528
...
...
@@ -2,12 +2,13 @@ import debug from 'debug'
import
{
Plugin
}
from
'
vite
'
import
{
VitePluginUniResolvedOptions
}
from
'
..
'
import
{
app
}
from
'
./app
'
import
{
main
}
from
'
./main
'
import
{
pages
}
from
'
./pages
'
const
debugLoad
=
debug
(
'
uni:load
'
)
const
loads
=
[
main
,
pages
]
const
loads
=
[
app
,
main
,
pages
]
export
function
createLoad
(
options
:
VitePluginUniResolvedOptions
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录