Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
20岁爱吃必胜客
uni-app
提交
42f14604
U
uni-app
项目概览
20岁爱吃必胜客
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
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,发现更多精彩内容 >>
提交
42f14604
编写于
6月 23, 2022
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: getPlatformUniCloud
上级
2e02ab4d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
27 deletion
+30
-27
packages/uni-cli-shared/lib/index.js
packages/uni-cli-shared/lib/index.js
+7
-5
packages/uni-cli-shared/lib/platform.js
packages/uni-cli-shared/lib/platform.js
+8
-1
packages/vue-cli-plugin-uni/lib/app-plus/index.js
packages/vue-cli-plugin-uni/lib/app-plus/index.js
+5
-7
packages/vue-cli-plugin-uni/lib/h5/index.js
packages/vue-cli-plugin-uni/lib/h5/index.js
+6
-7
packages/vue-cli-plugin-uni/lib/mp/index.js
packages/vue-cli-plugin-uni/lib/mp/index.js
+4
-7
未找到文件。
packages/uni-cli-shared/lib/index.js
浏览文件 @
42f14604
...
@@ -58,8 +58,9 @@ const {
...
@@ -58,8 +58,9 @@ const {
nvueCssPreprocessOptions
,
nvueCssPreprocessOptions
,
nvueHtmlPreprocessOptions
,
nvueHtmlPreprocessOptions
,
getPlatformGlobal
,
getPlatformGlobal
,
getPlatformStat
,
getPlatformStat
,
getPlatformPush
getPlatformPush
,
getPlatformUniCloud
}
=
require
(
'
./platform
'
)
}
=
require
(
'
./platform
'
)
module
.
exports
=
{
module
.
exports
=
{
...
@@ -109,6 +110,7 @@ module.exports = {
...
@@ -109,6 +110,7 @@ module.exports = {
nvueCssPreprocessOptions
,
nvueCssPreprocessOptions
,
nvueHtmlPreprocessOptions
,
nvueHtmlPreprocessOptions
,
getPlatformGlobal
,
getPlatformGlobal
,
getPlatformStat
,
getPlatformStat
,
getPlatformPush
getPlatformPush
,
}
getPlatformUniCloud
}
packages/uni-cli-shared/lib/platform.js
浏览文件 @
42f14604
...
@@ -175,6 +175,13 @@ module.exports = {
...
@@ -175,6 +175,13 @@ module.exports = {
}
}
return
''
return
''
},
},
getPlatformUniCloud
()
{
if
(
JSON
.
parse
(
process
.
env
.
UNI_CLOUD_PROVIDER
||
'
[]
'
).
length
)
{
const
uniCloudLibPath
=
'
@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
'
return
`import '
${
uniCloudLibPath
}
';`
}
return
''
},
getBabelParserOptions
()
{
getBabelParserOptions
()
{
return
{
return
{
sourceType
:
'
module
'
,
sourceType
:
'
module
'
,
...
@@ -192,4 +199,4 @@ module.exports = {
...
@@ -192,4 +199,4 @@ module.exports = {
]
]
}
}
}
}
}
}
packages/vue-cli-plugin-uni/lib/app-plus/index.js
浏览文件 @
42f14604
...
@@ -4,7 +4,8 @@ const webpack = require('webpack')
...
@@ -4,7 +4,8 @@ const webpack = require('webpack')
const
{
const
{
getMainEntry
,
getMainEntry
,
getPlatformStat
,
getPlatformStat
,
getPlatformPush
getPlatformPush
,
getPlatformUniCloud
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
vueLoader
=
require
(
'
@dcloudio/uni-cli-shared/lib/vue-loader
'
)
const
vueLoader
=
require
(
'
@dcloudio/uni-cli-shared/lib/vue-loader
'
)
...
@@ -62,12 +63,9 @@ const v3 = {
...
@@ -62,12 +63,9 @@ const v3 = {
const
statCode
=
getPlatformStat
()
const
statCode
=
getPlatformStat
()
const
pushCode
=
getPlatformPush
()
const
pushCode
=
getPlatformPush
()
const
uniCloudCode
=
getPlatformUniCloud
()
let
beforeCode
=
'
import
\'
uni-pages
\'
;
'
const
beforeCode
=
'
import
\'
uni-pages
\'
;
'
if
(
JSON
.
parse
(
process
.
env
.
UNI_CLOUD_PROVIDER
||
'
[]
'
).
length
)
{
const
uniCloudLibPath
=
'
@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
'
beforeCode
+=
`import '
${
uniCloudLibPath
}
';`
}
if
(
!
webpackConfig
.
optimization
)
{
if
(
!
webpackConfig
.
optimization
)
{
webpackConfig
.
optimization
=
{}
webpackConfig
.
optimization
=
{}
}
}
...
@@ -159,7 +157,7 @@ const v3 = {
...
@@ -159,7 +157,7 @@ const v3 = {
options
:
{
options
:
{
compiler
:
vueLoader
.
compiler
,
compiler
:
vueLoader
.
compiler
,
before
:
[
before
:
[
beforeCode
+
require
(
'
../util
'
).
getAutomatorCode
()
+
statCode
+
pushCode
+
beforeCode
+
require
(
'
../util
'
).
getAutomatorCode
()
+
statCode
+
pushCode
+
uniCloudCode
+
getGlobalUsingComponentsCode
()
getGlobalUsingComponentsCode
()
]
]
}
}
...
...
packages/vue-cli-plugin-uni/lib/h5/index.js
浏览文件 @
42f14604
...
@@ -6,7 +6,8 @@ const {
...
@@ -6,7 +6,8 @@ const {
getMainEntry
,
getMainEntry
,
getH5Options
,
getH5Options
,
getPlatformStat
,
getPlatformStat
,
getPlatformPush
getPlatformPush
,
getPlatformUniCloud
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
{
const
{
...
@@ -95,17 +96,15 @@ module.exports = {
...
@@ -95,17 +96,15 @@ module.exports = {
const
statCode
=
getPlatformStat
()
const
statCode
=
getPlatformStat
()
const
pushCode
=
getPlatformPush
()
const
pushCode
=
getPlatformPush
()
const
uniCloudCode
=
getPlatformUniCloud
()
try
{
try
{
const
babelConfig
=
require
(
path
.
resolve
(
process
.
env
.
UNI_CLI_CONTEXT
,
'
babel.config.js
'
))
const
babelConfig
=
require
(
path
.
resolve
(
process
.
env
.
UNI_CLI_CONTEXT
,
'
babel.config.js
'
))
useBuiltIns
=
babelConfig
.
presets
[
0
][
1
].
useBuiltIns
useBuiltIns
=
babelConfig
.
presets
[
0
][
1
].
useBuiltIns
}
catch
(
e
)
{}
}
catch
(
e
)
{}
le
t
beforeCode
=
(
useBuiltIns
===
'
entry
'
?
'
import
\'
@babel/polyfill
\'
;
'
:
''
)
+
cons
t
beforeCode
=
(
useBuiltIns
===
'
entry
'
?
'
import
\'
@babel/polyfill
\'
;
'
:
''
)
+
`import 'uni-pages';import 'uni-
${
process
.
env
.
UNI_PLATFORM
}
';`
`import 'uni-pages';import 'uni-
${
process
.
env
.
UNI_PLATFORM
}
';`
if
(
JSON
.
parse
(
process
.
env
.
UNI_CLOUD_PROVIDER
||
'
[]
'
).
length
)
{
const
uniCloudLibPath
=
'
@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
'
beforeCode
+=
`import '
${
uniCloudLibPath
}
';`
}
return
{
return
{
resolve
:
{
resolve
:
{
extensions
:
[
'
.nvue
'
],
extensions
:
[
'
.nvue
'
],
...
@@ -121,7 +120,7 @@ module.exports = {
...
@@ -121,7 +120,7 @@ module.exports = {
loader
:
path
.
resolve
(
__dirname
,
'
../../packages/wrap-loader
'
),
loader
:
path
.
resolve
(
__dirname
,
'
../../packages/wrap-loader
'
),
options
:
{
options
:
{
before
:
[
before
:
[
beforeCode
+
require
(
'
../util
'
).
getAutomatorCode
()
+
statCode
+
pushCode
+
beforeCode
+
require
(
'
../util
'
).
getAutomatorCode
()
+
statCode
+
pushCode
+
uniCloudCode
+
getGlobalUsingComponentsCode
()
getGlobalUsingComponentsCode
()
]
]
}
}
...
...
packages/vue-cli-plugin-uni/lib/mp/index.js
浏览文件 @
42f14604
...
@@ -8,7 +8,8 @@ const {
...
@@ -8,7 +8,8 @@ const {
getPlatformExts
,
getPlatformExts
,
getPlatformCssnano
,
getPlatformCssnano
,
getPlatformStat
,
getPlatformStat
,
getPlatformPush
getPlatformPush
,
getPlatformUniCloud
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
WebpackUniAppPlugin
=
require
(
'
../../packages/webpack-uni-app-loader/plugin/index
'
)
const
WebpackUniAppPlugin
=
require
(
'
../../packages/webpack-uni-app-loader/plugin/index
'
)
...
@@ -168,6 +169,7 @@ module.exports = {
...
@@ -168,6 +169,7 @@ module.exports = {
const
statCode
=
getPlatformStat
()
const
statCode
=
getPlatformStat
()
const
pushCode
=
getPlatformPush
()
const
pushCode
=
getPlatformPush
()
const
uniCloudCode
=
getPlatformUniCloud
()
let
beforeCode
=
'
import
\'
uni-pages
\'
;
'
let
beforeCode
=
'
import
\'
uni-pages
\'
;
'
...
@@ -194,11 +196,6 @@ module.exports = {
...
@@ -194,11 +196,6 @@ module.exports = {
${
globalEnv
}
.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
${
globalEnv
}
.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
}
}
if
(
JSON
.
parse
(
process
.
env
.
UNI_CLOUD_PROVIDER
||
'
[]
'
).
length
)
{
const
uniCloudLibPath
=
'
@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js
'
beforeCode
+=
`import '
${
uniCloudLibPath
}
';`
}
const
alias
=
{
// 仅 mp-weixin
const
alias
=
{
// 仅 mp-weixin
'
mpvue-page-factory
'
:
require
.
resolve
(
'
mpvue-page-factory
'
:
require
.
resolve
(
'
@dcloudio/vue-cli-plugin-uni/packages/mpvue-page-factory
'
)
'
@dcloudio/vue-cli-plugin-uni/packages/mpvue-page-factory
'
)
...
@@ -244,7 +241,7 @@ ${globalEnv}.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
...
@@ -244,7 +241,7 @@ ${globalEnv}.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
loader
:
path
.
resolve
(
__dirname
,
'
../../packages/wrap-loader
'
),
loader
:
path
.
resolve
(
__dirname
,
'
../../packages/wrap-loader
'
),
options
:
{
options
:
{
before
:
[
before
:
[
beforeCode
+
require
(
'
../util
'
).
getAutomatorCode
()
+
statCode
+
pushCode
beforeCode
+
require
(
'
../util
'
).
getAutomatorCode
()
+
statCode
+
pushCode
+
uniCloudCode
]
]
}
}
},
{
},
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录