Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
56ef890a
U
uni-app
项目概览
菜鸟程序猿_c
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
56ef890a
编写于
10月 11, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(mp): copy assets
上级
4d8c4abf
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
158 addition
and
16 deletion
+158
-16
packages/uni-mp-vite/src/index.ts
packages/uni-mp-vite/src/index.ts
+2
-2
packages/uni-mp-vite/src/plugin/index.ts
packages/uni-mp-vite/src/plugin/index.ts
+8
-2
packages/uni-mp-vite/src/plugin/uni/index.ts
packages/uni-mp-vite/src/plugin/uni/index.ts
+10
-3
packages/uni-mp-vite/src/plugins/manifestJson.ts
packages/uni-mp-vite/src/plugins/manifestJson.ts
+5
-6
packages/uni-mp-vite/src/plugins/pagesJson.ts
packages/uni-mp-vite/src/plugins/pagesJson.ts
+4
-1
packages/uni-mp-weixin/dist/uni.compiler.js
packages/uni-mp-weixin/dist/uni.compiler.js
+70
-1
packages/uni-mp-weixin/src/plugin/index.ts
packages/uni-mp-weixin/src/plugin/index.ts
+24
-1
packages/uni-mp-weixin/src/plugin/project.config.json
packages/uni-mp-weixin/src/plugin/project.config.json
+35
-0
未找到文件。
packages/uni-mp-vite/src/index.ts
浏览文件 @
56ef890a
...
...
@@ -7,8 +7,8 @@ export { UniMiniProgramPluginOptions } from './plugin'
export
default
(
options
:
UniMiniProgramPluginOptions
)
=>
{
return
[
uniMainJsPlugin
(
options
),
uniManifestJsonPlugin
(),
uniPagesJsonPlugin
(),
uniManifestJsonPlugin
(
options
),
uniPagesJsonPlugin
(
options
),
uniVirtualPlugin
(
options
),
uniMiniProgramPlugin
(
options
),
]
...
...
packages/uni-mp-vite/src/plugin/index.ts
浏览文件 @
56ef890a
...
...
@@ -3,6 +3,7 @@ import debug from 'debug'
import
fs
from
'
fs-extra
'
import
{
AliasOptions
}
from
'
vite
'
import
{
CopyOptions
,
EXTNAME_VUE_RE
,
normalizeNodeModules
,
resolveBuiltIn
,
...
...
@@ -18,6 +19,7 @@ const debugMp = debug('vite:uni:mp')
export
interface
UniMiniProgramPluginOptions
{
vite
:
{
alias
:
AliasOptions
copyOptions
:
CopyOptions
}
global
:
string
app
:
{
...
...
@@ -26,6 +28,7 @@ export interface UniMiniProgramPluginOptions {
}
project
:
{
filename
:
string
source
:
Record
<
string
,
unknown
>
}
template
:
{
extname
:
string
...
...
@@ -50,7 +53,7 @@ export function uniMiniProgramPlugin(
options
:
UniMiniProgramPluginOptions
):
UniVitePlugin
{
const
{
vite
:
{
alias
},
vite
:
{
alias
,
copyOptions
},
template
,
}
=
options
const
emitFile
:
(
emittedFile
:
EmittedFile
)
=>
string
=
(
emittedFile
)
=>
{
...
...
@@ -70,7 +73,10 @@ export function uniMiniProgramPlugin(
}
return
{
name
:
'
vite:uni-mp
'
,
uni
:
uniOptions
({
emitFile
}),
uni
:
uniOptions
({
copyOptions
,
miniProgram
:
{
emitFile
},
}),
config
()
{
return
{
resolve
:
{
...
...
packages/uni-mp-vite/src/plugin/uni/index.ts
浏览文件 @
56ef890a
...
...
@@ -3,15 +3,22 @@ import {
isServiceCustomElement
,
}
from
'
@dcloudio/uni-shared
'
import
{
EmittedFile
}
from
'
rollup
'
import
{
UniVitePlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
{
CopyOptions
,
UniVitePlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
{
TemplateCompiler
}
from
'
@vue/compiler-sfc
'
import
*
as
compiler
from
'
@dcloudio/uni-mp-compiler
'
export
function
uniOptions
(
miniProgram
:
{
export
function
uniOptions
({
copyOptions
,
miniProgram
,
}:
{
copyOptions
:
CopyOptions
miniProgram
:
{
emitFile
?:
(
emittedFile
:
EmittedFile
)
=>
string
}
}):
UniVitePlugin
[
'
uni
'
]
{
return
{
copyOptions
,
compiler
:
compiler
as
TemplateCompiler
,
compilerOptions
:
{
miniProgram
,
...
...
packages/uni-mp-vite/src/plugins/manifestJson.ts
浏览文件 @
56ef890a
...
...
@@ -4,18 +4,17 @@ import { Plugin } from 'vite'
import
{
defineUniManifestJsonPlugin
,
getLocaleFiles
,
// normalizeAppManifestJson,
// parseJson,
// parsePagesJsonOnce,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
UniMiniProgramPluginOptions
}
from
'
../plugin
'
export
function
uniManifestJsonPlugin
():
Plugin
{
// let manifestJson: Record<string, any>
export
function
uniManifestJsonPlugin
(
options
:
UniMiniProgramPluginOptions
):
Plugin
{
return
defineUniManifestJsonPlugin
((
opts
)
=>
{
return
{
name
:
'
vite:uni-mp-manifest-json
'
,
enforce
:
'
pre
'
,
transform
(
code
,
id
)
{
transform
(
_
code
,
id
)
{
if
(
!
opts
.
filter
(
id
))
{
return
}
...
...
packages/uni-mp-vite/src/plugins/pagesJson.ts
浏览文件 @
56ef890a
...
...
@@ -8,8 +8,11 @@ import {
normalizePagePath
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
virtualPagePath
}
from
'
./virtual
'
import
{
UniMiniProgramPluginOptions
}
from
'
../plugin
'
export
function
uniPagesJsonPlugin
():
Plugin
{
export
function
uniPagesJsonPlugin
(
options
:
UniMiniProgramPluginOptions
):
Plugin
{
let
pagesJson
:
UniApp
.
PagesJson
return
defineUniPagesJsonPlugin
((
opts
)
=>
{
return
{
...
...
packages/uni-mp-weixin/dist/uni.compiler.js
浏览文件 @
56ef890a
...
...
@@ -7,6 +7,55 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
var
initMiniProgramPlugin__default
=
/*#__PURE__*/
_interopDefaultLegacy
(
initMiniProgramPlugin
);
var
description
=
"
项目配置文件。
"
;
var
packOptions
=
{
ignore
:
[
]
};
var
setting
=
{
urlCheck
:
true
,
es6
:
false
,
postcss
:
false
,
minified
:
false
,
newFeature
:
true
};
var
compileType
=
"
miniprogram
"
;
var
libVersion
=
""
;
var
appid
=
"
touristappid
"
;
var
projectname
=
""
;
var
condition
=
{
search
:
{
current
:
-
1
,
list
:
[
]
},
conversation
:
{
current
:
-
1
,
list
:
[
]
},
game
:
{
current
:
-
1
,
list
:
[
]
},
miniprogram
:
{
current
:
-
1
,
list
:
[
]
}
};
var
source
=
{
description
:
description
,
packOptions
:
packOptions
,
setting
:
setting
,
compileType
:
compileType
,
libVersion
:
libVersion
,
appid
:
appid
,
projectname
:
projectname
,
condition
:
condition
};
const
uniMiniProgramWeixinPlugin
=
{
name
:
'
vite:uni-mp-weixin
'
,
config
()
{
...
...
@@ -17,11 +66,30 @@ const uniMiniProgramWeixinPlugin = {
};
},
};
const
projectConfigFilename
=
'
project.config.json
'
;
const
options
=
{
vite
:
{
alias
:
{
'
uni-mp-runtime
'
:
uniCliShared
.
resolveBuiltIn
(
'
@dcloudio/uni-mp-weixin/dist/uni.mp.esm.js
'
),
},
copyOptions
:
{
assets
:
[
'
wxcomponents
'
],
targets
:
[
{
src
:
[
'
theme.json
'
,
'
sitemap.json
'
,
'
ext.json
'
,
'
custom-tab-bar
'
,
'
functional-pages
'
,
projectConfigFilename
,
],
get
dest
()
{
return
process
.
env
.
UNI_OUTPUT_DIR
;
},
},
],
},
},
global
:
'
wx
'
,
app
:
{
...
...
@@ -29,7 +97,8 @@ const options = {
subpackages
:
true
,
},
project
:
{
filename
:
'
project.config.json
'
,
filename
:
projectConfigFilename
,
source
,
},
template
:
{
extname
:
'
.wxml
'
,
...
...
packages/uni-mp-weixin/src/plugin/index.ts
浏览文件 @
56ef890a
...
...
@@ -4,6 +4,8 @@ import initMiniProgramPlugin, {
UniMiniProgramPluginOptions
,
}
from
'
@dcloudio/uni-mp-vite
'
import
source
from
'
./project.config.json
'
const
uniMiniProgramWeixinPlugin
:
Plugin
=
{
name
:
'
vite:uni-mp-weixin
'
,
config
()
{
...
...
@@ -15,6 +17,8 @@ const uniMiniProgramWeixinPlugin: Plugin = {
},
}
const
projectConfigFilename
=
'
project.config.json
'
const
options
:
UniMiniProgramPluginOptions
=
{
vite
:
{
alias
:
{
...
...
@@ -22,6 +26,24 @@ const options: UniMiniProgramPluginOptions = {
'
@dcloudio/uni-mp-weixin/dist/uni.mp.esm.js
'
),
},
copyOptions
:
{
assets
:
[
'
wxcomponents
'
],
targets
:
[
{
src
:
[
'
theme.json
'
,
'
sitemap.json
'
,
'
ext.json
'
,
'
custom-tab-bar
'
,
'
functional-pages
'
,
projectConfigFilename
,
],
get
dest
()
{
return
process
.
env
.
UNI_OUTPUT_DIR
},
},
],
},
},
global
:
'
wx
'
,
app
:
{
...
...
@@ -29,7 +51,8 @@ const options: UniMiniProgramPluginOptions = {
subpackages
:
true
,
},
project
:
{
filename
:
'
project.config.json
'
,
filename
:
projectConfigFilename
,
source
,
},
template
:
{
extname
:
'
.wxml
'
,
...
...
packages/uni-mp-weixin/src/plugin/project.config.json
0 → 100644
浏览文件 @
56ef890a
{
"description"
:
"项目配置文件。"
,
"packOptions"
:
{
"ignore"
:
[]
},
"setting"
:
{
"urlCheck"
:
true
,
"es6"
:
false
,
"postcss"
:
false
,
"minified"
:
false
,
"newFeature"
:
true
},
"compileType"
:
"miniprogram"
,
"libVersion"
:
""
,
"appid"
:
"touristappid"
,
"projectname"
:
""
,
"condition"
:
{
"search"
:
{
"current"
:
-1
,
"list"
:
[]
},
"conversation"
:
{
"current"
:
-1
,
"list"
:
[]
},
"game"
:
{
"current"
:
-1
,
"list"
:
[]
},
"miniprogram"
:
{
"current"
:
-1
,
"list"
:
[]
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录