Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
a0618b9e
U
uni-app
项目概览
qianlong66
/
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,发现更多精彩内容 >>
提交
a0618b9e
编写于
1月 24, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): nvue styler
上级
dbadb37a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
44 addition
and
25 deletion
+44
-25
packages/uni-app-vite/package.json
packages/uni-app-vite/package.json
+1
-0
packages/uni-app-vite/src/nvue/plugin/index.ts
packages/uni-app-vite/src/nvue/plugin/index.ts
+11
-4
packages/uni-app-vite/src/nvue/plugins/esbuild.ts
packages/uni-app-vite/src/nvue/plugins/esbuild.ts
+4
-6
packages/uni-app-vite/src/plugin/configResolved.ts
packages/uni-app-vite/src/plugin/configResolved.ts
+1
-1
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
...ges/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
+4
-1
packages/uni-cli-shared/src/vite/utils/plugin.ts
packages/uni-cli-shared/src/vite/utils/plugin.ts
+4
-1
packages/uni-nvue-styler/__tests__/normalize.spec.ts
packages/uni-nvue-styler/__tests__/normalize.spec.ts
+3
-3
packages/uni-nvue-styler/__tests__/objectifier.spec.ts
packages/uni-nvue-styler/__tests__/objectifier.spec.ts
+3
-3
packages/uni-nvue-styler/src/parse.ts
packages/uni-nvue-styler/src/parse.ts
+11
-6
pnpm-lock.yaml
pnpm-lock.yaml
+2
-0
未找到文件。
packages/uni-app-vite/package.json
浏览文件 @
a0618b9e
...
...
@@ -21,6 +21,7 @@
"dependencies"
:
{
"@dcloudio/uni-cli-shared"
:
"3.0.0-alpha-3030820220114006"
,
"@dcloudio/uni-i18n"
:
"3.0.0-alpha-3030820220114006"
,
"@dcloudio/uni-nvue-styler"
:
"workspace:*"
,
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3030820220114006"
,
"@rollup/pluginutils"
:
"^4.1.2"
,
"@vitejs/plugin-vue"
:
"^2.0.1"
,
...
...
packages/uni-app-vite/src/nvue/plugin/index.ts
浏览文件 @
a0618b9e
import
type
{
PreRenderedChunk
}
from
'
rollup
'
import
type
{
Plugin
}
from
'
vite
'
import
path
from
'
path
'
import
{
createTransformTag
,
...
...
@@ -8,8 +10,7 @@ import {
removeExt
,
resolveMainPathOnce
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
PreRenderedChunk
}
from
'
rollup
'
import
{
Plugin
}
from
'
vite
'
import
{
parse
}
from
'
@dcloudio/uni-nvue-styler
'
import
{
nvueOutDir
}
from
'
../../utils
'
import
{
transformRenderWhole
}
from
'
./transforms/transformRenderWhole
'
import
{
transformAppendAsTree
}
from
'
./transforms/transformAppendAsTree
'
...
...
@@ -83,8 +84,14 @@ export function uniAppNVuePlugin(): Plugin {
return
normalizeCssChunkFilename
(
id
)
}
},
chunkCssCode
(
_
,
cssCode
)
{
return
'
export default {}
'
async
chunkCssCode
(
filename
,
cssCode
)
{
const
{
code
,
messages
}
=
await
parse
(
cssCode
,
{
filename
})
messages
.
forEach
((
msg
)
=>
{
if
(
msg
.
type
===
'
warning
'
||
msg
.
type
===
'
error
'
)
{
console
.
warn
(
msg
.
text
)
}
})
return
`export default
${
code
}
`
},
}),
}
...
...
packages/uni-app-vite/src/nvue/plugins/esbuild.ts
浏览文件 @
a0618b9e
...
...
@@ -38,13 +38,11 @@ export function uniEsbuildPlugin(): Plugin {
}
})
debugEsbuild
(
'
start
'
,
entryPoints
.
length
,
entryPoints
)
await
Promise
.
all
(
entryPoints
.
map
((
filename
)
=>
{
return
buildNVuePage
(
filename
,
buildOptions
).
then
((
code
)
=>
{
return
fs
.
outputFile
(
path
.
resolve
(
outputDir
,
filename
),
code
)
})
for
(
const
filename
of
entryPoints
)
{
await
buildNVuePage
(
filename
,
buildOptions
).
then
((
code
)
=>
{
return
fs
.
outputFile
(
path
.
resolve
(
outputDir
,
filename
),
code
)
})
)
}
debugEsbuild
(
'
end
'
)
},
}
...
...
packages/uni-app-vite/src/plugin/configResolved.ts
浏览文件 @
a0618b9e
...
...
@@ -8,7 +8,7 @@ import {
export
function
createConfigResolved
(
options
:
{
chunkCssFilename
:
(
id
:
string
)
=>
string
|
void
chunkCssCode
:
(
filename
:
string
,
cssCode
:
string
)
=>
string
chunkCssCode
:
(
filename
:
string
,
cssCode
:
string
)
=>
string
|
Promise
<
string
>
}):
Plugin
[
'
configResolved
'
]
{
return
(
config
)
=>
{
injectCssPlugin
(
config
)
...
...
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
浏览文件 @
a0618b9e
...
...
@@ -220,7 +220,10 @@ export function cssPostPlugin(
chunkCssCode
,
}:
{
chunkCssFilename
:
(
id
:
string
)
=>
string
|
void
chunkCssCode
:
(
filename
:
string
,
cssCode
:
string
)
=>
string
chunkCssCode
:
(
filename
:
string
,
cssCode
:
string
)
=>
Promise
<
string
>
|
string
}
):
Plugin
{
// styles initialization in buildStart causes a styling loss in watch
...
...
packages/uni-cli-shared/src/vite/utils/plugin.ts
浏览文件 @
a0618b9e
...
...
@@ -26,7 +26,10 @@ export function injectCssPostPlugin(
chunkCssCode
,
}:
{
chunkCssFilename
:
(
id
:
string
)
=>
string
|
void
chunkCssCode
:
(
filename
:
string
,
cssCode
:
string
)
=>
string
chunkCssCode
:
(
filename
:
string
,
cssCode
:
string
)
=>
string
|
Promise
<
string
>
}
)
{
const
newCssPostPlugin
=
cssPostPlugin
(
config
,
{
...
...
packages/uni-nvue-styler/__tests__/normalize.spec.ts
浏览文件 @
a0618b9e
import
{
objectifier
,
parse
}
from
'
../src
'
import
{
parse
}
from
'
../src
'
async
function
objectifierRule
(
input
:
string
)
{
const
{
root
,
messages
}
=
await
parse
(
input
,
{
logLevel
:
'
NOTE
'
})
const
{
code
,
messages
}
=
await
parse
(
input
,
{
logLevel
:
'
NOTE
'
})
return
{
json
:
objectifier
(
root
),
json
:
JSON
.
parse
(
code
),
messages
,
}
}
...
...
packages/uni-nvue-styler/__tests__/objectifier.spec.ts
浏览文件 @
a0618b9e
import
{
objectifier
,
parse
}
from
'
../src
'
import
{
parse
}
from
'
../src
'
async
function
objectifierRoot
(
input
:
string
)
{
const
{
root
,
messages
}
=
await
parse
(
input
,
{
logLevel
:
'
NOTE
'
})
const
{
code
,
messages
}
=
await
parse
(
input
,
{
logLevel
:
'
NOTE
'
})
return
{
json
:
objectifier
(
root
),
json
:
JSON
.
parse
(
code
),
messages
,
}
}
...
...
packages/uni-nvue-styler/src/parse.ts
浏览文件 @
a0618b9e
import
postcss
from
'
postcss
'
import
{
NormalizeOptions
}
from
'
./normalize
'
import
{
expand
,
normalize
}
from
'
../src
'
import
postcss
,
{
Message
}
from
'
postcss
'
import
{
objectifier
}
from
'
.
'
import
{
expand
}
from
'
./expand
'
import
{
NormalizeOptions
,
normalize
}
from
'
./normalize
'
interface
ParseOpitons
extends
NormalizeOptions
{
filename
?:
string
}
export
function
parse
(
input
:
string
,
options
:
ParseOpitons
=
{})
{
return
postcss
([
expand
,
normalize
(
options
)])
export
async
function
parse
(
input
:
string
,
options
:
ParseOpitons
=
{})
{
const
{
root
,
messages
}
=
await
postcss
([
expand
,
normalize
(
options
)])
.
process
(
input
,
{
from
:
options
.
filename
||
'
foo.css
'
,
})
...
...
@@ -17,8 +18,12 @@ export function parse(input: string, options: ParseOpitons = {}) {
{
type
:
'
warning
'
,
text
:
err
.
message
,
},
}
as
Message
,
],
}
})
if
(
root
)
{
return
{
code
:
JSON
.
stringify
(
objectifier
(
root
)),
messages
}
}
return
{
code
:
JSON
.
stringify
({}),
messages
}
}
pnpm-lock.yaml
浏览文件 @
a0618b9e
...
...
@@ -200,6 +200,7 @@ importers:
specifiers
:
'
@dcloudio/uni-cli-shared'
:
3.0.0-alpha-3030820220114006
'
@dcloudio/uni-i18n'
:
3.0.0-alpha-3030820220114006
'
@dcloudio/uni-nvue-styler'
:
workspace:*
'
@dcloudio/uni-shared'
:
3.0.0-alpha-3030820220114006
'
@rollup/pluginutils'
:
^4.1.2
'
@types/debug'
:
^4.1.7
...
...
@@ -214,6 +215,7 @@ importers:
dependencies
:
'
@dcloudio/uni-cli-shared'
:
link:../uni-cli-shared
'
@dcloudio/uni-i18n'
:
link:../uni-i18n
'
@dcloudio/uni-nvue-styler'
:
link:../uni-nvue-styler
'
@dcloudio/uni-shared'
:
link:../uni-shared
'
@rollup/pluginutils'
:
4.1.2
'
@vitejs/plugin-vue'
:
2.0.1_vite@2.7.13+vue@3.2.27
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录