Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
b55fe27c
U
uni-app
项目概览
MuGuiLin
/
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,发现更多精彩内容 >>
提交
b55fe27c
编写于
7月 29, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add UNI_APP_ID,UNI_APP_NAME,UNI_PLATFORM
上级
efb38cca
变更
22
展开全部
显示空白变更内容
内联
并排
Showing
22 changed file
with
321 addition
and
159 deletion
+321
-159
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+3
-4
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
+4
-5
packages/uni-cli-nvue/src/webpack/config/plugins/define.ts
packages/uni-cli-nvue/src/webpack/config/plugins/define.ts
+13
-12
packages/uni-cli-shared/src/env/define.ts
packages/uni-cli-shared/src/env/define.ts
+23
-0
packages/uni-cli-shared/src/env/index.ts
packages/uni-cli-shared/src/env/index.ts
+2
-0
packages/uni-cli-shared/src/env/provide.ts
packages/uni-cli-shared/src/env/provide.ts
+0
-0
packages/uni-cli-shared/src/index.ts
packages/uni-cli-shared/src/index.ts
+1
-1
packages/uni-cloud/dist/uni-cloud.cjs.js
packages/uni-cloud/dist/uni-cloud.cjs.js
+0
-1
packages/uni-cloud/dist/uni-cloud.es.js
packages/uni-cloud/dist/uni-cloud.es.js
+0
-1
packages/uni-cloud/lib/uni.plugin.js
packages/uni-cloud/lib/uni.plugin.js
+62
-78
packages/uni-cloud/lib/validateFunction.js
packages/uni-cloud/lib/validateFunction.js
+14
-12
packages/uni-cloud/src/uni.plugin.ts
packages/uni-cloud/src/uni.plugin.ts
+119
-0
packages/uni-cloud/src/validateFunction.ts
packages/uni-cloud/src/validateFunction.ts
+15
-0
packages/uni-cloud/tsconfig.json
packages/uni-cloud/tsconfig.json
+11
-0
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+1
-1
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+1
-1
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+1
-1
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+1
-1
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+1
-1
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+1
-1
packages/vite-plugin-uni/src/config/define.ts
packages/vite-plugin-uni/src/config/define.ts
+11
-16
yarn.lock
yarn.lock
+37
-23
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
b55fe27c
...
@@ -1712,12 +1712,11 @@ var serviceContext = (function (vue) {
...
@@ -1712,12 +1712,11 @@ var serviceContext = (function (vue) {
return this;
return this;
},
},
};
};
var Emitter = E;
// TODO 等待 vue3 的兼容模式自带emitter
// TODO 等待 vue3 的兼容模式自带emitter
function initBridge(subscribeNamespace) {
function initBridge(subscribeNamespace) {
// TODO vue3 compatibility builds
// TODO vue3 compatibility builds
const emitter = new E
mitter
();
const emitter = new E();
return {
return {
on(event, callback) {
on(event, callback) {
return emitter.on(event, callback);
return emitter.on(event, callback);
...
@@ -2342,7 +2341,7 @@ var serviceContext = (function (vue) {
...
@@ -2342,7 +2341,7 @@ var serviceContext = (function (vue) {
},
},
];
];
const emitter = new E
mitter
();
const emitter = new E();
const $on = defineSyncApi(API_ON, (name, callback) => {
const $on = defineSyncApi(API_ON, (name, callback) => {
emitter.on(name, callback);
emitter.on(name, callback);
return () => emitter.off(name, callback);
return () => emitter.off(name, callback);
...
...
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
浏览文件 @
b55fe27c
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
define
=
void
0
;
exports
.
define
=
void
0
;
const
webpack_1
=
require
(
"
webpack
"
);
const
webpack_1
=
require
(
"
webpack
"
);
exports
.
define
=
new
webpack_1
.
DefinePlugin
({
const
shared_1
=
require
(
"
@vue/shared
"
);
'
process.env.NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
const
uni_cli_shared_1
=
require
(
"
@dcloudio/uni-cli-shared
"
);
'
process.env.VUE_APP_PLATFORM
'
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
exports
.
define
=
new
webpack_1
.
DefinePlugin
(
shared_1
.
extend
({
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
'
process.env.UNI_AUTOMATOR_WS_ENDPOINT
'
:
JSON
.
stringify
(
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
),
},
uni_cli_shared_1
.
initDefine
()));
});
packages/uni-cli-nvue/src/webpack/config/plugins/define.ts
浏览文件 @
b55fe27c
import
{
DefinePlugin
}
from
'
webpack
'
import
{
DefinePlugin
}
from
'
webpack
'
import
{
extend
}
from
'
@vue/shared
'
export
const
define
=
new
DefinePlugin
({
import
{
initDefine
}
from
'
@dcloudio/uni-cli-shared
'
'
process.env.NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
export
const
define
=
new
DefinePlugin
(
'
process.env.VUE_APP_PLATFORM
'
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
extend
(
{
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
process
.
env
.
HBX_USER_TOKEN
||
''
),
),
'
process.env.UNI_AUTOMATOR_WS_ENDPOINT
'
:
JSON
.
stringify
(
},
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
initDefine
()
)
,
)
}
)
)
packages/uni-cli-shared/src/env/define.ts
0 → 100644
浏览文件 @
b55fe27c
import
{
runByHBuilderX
}
from
'
../hbx/env
'
import
{
parseManifestJsonOnce
}
from
'
../json
'
export
function
initDefine
(
stringifyBoolean
:
boolean
=
false
)
{
const
manifestJson
=
parseManifestJsonOnce
(
process
.
env
.
UNI_INPUT_DIR
)
const
isRunByHBuilderX
=
runByHBuilderX
()
return
{
'
process.env.NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
'
process.env.UNI_APP_ID
'
:
JSON
.
stringify
(
manifestJson
.
appid
||
''
),
'
process.env.UNI_APP_NAME
'
:
JSON
.
stringify
(
manifestJson
.
name
||
''
),
'
process.env.UNI_PLATFORM
'
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
'
process.env.RUN_BY_HBUILDERX
'
:
stringifyBoolean
?
JSON
.
stringify
(
isRunByHBuilderX
)
:
isRunByHBuilderX
,
'
process.env.UNI_AUTOMATOR_WS_ENDPOINT
'
:
JSON
.
stringify
(
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
),
'
process.env.UNI_CLOUD_PROVIDER
'
:
JSON
.
stringify
(
process
.
env
.
UNI_CLOUD_PROVIDER
),
'
process.env.UNICLOUD_DEBUG
'
:
JSON
.
stringify
(
process
.
env
.
UNICLOUD_DEBUG
),
}
}
packages/uni-cli-shared/src/env/index.ts
0 → 100644
浏览文件 @
b55fe27c
export
{
initDefine
}
from
'
./define
'
export
{
initProvide
}
from
'
./provide
'
packages/uni-cli-shared/src/provide.ts
→
packages/uni-cli-shared/src/
env/
provide.ts
浏览文件 @
b55fe27c
文件已移动
packages/uni-cli-shared/src/index.ts
浏览文件 @
b55fe27c
export
*
from
'
./env
'
export
*
from
'
./hbx
'
export
*
from
'
./hbx
'
export
*
from
'
./logs
'
export
*
from
'
./logs
'
export
*
from
'
./ssr
'
export
*
from
'
./ssr
'
...
@@ -9,4 +10,3 @@ export * from './easycom'
...
@@ -9,4 +10,3 @@ export * from './easycom'
export
*
from
'
./constants
'
export
*
from
'
./constants
'
export
*
from
'
./preprocess
'
export
*
from
'
./preprocess
'
export
{
checkUpdate
}
from
'
./checkUpdate
'
export
{
checkUpdate
}
from
'
./checkUpdate
'
export
{
initProvide
}
from
'
./provide
'
packages/uni-cloud/dist/uni-cloud.cjs.js
已删除
100644 → 0
浏览文件 @
efb38cca
此差异已折叠。
点击以展开。
packages/uni-cloud/dist/uni-cloud.es.js
已删除
100644 → 0
浏览文件 @
efb38cca
此差异已折叠。
点击以展开。
packages/uni-cloud/lib/uni.plugin.js
浏览文件 @
b55fe27c
const
{
once
}
=
require
(
'
@dcloudio/uni-shared
'
)
'
use strict
'
const
{
Object
.
defineProperty
(
exports
,
'
__esModule
'
,
{
value
:
true
})
COMMON_EXCLUDE
,
const
uni_shared_1
=
require
(
'
@dcloudio/uni-shared
'
)
uniViteInjectPlugin
,
const
uni_cli_shared_1
=
require
(
'
@dcloudio/uni-cli-shared
'
)
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
validateFunction_1
=
require
(
'
./validateFunction
'
)
const
{
uniValidateFunctionPlugin
}
=
require
(
'
./validateFunction
'
)
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
([])
const
uniCloudSpaces
=
[]
initUniCloudEnv
()
/**
/**
* @type {import('vite').Plugin}
* @type {import('vite').Plugin}
*/
*/
const
UniCloudPlugin
=
{
const
UniCloudPlugin
=
{
name
:
'
vite:uni-cloud
'
,
name
:
'
vite:uni-cloud
'
,
config
(
config
)
{
config
(
config
)
{
initUniCloudEnv
(
config
)
const
silent
=
config
.
build
&&
config
.
build
.
ssr
?
true
:
false
return
{
if
(
silent
)
{
define
:
{
return
'
process.env.UNI_CLOUD_PROVIDER
'
:
JSON
.
stringify
(
}
process
.
env
.
UNI_CLOUD_PROVIDER
const
len
=
uniCloudSpaces
.
length
),
if
(
!
len
)
{
'
process.env.UNICLOUD_DEBUG
'
:
JSON
.
stringify
(
return
process
.
env
.
UNICLOUD_DEBUG
}
),
if
(
len
===
1
)
{
},
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
uniCloudSpaces
[
0
].
id
}
`
)
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
&&
!
process
.
env
.
UNI_SUB_PLATFORM
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
console
.
warn
(
'
发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
)
}
}
return
{}
},
},
configureServer
(
server
)
{
configureServer
(
server
)
{
if
(
server
.
httpServer
)
{
if
(
server
.
httpServer
)
{
server
.
httpServer
.
on
(
'
listening
'
,
()
=>
{
server
.
httpServer
.
on
(
'
listening
'
,
()
=>
{
if
(
!
process
.
UNI_CLOUD
)
{
return
}
process
.
nextTick
(()
=>
{
process
.
nextTick
(()
=>
{
initUniCloudWarningOnce
()
initUniCloudWarningOnce
()
})
})
...
@@ -46,38 +57,24 @@ const UniCloudPlugin = {
...
@@ -46,38 +57,24 @@ const UniCloudPlugin = {
}
}
},
},
}
}
const
initUniCloudWarningOnce
=
uni_shared_1
.
once
(()
=>
{
const
initUniCloudWarningOnce
=
once
(()
=>
{
uniCloudSpaces
.
length
&&
console
.
warn
(
console
.
warn
(
'
当前项目使用了uniCloud,为避免云函数调用跨域问题,建议在HBuilderX内置浏览器里调试,如使用外部浏览器需处理跨域,详见:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
'
当前项目使用了uniCloud,为避免云函数调用跨域问题,建议在HBuilderX内置浏览器里调试,如使用外部浏览器需处理跨域,详见:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
)
)
})
})
function
initUniCloudEnv
()
{
function
initUniCloudEnv
(
config
)
{
process
.
UNI_CLOUD
=
false
process
.
UNI_CLOUD_TCB
=
false
process
.
UNI_CLOUD_ALIYUN
=
false
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
([])
if
(
!
process
.
env
.
UNI_CLOUD_SPACES
)
{
if
(
!
process
.
env
.
UNI_CLOUD_SPACES
)
{
return
return
}
}
const
silent
=
config
.
build
&&
config
.
build
.
ssr
?
true
:
false
try
{
try
{
const
spaces
=
JSON
.
parse
(
process
.
env
.
UNI_CLOUD_SPACES
)
const
spaces
=
JSON
.
parse
(
process
.
env
.
UNI_CLOUD_SPACES
)
if
(
Array
.
isArray
(
spaces
))
{
if
(
!
Array
.
isArray
(
spaces
))
{
process
.
UNI_CLOUD
=
spaces
.
length
>
0
return
process
.
UNI_CLOUD_TCB
=
!!
spaces
.
find
((
space
)
=>
!
space
.
clientSecret
)
process
.
UNI_CLOUD_ALIYUN
=
!!
spaces
.
find
((
space
)
=>
space
.
clientSecret
)
if
(
spaces
.
length
===
1
)
{
const
space
=
spaces
[
0
]
!
silent
&&
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
space
.
id
}
`
)
}
}
spaces
.
forEach
((
s
)
=>
uniCloudSpaces
.
push
(
s
))
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
(
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
(
s
paces
.
map
((
space
)
=>
{
uniCloudS
paces
.
map
((
space
)
=>
{
if
(
space
.
clientSecret
)
{
if
(
space
.
clientSecret
)
{
return
{
return
{
provider
:
'
aliyun
'
,
provider
:
'
aliyun
'
,
...
@@ -95,26 +92,13 @@ function initUniCloudEnv(config) {
...
@@ -95,26 +92,13 @@ function initUniCloudEnv(config) {
}
}
})
})
)
)
}
}
catch
(
e
)
{}
}
catch
(
e
)
{}
if
(
process
.
UNI_CLOUD
&&
!
process
.
env
.
UNI_SUB_PLATFORM
&&
process
.
env
.
UNI_PLATFORM
===
'
h5
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
!
silent
&&
console
.
warn
(
'
发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
)
}
}
}
exports
.
default
=
[
module
.
exports
=
[
UniCloudPlugin
,
UniCloudPlugin
,
uniViteInjectPlugin
({
uni
_cli_shared_1
.
uni
ViteInjectPlugin
({
exclude
:
[...
COMMON_EXCLUDE
],
exclude
:
[...
uni_cli_shared_1
.
COMMON_EXCLUDE
],
uniCloud
:
[
'
@dcloudio/uni-cloud
'
,
'
default
'
],
uniCloud
:
[
'
@dcloudio/uni-cloud
'
,
'
default
'
],
}),
}),
uniValidateFunctionPlugin
(),
validateFunction_1
.
uniValidateFunctionPlugin
(),
]
]
packages/uni-cloud/lib/validateFunction.js
浏览文件 @
b55fe27c
'
use strict
'
Object
.
defineProperty
(
exports
,
'
__esModule
'
,
{
value
:
true
})
exports
.
uniValidateFunctionPlugin
=
void
0
function
replaceModuleExports
(
code
)
{
function
replaceModuleExports
(
code
)
{
return
code
.
replace
(
/module
\.
exports
\s
*=/
,
'
export default
'
)
return
code
.
replace
(
/module
\.
exports
\s
*=/
,
'
export default
'
)
}
}
module
.
exports
=
{
function
uniValidateFunctionPlugin
()
{
uniValidateFunctionPlugin
()
{
return
{
return
{
name
:
'
vite:uni-cloud-vf
'
,
name
:
'
vite:uni-cloud-vf
'
,
enforce
:
'
pre
'
,
enforce
:
'
pre
'
,
...
@@ -12,5 +14,5 @@ module.exports = {
...
@@ -12,5 +14,5 @@ module.exports = {
}
}
},
},
}
}
},
}
}
exports
.
uniValidateFunctionPlugin
=
uniValidateFunctionPlugin
packages/uni-cloud/src/uni.plugin.ts
0 → 100644
浏览文件 @
b55fe27c
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
{
COMMON_EXCLUDE
,
uniViteInjectPlugin
,
UniVitePlugin
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
uniValidateFunctionPlugin
}
from
'
./validateFunction
'
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
([])
const
uniCloudSpaces
:
{
id
:
string
name
:
string
clientSecret
?:
string
apiEndpoint
?:
string
}[]
=
[]
initUniCloudEnv
()
/**
* @type {import('vite').Plugin}
*/
const
UniCloudPlugin
:
UniVitePlugin
=
{
name
:
'
vite:uni-cloud
'
,
config
(
config
)
{
const
silent
=
config
.
build
&&
config
.
build
.
ssr
?
true
:
false
if
(
silent
)
{
return
}
const
len
=
uniCloudSpaces
.
length
if
(
!
len
)
{
return
}
if
(
len
===
1
)
{
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
uniCloudSpaces
[
0
].
id
}
`
)
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
&&
!
process
.
env
.
UNI_SUB_PLATFORM
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
console
.
warn
(
'
发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
)
}
return
{}
},
configureServer
(
server
)
{
if
(
server
.
httpServer
)
{
server
.
httpServer
.
on
(
'
listening
'
,
()
=>
{
process
.
nextTick
(()
=>
{
initUniCloudWarningOnce
()
})
})
}
else
{
initUniCloudWarningOnce
()
}
},
closeBundle
()
{
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
&&
!
process
.
env
.
UNI_SSR_CLIENT
)
{
console
.
log
()
console
.
log
(
'
欢迎将H5站部署到uniCloud前端网页托管平台,高速、免费、安全、省心,详见:
'
)
console
.
log
(
'
https://uniapp.dcloud.io/uniCloud/hosting
'
)
}
},
}
const
initUniCloudWarningOnce
=
once
(()
=>
{
uniCloudSpaces
.
length
&&
console
.
warn
(
'
当前项目使用了uniCloud,为避免云函数调用跨域问题,建议在HBuilderX内置浏览器里调试,如使用外部浏览器需处理跨域,详见:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5
'
)
})
function
initUniCloudEnv
()
{
if
(
!
process
.
env
.
UNI_CLOUD_SPACES
)
{
return
}
try
{
const
spaces
=
JSON
.
parse
(
process
.
env
.
UNI_CLOUD_SPACES
)
if
(
!
Array
.
isArray
(
spaces
))
{
return
}
spaces
.
forEach
((
s
)
=>
uniCloudSpaces
.
push
(
s
))
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
(
uniCloudSpaces
.
map
((
space
)
=>
{
if
(
space
.
clientSecret
)
{
return
{
provider
:
'
aliyun
'
,
spaceName
:
space
.
name
,
spaceId
:
space
.
id
,
clientSecret
:
space
.
clientSecret
,
endpoint
:
space
.
apiEndpoint
,
}
}
else
{
return
{
provider
:
'
tencent
'
,
spaceName
:
space
.
name
,
spaceId
:
space
.
id
,
}
}
})
)
}
catch
(
e
)
{}
}
export
default
[
UniCloudPlugin
,
uniViteInjectPlugin
({
exclude
:
[...
COMMON_EXCLUDE
],
uniCloud
:
[
'
@dcloudio/uni-cloud
'
,
'
default
'
],
}),
uniValidateFunctionPlugin
(),
]
packages/uni-cloud/src/validateFunction.ts
0 → 100644
浏览文件 @
b55fe27c
import
{
Plugin
}
from
'
vite
'
function
replaceModuleExports
(
code
:
string
)
{
return
code
.
replace
(
/module
\.
exports
\s
*=/
,
'
export default
'
)
}
export
function
uniValidateFunctionPlugin
():
Plugin
{
return
{
name
:
'
vite:uni-cloud-vf
'
,
enforce
:
'
pre
'
,
transform
(
code
,
id
)
{
if
(
id
.
includes
(
'
validator/validateFunction
'
))
{
return
replaceModuleExports
(
code
)
}
},
}
}
packages/uni-cloud/tsconfig.json
0 → 100644
浏览文件 @
b55fe27c
{
"extends"
:
"../../tsconfig.node.json"
,
"compilerOptions"
:
{
"outDir"
:
"lib"
},
"include"
:
[
"src"
,
"../shims-node.d.ts"
,
"../shims-uni-app.d.ts"
]
}
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
b55fe27c
...
@@ -1255,4 +1255,4 @@ var protocols = /*#__PURE__*/Object.freeze({
...
@@ -1255,4 +1255,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
var
index
=
initUni
(
shims
,
protocols
);
export
{
index
as
default
}
;
export
default
index
;
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
b55fe27c
...
@@ -825,4 +825,4 @@ var protocols = /*#__PURE__*/Object.freeze({
...
@@ -825,4 +825,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
var
index
=
initUni
(
shims
,
protocols
);
export
{
index
as
default
}
;
export
default
index
;
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
b55fe27c
...
@@ -726,4 +726,4 @@ var protocols = /*#__PURE__*/Object.freeze({
...
@@ -726,4 +726,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
var
index
=
initUni
(
shims
,
protocols
);
export
{
index
as
default
}
;
export
default
index
;
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
b55fe27c
...
@@ -791,4 +791,4 @@ var protocols = /*#__PURE__*/Object.freeze({
...
@@ -791,4 +791,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
var
index
=
initUni
(
shims
,
protocols
);
export
{
index
as
default
}
;
export
default
index
;
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
b55fe27c
...
@@ -689,4 +689,4 @@ var protocols = /*#__PURE__*/Object.freeze({
...
@@ -689,4 +689,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
var
index
=
initUni
(
shims
,
protocols
);
export
{
index
as
default
}
;
export
default
index
;
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
b55fe27c
...
@@ -733,4 +733,4 @@ var protocols = /*#__PURE__*/Object.freeze({
...
@@ -733,4 +733,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
var
index
=
initUni
(
shims
,
protocols
);
export
{
index
as
default
}
;
export
default
index
;
packages/vite-plugin-uni/src/config/define.ts
浏览文件 @
b55fe27c
import
{
UserConfig
}
from
'
vite
'
import
{
UserConfig
}
from
'
vite
'
import
{
extend
}
from
'
@vue/shared
'
import
{
initDefine
}
from
'
@dcloudio/uni-cli-shared
'
import
{
VitePluginUniResolvedOptions
}
from
'
..
'
import
{
VitePluginUniResolvedOptions
}
from
'
..
'
import
{
parseManifestJsonOnce
,
runByHBuilderX
,
}
from
'
../../../uni-cli-shared/dist
'
export
function
createDefine
(
{
export
function
createDefine
(
platform
,
_
:
VitePluginUniResolvedOptions
}:
VitePluginUniResolvedOptions
):
UserConfig
[
'
define
'
]
{
):
UserConfig
[
'
define
'
]
{
const
manifestJson
=
parseManifestJsonOnce
(
process
.
env
.
UNI_INPUT_DIR
)
return
extend
(
return
{
{
__VUE_PROD_DEVTOOLS__
:
false
,
__VUE_PROD_DEVTOOLS__
:
false
,
'
process.env.NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
},
'
process.env.UNI_APP_ID
'
:
JSON
.
stringify
(
manifestJson
.
appid
||
''
),
initDefine
()
'
process.env.UNI_APP_NAME
'
:
JSON
.
stringify
(
manifestJson
.
name
||
''
),
)
'
process.env.UNI_PLATFORM
'
:
JSON
.
stringify
(
platform
),
'
process.env.RUN_BY_HBUILDERX
'
:
runByHBuilderX
(),
}
}
}
yarn.lock
浏览文件 @
b55fe27c
...
@@ -2279,34 +2279,38 @@
...
@@ -2279,34 +2279,38 @@
"@typescript-eslint/typescript-estree" "4.28.4"
"@typescript-eslint/typescript-estree" "4.28.4"
debug "^4.3.1"
debug "^4.3.1"
"@typescript-eslint/scope-manager@4.28.5":
"@typescript-eslint/scope-manager@4.28.4":
version "4.28.5"
version "4.28.4"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.28.5.tgz#3a1b70c50c1535ac33322786ea99ebe403d3b923"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.28.4.tgz#bdbce9b6a644e34f767bd68bc17bb14353b9fe7f"
integrity sha512-ZJBNs4usViOmlyFMt9X9l+X0WAFcDH7EdSArGqpldXu7aeZxDAuAzHiMAeI+JpSefY2INHrXeqnha39FVqXb8w==
dependencies:
dependencies:
"@typescript-eslint/types" "4.28.
5
"
"@typescript-eslint/types" "4.28.
4
"
"@typescript-eslint/visitor-keys" "4.28.
5
"
"@typescript-eslint/visitor-keys" "4.28.
4
"
"@typescript-eslint/types@4.28.5":
"@typescript-eslint/types@4.28.4":
version "4.28.5"
version "4.28.4"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.28.5.tgz#d33edf8e429f0c0930a7c3d44e9b010354c422e9"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.28.4.tgz#41acbd79b5816b7c0dd7530a43d97d020d3aeb42"
integrity sha512-3eap4QWxGqkYuEmVebUGULMskR6Cuoc/Wii0oSOddleP4EGx1tjLnZQ0ZP33YRoMDCs5O3j56RBV4g14T4jvww==
"@typescript-eslint/typescript-estree@4.28.5":
"@typescript-eslint/typescript-estree@4.28.4":
version "4.28.5"
version "4.28.4"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.5.tgz#4906d343de693cf3d8dcc301383ed638e0441cd1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.4.tgz#252e6863278dc0727244be9e371eb35241c46d00"
integrity sha512-z7d8HK8XvCRyN2SNp+OXC2iZaF+O2BTquGhEYLKLx5k6p0r05ureUtgEfo5f6anLkhCxdHtCf6rPM1p4efHYDQ==
dependencies:
dependencies:
"@typescript-eslint/types" "4.28.
5
"
"@typescript-eslint/types" "4.28.
4
"
"@typescript-eslint/visitor-keys" "4.28.
5
"
"@typescript-eslint/visitor-keys" "4.28.
4
"
debug "^4.3.1"
debug "^4.3.1"
globby "^11.0.3"
globby "^11.0.3"
is-glob "^4.0.1"
is-glob "^4.0.1"
semver "^7.3.5"
semver "^7.3.5"
tsutils "^3.21.0"
tsutils "^3.21.0"
"@typescript-eslint/visitor-keys@4.28.5":
"@typescript-eslint/visitor-keys@4.28.4":
version "4.28.5"
version "4.28.4"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.5.tgz#ffee2c602762ed6893405ee7c1144d9cc0a29675"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.4.tgz#92dacfefccd6751cbb0a964f06683bfd72d0c4d3"
integrity sha512-NIAXAdbz1XdOuzqkJHjNKXKj8QQ4cv5cxR/g0uQhCYf/6//XrmfpaYsM7PnBcNbfvTDLUkqQ5TPNm1sozDdTWg==
dependencies:
dependencies:
"@typescript-eslint/types" "4.28.
5
"
"@typescript-eslint/types" "4.28.
4
"
eslint-visitor-keys "^2.0.0"
eslint-visitor-keys "^2.0.0"
"@vitejs/plugin-legacy@^1.5.0":
"@vitejs/plugin-legacy@^1.5.0":
...
@@ -6175,9 +6179,10 @@ miller-rabin@^4.0.0:
...
@@ -6175,9 +6179,10 @@ miller-rabin@^4.0.0:
bn.js "^4.0.0"
bn.js "^4.0.0"
brorand "^1.0.1"
brorand "^1.0.1"
mime-db@1.49.0:
mime-db@1.48.0:
version "1.49.0"
version "1.48.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.49.0.tgz#f3dfde60c99e9cf3bc9701d687778f537001cbed"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d"
integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==
mime-types@^2.1.12, mime-types@^2.1.27, mime-types@~2.1.19, mime-types@~2.1.24:
mime-types@^2.1.12, mime-types@^2.1.27, mime-types@~2.1.19, mime-types@~2.1.24:
version "2.1.31"
version "2.1.31"
...
@@ -7812,6 +7817,11 @@ sort-keys@^4.0.0:
...
@@ -7812,6 +7817,11 @@ sort-keys@^4.0.0:
dependencies:
dependencies:
is-plain-obj "^2.0.0"
is-plain-obj "^2.0.0"
source-list-map@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==
source-map-js@^0.6.2:
source-map-js@^0.6.2:
version "0.6.2"
version "0.6.2"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e"
...
@@ -8622,9 +8632,13 @@ webidl-conversions@^6.1.0:
...
@@ -8622,9 +8632,13 @@ webidl-conversions@^6.1.0:
version "6.1.0"
version "6.1.0"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514"
webpack-sources@^3.0.1:
webpack-sources@^2.3.1:
version "3.0.3"
version "2.3.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.0.3.tgz#33c478e1f67bf5577d3ec5ced4bded0a06ec88d0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.1.tgz#570de0af163949fe272233c2cefe1b56f74511fd"
integrity sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==
dependencies:
source-list-map "^2.0.1"
source-map "^0.6.1"
webpack@^5.1.0, webpack@^5.45.1:
webpack@^5.1.0, webpack@^5.45.1:
version "5.46.0"
version "5.46.0"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录