Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
1c6d8ad1
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,发现更多精彩内容 >>
提交
1c6d8ad1
编写于
8月 31, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: lint
上级
6b05c406
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
58 addition
and
58 deletion
+58
-58
packages/uni-cli-i18n/lib/index.js
packages/uni-cli-i18n/lib/index.js
+2
-2
packages/uni-cli-i18n/lib/lang.js
packages/uni-cli-i18n/lib/lang.js
+2
-2
packages/uni-cli-i18n/lib/locale.js
packages/uni-cli-i18n/lib/locale.js
+1
-1
packages/uni-cli-shared/lib/package.js
packages/uni-cli-shared/lib/package.js
+2
-2
packages/uni-cli-shared/lib/pages.js
packages/uni-cli-shared/lib/pages.js
+2
-2
packages/uni-cli-shared/lib/plugin.js
packages/uni-cli-shared/lib/plugin.js
+4
-4
packages/uni-migration/lib/index.js
packages/uni-migration/lib/index.js
+1
-1
packages/uni-migration/lib/validate.js
packages/uni-migration/lib/validate.js
+3
-3
packages/uni-mp-weixin/lib/uni.compiler.js
packages/uni-mp-weixin/lib/uni.compiler.js
+2
-2
packages/uni-template-compiler/lib/mp.js
packages/uni-template-compiler/lib/mp.js
+2
-2
packages/uni-template-compiler/lib/script/traverse/data/class.js
...s/uni-template-compiler/lib/script/traverse/data/class.js
+1
-1
packages/uni-template-compiler/lib/script/traverse/visitor.js
...ages/uni-template-compiler/lib/script/traverse/visitor.js
+1
-1
packages/uni-template-compiler/lib/template/generate.js
packages/uni-template-compiler/lib/template/generate.js
+1
-1
packages/uni-template-compiler/lib/template/traverse.js
packages/uni-template-compiler/lib/template/traverse.js
+1
-1
packages/uni-template-compiler/lib/util.js
packages/uni-template-compiler/lib/util.js
+1
-1
packages/vue-cli-plugin-uni/commands/build.js
packages/vue-cli-plugin-uni/commands/build.js
+3
-3
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+9
-9
packages/webpack-uni-mp-loader/lib/babel-plugin-global-component.js
...ebpack-uni-mp-loader/lib/babel-plugin-global-component.js
+2
-2
packages/webpack-uni-mp-loader/lib/babel-plugin-scoped-component.js
...ebpack-uni-mp-loader/lib/babel-plugin-scoped-component.js
+1
-1
packages/webpack-uni-mp-loader/lib/babel/global-component-traverse.js
...pack-uni-mp-loader/lib/babel/global-component-traverse.js
+2
-2
packages/webpack-uni-mp-loader/lib/babel/util.js
packages/webpack-uni-mp-loader/lib/babel/util.js
+1
-1
packages/webpack-uni-mp-loader/lib/main-new.js
packages/webpack-uni-mp-loader/lib/main-new.js
+1
-1
packages/webpack-uni-mp-loader/lib/script-new.js
packages/webpack-uni-mp-loader/lib/script-new.js
+1
-1
packages/webpack-uni-pages-loader/lib/index-new.js
packages/webpack-uni-pages-loader/lib/index-new.js
+1
-1
packages/webpack-uni-pages-loader/lib/platforms/mp.js
packages/webpack-uni-pages-loader/lib/platforms/mp.js
+2
-2
src/platforms/app-plus/service/api/media/choose-image.js
src/platforms/app-plus/service/api/media/choose-image.js
+9
-9
未找到文件。
packages/uni-cli-i18n/lib/index.js
浏览文件 @
1c6d8ad1
...
...
@@ -33,8 +33,8 @@ i18n.configure({
},
fallbacks
:
{
'
en_*
'
:
'
en
'
,
'
zh
'
:
'
zh_CN
'
,
'
zh_*
'
:
'
zh_CN
'
,
zh
:
'
zh_CN
'
,
'
zh_*
'
:
'
zh_CN
'
}
})
...
...
packages/uni-cli-i18n/lib/lang.js
浏览文件 @
1c6d8ad1
function
format
(
lang
)
{
const
array
=
lang
.
split
(
/
[
\
.
,
]
/
)[
0
].
split
(
/
[
_-
]
/
)
const
array
=
lang
.
split
(
/
[
.,
]
/
)[
0
].
split
(
/
[
_-
]
/
)
array
[
0
]
=
array
[
0
].
toLowerCase
()
if
(
array
[
0
]
===
'
zh
'
)
{
array
[
1
]
=
(
array
[
1
]
||
'
CN
'
).
toUpperCase
()
...
...
@@ -10,4 +10,4 @@ function format (lang) {
module
.
exports
=
{
format
}
\ No newline at end of file
}
packages/uni-cli-i18n/lib/locale.js
浏览文件 @
1c6d8ad1
...
...
@@ -2,7 +2,7 @@ const { format } = require('./lang')
const
{
osLocale
}
=
require
(
'
os-locale-s-fix/cjs
'
)
function
getLocale
()
{
return
format
(
process
.
env
.
UNI_HBUILDERX_LANGID
||
osLocale
.
sync
({
spawn
:
true
,
cache
:
false
})
||
defaultLocale
)
return
format
(
process
.
env
.
UNI_HBUILDERX_LANGID
||
osLocale
.
sync
({
spawn
:
true
,
cache
:
false
})
||
'
en
'
)
}
module
.
exports
=
{
...
...
packages/uni-cli-shared/lib/package.js
浏览文件 @
1c6d8ad1
...
...
@@ -27,12 +27,12 @@ module.exports = {
}
if
(
!
scriptOptions
.
env
||
!
scriptOptions
.
env
.
UNI_PLATFORM
)
{
console
.
error
(
uniI18n
.
__
(
'
cliShared.requireConfigUniPlatform
'
,
{
"
0
"
:
`package.json->uni-app->scripts->
${
name
}
->env `
}))
console
.
error
(
uniI18n
.
__
(
'
cliShared.requireConfigUniPlatform
'
,
{
0
:
`package.json->uni-app->scripts->
${
name
}
->env `
}))
process
.
exit
(
0
)
}
if
(
PLATFORMS
.
indexOf
(
scriptOptions
.
env
.
UNI_PLATFORM
)
===
-
1
)
{
console
.
error
(
uniI18n
.
__
(
'
cliShared.supportPlatform
'
,
{
"
0
"
:
'
UNI_PLATFORM
'
,
"
1
"
:
JSON
.
stringify
(
PLATFORMS
)
}))
console
.
error
(
uniI18n
.
__
(
'
cliShared.supportPlatform
'
,
{
0
:
'
UNI_PLATFORM
'
,
1
:
JSON
.
stringify
(
PLATFORMS
)
}))
process
.
exit
(
0
)
}
...
...
packages/uni-cli-shared/lib/pages.js
浏览文件 @
1c6d8ad1
...
...
@@ -113,7 +113,7 @@ function isNVuePage (page, root = '') {
function
isValidPage
(
page
,
root
=
''
)
{
if
(
typeof
page
===
'
string
'
||
!
page
.
path
)
{
// 不合法的配置
console
.
warn
(
uniI18n
.
__
(
'
cliShared.pagesJsonError
'
,
{
"
0
"
:
'
https://uniapp.dcloud.io/collocation/pages?id=pages
'
}))
console
.
warn
(
uniI18n
.
__
(
'
cliShared.pagesJsonError
'
,
{
0
:
'
https://uniapp.dcloud.io/collocation/pages?id=pages
'
}))
return
false
}
let
pagePath
=
page
.
path
...
...
@@ -391,7 +391,7 @@ function initAutoComponents () {
})
if
(
conflictFiles
.
length
>
0
)
{
conflictFiles
.
forEach
(
files
=>
{
console
.
warn
(
uniI18n
.
__
(
'
cliShared.easycomConflict
'
,
{
"
0
"
:
'
[
'
+
files
.
map
((
file
,
index
)
=>
{
return
file
}).
join
(
'
,
'
)
+
'
]
'
}))
console
.
warn
(
uniI18n
.
__
(
'
cliShared.easycomConflict
'
,
{
0
:
'
[
'
+
files
.
map
((
file
,
index
)
=>
{
return
file
}).
join
(
'
,
'
)
+
'
]
'
}))
console
.
log
(
'
\n
'
)
})
}
...
...
packages/uni-cli-shared/lib/plugin.js
浏览文件 @
1c6d8ad1
...
...
@@ -25,7 +25,7 @@ function initPlugin (plugin) {
try
{
pluginApi
=
require
(
path
.
join
(
plugin
.
id
,
(
plugin
.
config
.
main
||
'
/lib/uni.config.js
'
)))
}
catch
(
e
)
{
console
.
warn
(
uniI18n
.
__
(
'
cliShared.missingUniConfig
'
,
{
"
0
"
:
plugin
.
id
}))
console
.
warn
(
uniI18n
.
__
(
'
cliShared.missingUniConfig
'
,
{
0
:
plugin
.
id
}))
}
pluginApi
&&
PLUGIN_KEYS
.
forEach
(
name
=>
{
...
...
@@ -56,7 +56,7 @@ function resolvePlugins () {
return
}
if
(
!
config
.
name
)
{
return
console
.
warn
(
uniI18n
.
__
(
'
cliShared.missingNameAttribute
'
,
{
"
0
"
:
`
${
id
}
/package.json->uni-app`
}))
return
console
.
warn
(
uniI18n
.
__
(
'
cliShared.missingNameAttribute
'
,
{
0
:
`
${
id
}
/package.json->uni-app`
}))
}
return
{
id
,
...
...
@@ -75,7 +75,7 @@ function initExtends (name, plugin, plugins) {
process
.
exit
(
0
)
}
if
(
!
plugin
)
{
console
.
error
(
uniI18n
.
__
(
'
cliShared.noFoundPlatformPlugin
'
,
{
"
0
"
:
extendsPlatform
}))
console
.
error
(
uniI18n
.
__
(
'
cliShared.noFoundPlatformPlugin
'
,
{
0
:
extendsPlatform
}))
process
.
exit
(
0
)
}
const
extendsPlugin
=
plugins
.
find
(
plugin
=>
plugin
.
name
===
extendsPlatform
)
...
...
@@ -102,7 +102,7 @@ module.exports = {
const
plugins
=
resolvePlugins
()
const
plugin
=
plugins
.
find
(
plugin
=>
plugin
.
name
===
process
.
env
.
UNI_PLATFORM
)
if
(
!
plugin
)
{
console
.
error
(
uniI18n
.
__
(
'
cliShared.noFoundPlatformPlugin
'
,
{
"
0
"
:
process
.
env
.
UNI_PLATFORM
}))
console
.
error
(
uniI18n
.
__
(
'
cliShared.noFoundPlatformPlugin
'
,
{
0
:
process
.
env
.
UNI_PLATFORM
}))
process
.
exit
(
0
)
}
const
name
=
plugin
.
name
...
...
packages/uni-migration/lib/index.js
浏览文件 @
1c6d8ad1
...
...
@@ -13,7 +13,7 @@ module.exports = function migrate (input, out, options = {}) {
options
.
platform
=
options
.
platform
||
'
mp-weixin
'
const
migrater
=
migraters
[
options
.
platform
]
if
(
!
migrater
)
{
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorOnlySupportConvert
'
,
{
"
0
"
:
Object
.
keys
(
migraters
).
join
(
'
,
'
)
}))
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorOnlySupportConvert
'
,
{
0
:
Object
.
keys
(
migraters
).
join
(
'
,
'
)
}))
}
input
=
path
.
resolve
(
input
)
out
=
path
.
resolve
(
out
||
input
)
...
...
packages/uni-migration/lib/validate.js
浏览文件 @
1c6d8ad1
...
...
@@ -7,7 +7,7 @@ const migraters = {
module
.
exports
=
function
validate
(
input
,
out
,
options
)
{
if
(
!
fs
.
existsSync
(
input
))
{
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorInputNotExists
'
,
{
"
0
"
:
input
}))
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorInputNotExists
'
,
{
0
:
input
}))
}
Object
.
assign
(
options
,
migraters
[
options
.
platform
].
options
)
const
templateExtname
=
options
.
extname
.
template
...
...
@@ -15,7 +15,7 @@ module.exports = function validate (input, out, options) {
const
stat
=
fs
.
lstatSync
(
input
)
if
(
stat
.
isFile
())
{
if
(
path
.
extname
(
input
)
!==
templateExtname
)
{
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorConvertRequireFileUrl
'
,
{
"
0
"
:
templateExtname
.
substr
(
1
)
}))
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorConvertRequireFileUrl
'
,
{
0
:
templateExtname
.
substr
(
1
)
}))
}
options
.
target
=
'
file
'
}
else
if
(
stat
.
isDirectory
())
{
...
...
@@ -26,7 +26,7 @@ module.exports = function validate (input, out, options) {
options
.
target
=
'
folder
'
}
}
else
{
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorCannotConvert
'
,
{
"
0
"
:
input
}))
return
console
.
error
(
uniI18n
.
__
(
'
migration.errorCannotConvert
'
,
{
0
:
input
}))
}
return
true
}
packages/uni-mp-weixin/lib/uni.compiler.js
浏览文件 @
1c6d8ad1
...
...
@@ -107,7 +107,7 @@ module.exports = {
]
if
(
t
.
isIdentifier
(
value
))
{
if
(
value
.
name
!==
key
.
name
)
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
mpWeChat.slotPropNoSupportReanme
'
,
{
"
0
"
:
key
.
name
,
"
1
"
:
value
.
name
}))
state
.
errors
.
add
(
uniI18n
.
__
(
'
mpWeChat.slotPropNoSupportReanme
'
,
{
0
:
key
.
name
,
1
:
value
.
name
}))
}
}
else
if
(
t
.
isAssignmentPattern
(
value
))
{
valueObjectProperties
.
push
(
t
.
objectProperty
(
t
.
identifier
(
'
default
'
),
value
.
right
))
...
...
@@ -115,7 +115,7 @@ module.exports = {
objectProperties
.
push
(
t
.
objectProperty
(
key
,
t
.
objectExpression
(
valueObjectProperties
)))
})
}
else
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
mpWeChat.onlySupportDestructuringSlot
'
,
{
"
0
"
:
paramExprNode
.
name
,
"
1
"
:
'
v-slot="{ user }"
'
}))
state
.
errors
.
add
(
uniI18n
.
__
(
'
mpWeChat.onlySupportDestructuringSlot
'
,
{
0
:
paramExprNode
.
name
,
1
:
'
v-slot="{ user }"
'
}))
}
const
jsContent
=
generateJsCode
(
genCode
(
t
.
objectExpression
(
objectProperties
),
true
))
state
.
files
[
jsFile
]
=
jsContent
...
...
packages/uni-template-compiler/lib/mp.js
浏览文件 @
1c6d8ad1
...
...
@@ -111,7 +111,7 @@ ${content}
return
`
${
eventType
}${
eventName
}
`
// 原生组件不支持 bind:input 等写法,统一使用 bindinput
},
createScopedSlots
(
slotName
,
props
,
state
)
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notCurrentlySupportScopedSlot
'
,
{
"
0
"
:
`[
${
slotName
}
]`
}))
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notCurrentlySupportScopedSlot
'
,
{
0
:
`[
${
slotName
}
]`
}))
return
{
type
:
'
slot
'
,
attr
:
{
...
...
@@ -124,7 +124,7 @@ ${content}
traverseExpr
,
normalizeChildren
},
state
)
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notCurrentlySupportScopedSlot
'
,
{
"
0
"
:
`[
${
slotName
}
]`
}))
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notCurrentlySupportScopedSlot
'
,
{
0
:
`[
${
slotName
}
]`
}))
return
{
type
:
'
view
'
,
attr
:
{
...
...
packages/uni-template-compiler/lib/script/traverse/data/class.js
浏览文件 @
1c6d8ad1
...
...
@@ -133,7 +133,7 @@ module.exports = function processClass (paths, path, state) {
// )
// )
}
else
{
state
.
errors
.
add
(
'
:class
'
+
uniI18n
.
__
(
'
templateCompiler.noSupportSyntax
'
,
{
"
0
"
:
getCode
(
classValuePath
.
node
)
}))
state
.
errors
.
add
(
'
:class
'
+
uniI18n
.
__
(
'
templateCompiler.noSupportSyntax
'
,
{
0
:
getCode
(
classValuePath
.
node
)
}))
}
}
return
[]
...
...
packages/uni-template-compiler/lib/script/traverse/visitor.js
浏览文件 @
1c6d8ad1
...
...
@@ -78,7 +78,7 @@ function addVueId (path, state) {
const
scoped
=
scopeds
[
i
]
forIndexSet
.
add
(
scoped
.
forIndex
)
if
(
forIndexSet
.
size
!==
i
+
1
)
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.forNestedIndexNameNoArrowRepeat
'
,
{
"
0
"
:
'
v-for
'
,
"
1
"
:
scoped
.
forIndex
}))
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.forNestedIndexNameNoArrowRepeat
'
,
{
0
:
'
v-for
'
,
1
:
scoped
.
forIndex
}))
break
}
}
...
...
packages/uni-template-compiler/lib/template/generate.js
浏览文件 @
1c6d8ad1
...
...
@@ -82,7 +82,7 @@ function processElement (ast, state, isRoot) {
ast
.
attr
[
'
vue-slots
'
]
=
'
{{[
'
+
slots
.
reverse
().
map
(
slotName
=>
`'
${
slotName
}
'`
).
join
(
'
,
'
)
+
'
]}}
'
}
if
(
ast
.
attr
.
id
&&
ast
.
attr
.
id
.
indexOf
(
'
{{
'
)
===
0
)
{
state
.
tips
.
add
(
uniI18n
.
__
(
'
templateCompiler.idAttribNotAllowInCustomComponentProps
'
,
{
"
0
"
:
ast
.
type
}))
state
.
tips
.
add
(
uniI18n
.
__
(
'
templateCompiler.idAttribNotAllowInCustomComponentProps
'
,
{
0
:
ast
.
type
}))
}
if
(
hasOwn
(
ast
.
attr
,
'
data
'
)
&&
platformName
!==
'
mp-toutiao
'
)
{
// 百度中会出现异常情况
// TODO 暂不输出
...
...
packages/uni-template-compiler/lib/template/traverse.js
浏览文件 @
1c6d8ad1
...
...
@@ -298,7 +298,7 @@ function genSlotNode (slotName, slotNode, fallbackNodes, state) {
function
traverseRenderSlot
(
callExprNode
,
state
)
{
if
(
!
t
.
isStringLiteral
(
callExprNode
.
arguments
[
0
]))
{
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notSupportDynamicSlotName
'
,
{
"
0
"
:
'
v-slot
'
}))
state
.
errors
.
add
(
uniI18n
.
__
(
'
templateCompiler.notSupportDynamicSlotName
'
,
{
0
:
'
v-slot
'
}))
return
}
...
...
packages/uni-template-compiler/lib/util.js
浏览文件 @
1c6d8ad1
...
...
@@ -116,7 +116,7 @@ function getForKey (forKey, forIndex, state) {
}
else
if
(
t
.
isMemberExpression
(
forKey
))
{
return
forKey
.
property
.
name
||
forKey
.
property
.
value
}
else
{
state
.
tips
.
add
(
uniI18n
.
__
(
'
templateCompiler.noH5KeyNoSupportExpression
'
,
{
"
0
"
:
getCode
(
forKey
),
"
1
"
:
'
https://uniapp.dcloud.io/use?id=key
'
}))
state
.
tips
.
add
(
uniI18n
.
__
(
'
templateCompiler.noH5KeyNoSupportExpression
'
,
{
0
:
getCode
(
forKey
),
1
:
'
https://uniapp.dcloud.io/use?id=key
'
}))
}
}
return
''
...
...
packages/vue-cli-plugin-uni/commands/build.js
浏览文件 @
1c6d8ad1
...
...
@@ -133,7 +133,7 @@ async function build (args, api, options) {
log
()
if
(
!
runByHBuilderX
&&
!
runByAliIde
)
{
logWithSpinner
(
uniI18n
.
__
(
'
pluginUni.startCompileProjectToPlatform
'
,
{
"
0
"
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
"
1
"
:
process
.
env
.
UNI_MP_PLUGIN
?
uniI18n
.
__
(
'
platform
'
)
:
uniI18n
.
__
(
'
plugin
'
)
}))
logWithSpinner
(
uniI18n
.
__
(
'
pluginUni.startCompileProjectToPlatform
'
,
{
0
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
1
:
process
.
env
.
UNI_MP_PLUGIN
?
uniI18n
.
__
(
'
platform
'
)
:
uniI18n
.
__
(
'
plugin
'
)
}))
}
const
targetDir
=
api
.
resolve
(
options
.
outputDir
)
...
...
@@ -219,7 +219,7 @@ function analysisPluginDir () {
if
(
!
fs
.
pathExistsSync
(
pluginJsonPath
))
{
console
.
log
()
console
.
error
(
uniI18n
.
__
(
'
pluginUni.fileNoExistsCheckAfterRetry
'
,
{
"
0
"
:
pluginJsonName
}))
console
.
error
(
uniI18n
.
__
(
'
pluginUni.fileNoExistsCheckAfterRetry
'
,
{
0
:
pluginJsonName
}))
console
.
log
()
process
.
exit
(
0
)
}
...
...
@@ -233,7 +233,7 @@ function analysisPluginDir () {
if
(
UNI_MP_PLUGIN_MAIN
&&
!
fs
.
pathExistsSync
(
mainFilePath
))
{
console
.
log
()
console
.
error
(
uniI18n
.
__
(
'
pluginUni.entryDileNoExistsCheckAfterRetry
'
,
{
"
0
"
:
UNI_MP_PLUGIN_MAIN
}))
console
.
error
(
uniI18n
.
__
(
'
pluginUni.entryDileNoExistsCheckAfterRetry
'
,
{
0
:
UNI_MP_PLUGIN_MAIN
}))
console
.
log
()
process
.
exit
(
0
)
}
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
1c6d8ad1
...
...
@@ -58,7 +58,7 @@ if (process.env.UNI_CLOUD_SPACES) {
const
hasUniCloudSpace
=
spaces
.
length
>
0
if
(
spaces
.
length
===
1
)
{
const
space
=
spaces
[
0
]
console
.
log
(
uniI18n
.
__
(
'
pluginUni.currentProjectDefaultSpaceId
'
,
{
"
0
"
:
space
.
id
}))
console
.
log
(
uniI18n
.
__
(
'
pluginUni.currentProjectDefaultSpaceId
'
,
{
0
:
space
.
id
}))
}
if
(
...
...
@@ -66,13 +66,13 @@ if (process.env.UNI_CLOUD_SPACES) {
isH5
&&
isProduction
)
{
console
.
warn
(
uniI18n
.
__
(
'
pluginUni.unicloudReleaseH5
'
,
{
"
0
"
:
'
https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
}))
console
.
warn
(
uniI18n
.
__
(
'
pluginUni.unicloudReleaseH5
'
,
{
0
:
'
https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
}))
}
else
if
(
hasUniCloudSpace
&&
isH5
&&
!
isProduction
)
{
console
.
warn
(
uniI18n
.
__
(
'
pluginUni.unicloudShowedRunByHBuilderX
'
,
{
"
0
"
:
'
https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
}))
console
.
warn
(
uniI18n
.
__
(
'
pluginUni.unicloudShowedRunByHBuilderX
'
,
{
0
:
'
https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
}))
}
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
(
spaces
.
map
(
space
=>
{
...
...
@@ -295,7 +295,7 @@ if (
process
.
env
.
UNI_USING_STAT
=
true
if
(
!
process
.
UNI_STAT_CONFIG
.
appid
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
console
.
log
()
console
.
warn
(
uniI18n
.
__
(
'
pluginUni.uniStatisticsNoAppid
'
,
{
"
0
"
:
'
https://ask.dcloud.net.cn/article/36303
'
}))
console
.
warn
(
uniI18n
.
__
(
'
pluginUni.uniStatisticsNoAppid
'
,
{
0
:
'
https://ask.dcloud.net.cn/article/36303
'
}))
console
.
log
()
}
}
...
...
@@ -321,10 +321,10 @@ const warningMsg =
const
needWarning
=
!
platformOptions
.
usingComponents
||
usingComponentsAbsent
let
hasNVue
=
false
// 输出编译器版本等信息
const
compile
_mode_u
rl
=
'
https://ask.dcloud.net.cn/article/36074
'
const
compile
ModeU
rl
=
'
https://ask.dcloud.net.cn/article/36074
'
if
(
process
.
env
.
UNI_USING_NATIVE
||
process
.
env
.
UNI_USING_V3_NATIVE
)
{
let
compile_m
ode
=
(
process
.
env
.
UNI_USING_V3_NATIVE
?
'
(v3)
'
:
''
)
+
'
:
'
+
(
isNVueCompiler
?
'
uni-app
'
:
'
weex
'
)
console
.
log
(
uniI18n
.
__
(
'
pluginUni.nvueCompileModeForDetail
'
,
{
"
0
"
:
compile_mode
,
"
1
"
:
compile_mode_u
rl
}))
const
compileM
ode
=
(
process
.
env
.
UNI_USING_V3_NATIVE
?
'
(v3)
'
:
''
)
+
'
:
'
+
(
isNVueCompiler
?
'
uni-app
'
:
'
weex
'
)
console
.
log
(
uniI18n
.
__
(
'
pluginUni.nvueCompileModeForDetail
'
,
{
0
:
compileMode
,
1
:
compileModeU
rl
}))
}
else
if
(
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
&&
process
.
env
.
UNI_PLATFORM
!==
'
quickapp-native
'
)
{
try
{
let
info
=
''
...
...
@@ -346,7 +346,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
if
(
needWarning
)
{
console
.
log
(
warningMsg
)
}
console
.
log
(
uniI18n
.
__
(
'
pluginUni.nvueCompileModeForDetail
'
,
{
"
0
"
:
(
isNVueCompiler
?
'
uni-app
'
:
'
weex
'
),
"
1
"
:
compile_mode_u
rl
}))
console
.
log
(
uniI18n
.
__
(
'
pluginUni.nvueCompileModeForDetail
'
,
{
0
:
(
isNVueCompiler
?
'
uni-app
'
:
'
weex
'
),
1
:
compileModeU
rl
}))
}
else
{
console
.
log
(
info
)
if
(
needWarning
)
{
...
...
@@ -467,7 +467,7 @@ if (
}
if
(
process
.
env
.
UNI_PLATFORM
.
startsWith
(
'
mp-
'
))
{
console
.
log
(
uniI18n
.
__
(
'
pluginUni.mpBrowserKernelDifference
'
,
{
"
0
"
:
"
https://uniapp.dcloud.io/matter?id=mp
"
}))
console
.
log
(
uniI18n
.
__
(
'
pluginUni.mpBrowserKernelDifference
'
,
{
0
:
'
https://uniapp.dcloud.io/matter?id=mp
'
}))
}
runByHBuilderX
&&
console
.
log
(
uniI18n
.
__
(
'
compiling
'
))
...
...
packages/webpack-uni-mp-loader/lib/babel-plugin-global-component.js
浏览文件 @
1c6d8ad1
...
...
@@ -31,10 +31,10 @@ module.exports = function babelPluginGlobalComponent ({
}
if
(
callee
.
object
.
name
===
'
Vue
'
&&
callee
.
property
.
name
===
'
component
'
)
{
if
(
!
args
[
0
]
||
args
[
0
].
type
!==
'
StringLiteral
'
)
{
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.firstParameterNeedStaticString
'
,
{
"
0
"
:
"
Vue.component()
"
}))
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.firstParameterNeedStaticString
'
,
{
0
:
'
Vue.component()
'
}))
}
if
(
!
args
[
1
])
{
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.requireTwoParameter
'
,
{
"
0
"
:
"
Vue.component()
"
}))
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.requireTwoParameter
'
,
{
0
:
'
Vue.component()
'
}))
}
if
(
!
metadata
.
globalComponents
)
{
metadata
.
globalComponents
=
{}
...
...
packages/webpack-uni-mp-loader/lib/babel-plugin-scoped-component.js
浏览文件 @
1c6d8ad1
...
...
@@ -65,7 +65,7 @@ module.exports = function ({
const
value
=
prop
.
value
.
name
const
source
=
findSource
(
value
,
path
.
scope
.
bindings
)
if
(
!
source
)
{
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.componentReferenceError
'
,
{
"
0
"
:
key
}))
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.componentReferenceError
'
,
{
0
:
key
}))
}
if
(
process
.
UNI_LIBRARIES
.
includes
(
source
))
{
const
componentName
=
hyphenate
(
key
)
...
...
packages/webpack-uni-mp-loader/lib/babel/global-component-traverse.js
浏览文件 @
1c6d8ad1
...
...
@@ -24,10 +24,10 @@ module.exports = function (ast, state = {}) {
const
nameNode
=
args
[
0
]
const
valueNode
=
args
[
1
]
if
(
!
t
.
isStringLiteral
(
nameNode
))
{
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.firstParameterNeedStaticString
'
,
{
"
0
"
:
"
Vue.component()
"
}))
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.firstParameterNeedStaticString
'
,
{
0
:
'
Vue.component()
'
}))
}
if
(
!
t
.
isIdentifier
(
valueNode
))
{
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.requireTwoParameter
'
,
{
"
0
"
:
"
Vue.component()
"
}))
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.requireTwoParameter
'
,
{
0
:
'
Vue.component()
'
}))
}
imports
.
push
({
name
:
nameNode
.
value
,
...
...
packages/webpack-uni-mp-loader/lib/babel/util.js
浏览文件 @
1c6d8ad1
...
...
@@ -35,7 +35,7 @@ function parseComponents (names, bindings, path) {
})
=>
{
const
importDeclaration
=
findImportDeclaration
(
value
,
bindings
)
if
(
!
importDeclaration
)
{
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.componentReferenceErrorOnlySupportImport
'
,
{
"
0
"
:
name
}))
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.componentReferenceErrorOnlySupportImport
'
,
{
0
:
name
}))
}
let
source
=
importDeclaration
.
node
.
source
.
value
if
(
process
.
UNI_LIBRARIES
&&
process
.
UNI_LIBRARIES
.
includes
(
source
))
{
...
...
packages/webpack-uni-mp-loader/lib/main-new.js
浏览文件 @
1c6d8ad1
...
...
@@ -97,7 +97,7 @@ createPage(Page)
const
babelLoader
=
findBabelLoader
(
this
.
loaders
)
if
(
!
babelLoader
)
{
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.findFail
'
,
{
"
0
"
:
"
babel-loader
"
}))
throw
new
Error
(
uniI18n
.
__
(
'
mpLoader.findFail
'
,
{
0
:
'
babel-loader
'
}))
}
else
{
addCreateApp
(
babelLoader
)
}
...
...
packages/webpack-uni-mp-loader/lib/script-new.js
浏览文件 @
1c6d8ad1
...
...
@@ -126,7 +126,7 @@ module.exports = function (content, map) {
const
babelLoader
=
findBabelLoader
(
this
.
loaders
)
if
(
!
babelLoader
)
{
callback
(
new
Error
(
uniI18n
.
__
(
'
mpLoader.findFail
'
,
{
"
0
"
:
"
babel-loader
"
})),
content
)
callback
(
new
Error
(
uniI18n
.
__
(
'
mpLoader.findFail
'
,
{
0
:
'
babel-loader
'
})),
content
)
}
else
{
addDynamicImport
(
babelLoader
,
resourcePath
,
dynamicImports
)
...
...
packages/webpack-uni-pages-loader/lib/index-new.js
浏览文件 @
1c6d8ad1
...
...
@@ -112,7 +112,7 @@ module.exports = function (content, map) {
if
(
!
isAppView
&&
jsonFile
.
name
===
'
manifest.json
'
)
{
const
content
=
JSON
.
parse
(
jsonFile
.
content
)
if
(
!
content
.
launch_path
&&
content
.
plus
[
'
uni-app
'
].
nvueLaunchMode
===
'
fast
'
)
{
console
.
log
(
uniI18n
.
__
(
'
pagesLoader.nvueFirstPageStartModeIsFast
'
,
{
"
0
"
:
"
https://ask.dcloud.net.cn/article/36749
"
}))
console
.
log
(
uniI18n
.
__
(
'
pagesLoader.nvueFirstPageStartModeIsFast
'
,
{
0
:
'
https://ask.dcloud.net.cn/article/36749
'
}))
}
}
if
(
jsonFile
.
name
===
'
define-pages.js
'
)
{
...
...
packages/webpack-uni-pages-loader/lib/platforms/mp.js
浏览文件 @
1c6d8ad1
...
...
@@ -42,7 +42,7 @@ const pagesJson2AppJson = {
tabBar
:
function
(
name
,
value
,
json
,
fromJson
)
{
if
(
value
&&
value
.
list
&&
value
.
list
.
length
)
{
if
(
value
.
list
.
length
<
2
)
{
console
.
error
(
uniI18n
.
__
(
'
pagesLoader.pagesTabbarMinItem2
'
,
{
"
0
"
:
"
tabBar.list
"
}))
console
.
error
(
uniI18n
.
__
(
'
pagesLoader.pagesTabbarMinItem2
'
,
{
0
:
'
tabBar.list
'
}))
}
const
pages
=
json
.
pages
value
.
list
.
forEach
((
page
,
index
)
=>
{
...
...
@@ -57,7 +57,7 @@ const pagesJson2AppJson = {
})
=>
path
===
(
page
.
pagePath
+
'
.html
'
))
)
)
{
console
.
error
(
uniI18n
.
__
(
'
pagesLoader.needInPagesNode
'
,
{
"
0
"
:
`pages.json tabBar['list'][
${
index
}
]['pagePath'] "
${
page
.
pagePath
}
"`
}))
console
.
error
(
uniI18n
.
__
(
'
pagesLoader.needInPagesNode
'
,
{
0
:
`pages.json tabBar['list'][
${
index
}
]['pagePath'] "
${
page
.
pagePath
}
"`
}))
}
}
})
...
...
src/platforms/app-plus/service/api/media/choose-image.js
浏览文件 @
1c6d8ad1
...
...
@@ -81,22 +81,22 @@ export function chooseImage ({
// fix By Lxh 暂时添加拍照压缩逻辑,等客户端增加逻辑后修改
// 判断是否需要压缩
if
(
sizeType
&&
sizeType
.
includes
(
'
compressed
'
))
{
return
getFileInfo
(
path
).
then
(({
size
})
=>
{
return
getFileInfo
(
path
).
then
(({
size
})
=>
{
// 压缩阈值 0.5 兆
const
THRESHOLD
=
1024
*
1024
*
0.5
return
size
&&
size
>
THRESHOLD
?
compressImage
(
path
).
then
(
dstPath
=>
successCallback
([
dstPath
]))
:
successCallback
([
path
])
return
size
&&
size
>
THRESHOLD
?
compressImage
(
path
).
then
(
dstPath
=>
successCallback
([
dstPath
]))
:
successCallback
([
path
])
}).
catch
(
errorCallback
)
}
return
successCallback
([
path
])
},
errorCallback
,
{
filename
:
TEMP_PATH
+
'
/camera/
'
,
resolution
:
'
high
'
,
crop
})
errorCallback
,
{
filename
:
TEMP_PATH
+
'
/camera/
'
,
resolution
:
'
high
'
,
crop
})
}
function
openAlbum
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录