Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
b2e1e8d5
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,发现更多精彩内容 >>
提交
b2e1e8d5
编写于
11月 10, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mp): support build subpackage
上级
bb489034
变更
29
显示空白变更内容
内联
并排
Showing
29 changed file
with
496 addition
and
46 deletion
+496
-46
packages/shims-node.d.ts
packages/shims-node.d.ts
+1
-0
packages/uni-cli-shared/src/env/define.ts
packages/uni-cli-shared/src/env/define.ts
+1
-0
packages/uni-cli-shared/src/json/mp/jsonFile.ts
packages/uni-cli-shared/src/json/mp/jsonFile.ts
+19
-6
packages/uni-cli-shared/src/utils.ts
packages/uni-cli-shared/src/utils.ts
+3
-0
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+47
-13
packages/uni-mp-alipay/src/runtime/index.ts
packages/uni-mp-alipay/src/runtime/index.ts
+3
-1
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+41
-2
packages/uni-mp-baidu/src/runtime/index.ts
packages/uni-mp-baidu/src/runtime/index.ts
+3
-0
packages/uni-mp-core/src/index.ts
packages/uni-mp-core/src/index.ts
+1
-1
packages/uni-mp-core/src/runtime/app.ts
packages/uni-mp-core/src/runtime/app.ts
+40
-1
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+41
-2
packages/uni-mp-kuaishou/src/runtime/index.ts
packages/uni-mp-kuaishou/src/runtime/index.ts
+3
-0
packages/uni-mp-lark/dist/uni.mp.esm.js
packages/uni-mp-lark/dist/uni.mp.esm.js
+41
-2
packages/uni-mp-lark/src/runtime/index.ts
packages/uni-mp-lark/src/runtime/index.ts
+3
-0
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+43
-3
packages/uni-mp-qq/src/runtime/index.ts
packages/uni-mp-qq/src/runtime/index.ts
+2
-0
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+41
-2
packages/uni-mp-toutiao/src/runtime/index.ts
packages/uni-mp-toutiao/src/runtime/index.ts
+3
-0
packages/uni-mp-vite/src/index.ts
packages/uni-mp-vite/src/index.ts
+9
-1
packages/uni-mp-vite/src/plugin/configResolved.ts
packages/uni-mp-vite/src/plugin/configResolved.ts
+5
-1
packages/uni-mp-vite/src/plugins/subpackage.ts
packages/uni-mp-vite/src/plugins/subpackage.ts
+36
-0
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+5
-2
packages/uni-mp-vue/src/plugin.ts
packages/uni-mp-vue/src/plugin.ts
+5
-2
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+41
-2
packages/uni-mp-weixin/src/runtime/index.ts
packages/uni-mp-weixin/src/runtime/index.ts
+3
-0
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+41
-2
packages/uni-quickapp-webview/src/runtime/index.ts
packages/uni-quickapp-webview/src/runtime/index.ts
+3
-0
packages/vite-plugin-uni/src/cli/index.ts
packages/vite-plugin-uni/src/cli/index.ts
+4
-2
packages/vite-plugin-uni/src/cli/utils.ts
packages/vite-plugin-uni/src/cli/utils.ts
+8
-1
未找到文件。
packages/shims-node.d.ts
浏览文件 @
b2e1e8d5
...
...
@@ -9,6 +9,7 @@ declare namespace NodeJS {
UNI_INPUT_DIR
:
string
UNI_OUTPUT_DIR
:
string
UNI_CLI_CONTEXT
:
string
UNI_SUBPACKAGE
?:
string
UNI_COMPILER_VERSION
:
string
UNI_COMPILER_VERSION_TYPE
:
'
a
'
|
'
r
'
UNI_HBUILDERX_PLUGINS
:
string
...
...
packages/uni-cli-shared/src/env/define.ts
浏览文件 @
b2e1e8d5
...
...
@@ -13,6 +13,7 @@ export function initDefine(stringifyBoolean: boolean = false) {
'
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.UNI_SUBPACKAGE
'
:
JSON
.
stringify
(
process
.
env
.
UNI_SUBPACKAGE
),
'
process.env.UNI_COMPILER_VERSION
'
:
JSON
.
stringify
(
process
.
env
.
UNI_COMPILER_VERSION
),
...
...
packages/uni-cli-shared/src/json/mp/jsonFile.ts
浏览文件 @
b2e1e8d5
import
{
extend
}
from
'
@vue/shared
'
import
{
ComponentJson
,
PageWindowOptions
,
UsingComponents
}
from
'
./types
'
import
{
normalizeNodeModules
}
from
'
../../utils
'
import
{
removeExt
,
relativeFile
,
normalizeNodeModules
}
from
'
../../utils
'
let
appJsonCache
:
Record
<
string
,
any
>
=
{}
const
jsonFilesCache
=
new
Map
<
string
,
string
>
()
...
...
@@ -8,6 +8,10 @@ const jsonPagesCache = new Map<string, PageWindowOptions>()
const
jsonComponentsCache
=
new
Map
<
string
,
ComponentJson
>
()
const
jsonUsingComponentsCache
=
new
Map
<
string
,
UsingComponents
>
()
export
function
isPageFile
(
file
:
string
)
{
return
jsonPagesCache
.
has
(
removeExt
(
file
))
}
export
function
hasJsonFile
(
filename
:
string
)
{
return
(
filename
===
'
app
'
||
...
...
@@ -22,16 +26,25 @@ export function normalizeJsonFilename(filename: string) {
export
function
findChangedJsonFiles
()
{
const
changedJsonFiles
=
new
Map
<
string
,
string
>
()
function
findChangedFile
(
name
:
string
,
json
:
Record
<
string
,
any
>
)
{
function
findChangedFile
(
file
name
:
string
,
json
:
Record
<
string
,
any
>
)
{
const
newJson
=
extend
({},
json
)
if
(
!
newJson
.
usingComponents
)
{
newJson
.
usingComponents
=
{}
}
extend
(
newJson
.
usingComponents
,
jsonUsingComponentsCache
.
get
(
name
))
extend
(
newJson
.
usingComponents
,
jsonUsingComponentsCache
.
get
(
filename
))
const
usingComponents
=
newJson
.
usingComponents
// 格式化为相对路径,这样作为分包也可以直接运行
Object
.
keys
(
usingComponents
).
forEach
((
name
)
=>
{
usingComponents
[
name
]
=
relativeFile
(
filename
,
usingComponents
[
name
].
slice
(
1
)
)
})
const
jsonStr
=
JSON
.
stringify
(
newJson
,
null
,
2
)
if
(
jsonFilesCache
.
get
(
name
)
!==
jsonStr
)
{
changedJsonFiles
.
set
(
name
,
jsonStr
)
jsonFilesCache
.
set
(
name
,
jsonStr
)
if
(
jsonFilesCache
.
get
(
file
name
)
!==
jsonStr
)
{
changedJsonFiles
.
set
(
file
name
,
jsonStr
)
jsonFilesCache
.
set
(
file
name
,
jsonStr
)
}
}
function
findChangedFiles
(
jsonsCache
:
Map
<
string
,
any
>
)
{
...
...
packages/uni-cli-shared/src/utils.ts
浏览文件 @
b2e1e8d5
...
...
@@ -19,6 +19,9 @@ export function normalizePath(id: string): string {
return
isWindows
?
id
.
replace
(
/
\\
/g
,
'
/
'
)
:
id
}
export
function
relativeFile
(
from
:
string
,
to
:
string
)
{
return
normalizePath
(
path
.
relative
(
path
.
dirname
(
from
),
to
))
}
export
function
checkElementNodeTag
(
node
:
RootNode
|
TemplateChildNode
|
null
|
undefined
,
tag
:
string
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -334,6 +334,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
my
.
onAppShow
)
{
my
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
my
.
onAppHide
)
{
my
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
my
.
getLaunchOptionsSync
&&
my
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
my
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -571,20 +608,15 @@ function onAliGetAuthorize(method, $event) {
my
.
getPhoneNumber
({
success
:
(
res
)
=>
{
$event
.
type
=
'
getphonenumber
'
;
const
response
=
JSON
.
parse
(
res
.
response
).
response
;
if
(
response
.
code
===
'
10000
'
)
{
// success
const
response
=
JSON
.
parse
(
res
.
response
);
$event
.
detail
.
errMsg
=
'
getPhoneNumber:ok
'
;
$event
.
detail
.
encryptedData
=
res
.
response
;
}
else
{
$event
.
detail
.
errMsg
=
'
getPhoneNumber:fail Error:
'
+
res
.
response
;
}
$event
.
detail
.
encryptedData
=
response
.
response
;
$event
.
detail
.
sign
=
response
.
sign
;
this
[
method
](
$event
);
},
fail
:
()
=>
{
fail
:
(
res
)
=>
{
$event
.
type
=
'
getphonenumber
'
;
$event
.
detail
.
errMsg
=
'
getPhoneNumber:fail
'
;
$event
.
detail
.
errMsg
=
'
getPhoneNumber:fail
Error:
'
+
JSON
.
stringify
(
res
)
;
this
[
method
](
$event
);
},
});
...
...
@@ -983,9 +1015,11 @@ function initCreateComponent() {
const
createApp
=
initCreateApp
(
parseAppOptions
);
const
createPage
=
initCreatePage
();
const
createComponent
=
initCreateComponent
();
const
createSubpackageApp
=
initCreateSubpackageApp
(
parseAppOptions
);
my
.
EventChannel
=
EventChannel
;
my
.
createApp
=
createApp
;
my
.
createPage
=
createPage
;
my
.
createComponent
=
createComponent
;
my
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-alipay/src/runtime/index.ts
浏览文件 @
b2e1e8d5
import
{
EventChannel
}
from
'
@dcloudio/uni-shared
'
import
{
initCreateApp
}
from
'
@dcloudio/uni-mp-core
'
import
{
initCreateApp
,
initCreateSubpackageApp
}
from
'
@dcloudio/uni-mp-core
'
import
*
as
parseAppOptions
from
'
./parseAppOptions
'
...
...
@@ -9,7 +9,9 @@ import { initCreateComponent } from './createComponent'
export
const
createApp
=
initCreateApp
(
parseAppOptions
)
export
const
createPage
=
initCreatePage
()
export
const
createComponent
=
initCreateComponent
()
export
const
createSubpackageApp
=
initCreateSubpackageApp
(
parseAppOptions
)
;(
my
as
any
).
EventChannel
=
EventChannel
;(
my
as
any
).
createApp
=
createApp
;(
my
as
any
).
createPage
=
createPage
;(
my
as
any
).
createComponent
=
createComponent
;(
my
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -323,6 +323,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
swan
.
onAppShow
)
{
swan
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
swan
.
onAppHide
)
{
swan
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
swan
.
getLaunchOptionsSync
&&
swan
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
swan
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -979,9 +1016,11 @@ var parsePageOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
(
parseAppOptions
);
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
const
createSubpackageApp
=
initCreateSubpackageApp
(
parseAppOptions
);
swan
.
EventChannel
=
EventChannel
;
swan
.
createApp
=
global
.
createApp
=
createApp
;
swan
.
createPage
=
createPage
;
swan
.
createComponent
=
createComponent
;
swan
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-baidu/src/runtime/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -3,6 +3,7 @@ import {
initCreateApp
,
initCreatePage
,
initCreateComponent
,
initCreateSubpackageApp
,
}
from
'
@dcloudio/uni-mp-core
'
import
'
@dcloudio/uni-mp-polyfill
'
...
...
@@ -14,7 +15,9 @@ import * as parseComponentOptions from './parseComponentOptions'
export
const
createApp
=
initCreateApp
(
parseAppOptions
)
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
export
const
createSubpackageApp
=
initCreateSubpackageApp
(
parseAppOptions
)
;(
swan
as
any
).
EventChannel
=
EventChannel
;(
swan
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
swan
as
any
).
createPage
=
createPage
;(
swan
as
any
).
createComponent
=
createComponent
;(
swan
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-core/src/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -7,7 +7,7 @@ declare module '@vue/runtime-core' {
}
}
export
{
initCreateApp
}
from
'
./runtime/app
'
export
{
initCreateApp
,
initCreateSubpackageApp
}
from
'
./runtime/app
'
export
{
initCreatePage
}
from
'
./runtime/page
'
export
{
initCreateComponent
}
from
'
./runtime/component
'
...
...
packages/uni-mp-core/src/runtime/app.ts
浏览文件 @
b2e1e8d5
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
hasOwn
,
isFunction
}
from
'
@vue/shared
'
import
{
ComponentPublicInstance
,
ComponentOptions
,
ref
}
from
'
vue
'
import
{
initBaseInstance
}
from
'
./componentInstance
'
...
...
@@ -95,6 +95,45 @@ export function initCreateApp(parseAppOptions?: ParseAppOptions) {
}
}
export
function
initCreateSubpackageApp
(
parseAppOptions
?:
ParseAppOptions
)
{
return
function
createApp
(
vm
:
ComponentPublicInstance
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
)
const
app
=
getApp
({
allowDefault
:
true
,
})
;(
vm
.
$
as
any
).
ctx
.
$scope
=
app
const
globalData
=
app
.
globalData
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
]
}
})
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
]
}
})
if
(
isFunction
(
appOptions
.
onShow
)
&&
__GLOBAL__
.
onAppShow
)
{
__GLOBAL__
.
onAppShow
((
args
:
unknown
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
)
})
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
__GLOBAL__
.
onAppHide
)
{
__GLOBAL__
.
onAppHide
((
args
:
unknown
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
)
})
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
__GLOBAL__
.
getLaunchOptionsSync
&&
__GLOBAL__
.
getLaunchOptionsSync
()
vm
.
$callHook
(
'
onLaunch
'
,
args
)
}
return
App
(
appOptions
)
}
}
function
initLocale
(
appVm
:
ComponentPublicInstance
)
{
const
locale
=
ref
<
string
>
(
__GLOBAL__
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -323,6 +323,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
ks
.
onAppShow
)
{
ks
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
ks
.
onAppHide
)
{
ks
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
ks
.
getLaunchOptionsSync
&&
ks
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
ks
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -886,9 +923,11 @@ var parseComponentOptions = extend({}, baseParseOptions, {
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
const
createSubpackageApp
=
initCreateSubpackageApp
();
ks
.
EventChannel
=
EventChannel
;
ks
.
createApp
=
global
.
createApp
=
createApp
;
ks
.
createPage
=
createPage
;
ks
.
createComponent
=
createComponent
;
ks
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-kuaishou/src/runtime/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -3,6 +3,7 @@ import {
initCreateApp
,
initCreatePage
,
initCreateComponent
,
initCreateSubpackageApp
,
}
from
'
@dcloudio/uni-mp-core
'
import
'
@dcloudio/uni-mp-polyfill
'
...
...
@@ -12,7 +13,9 @@ import parseComponentOptions from './parseComponentOptions'
export
const
createApp
=
initCreateApp
()
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
export
const
createSubpackageApp
=
initCreateSubpackageApp
()
;(
ks
as
any
).
EventChannel
=
EventChannel
;(
ks
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
ks
as
any
).
createPage
=
createPage
;(
ks
as
any
).
createComponent
=
createComponent
;(
ks
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-lark/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -322,6 +322,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
tt
.
onAppShow
)
{
tt
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
tt
.
onAppHide
)
{
tt
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
tt
.
getLaunchOptionsSync
&&
tt
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
tt
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -961,9 +998,11 @@ var parsePageOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
const
createSubpackageApp
=
initCreateSubpackageApp
();
tt
.
EventChannel
=
EventChannel
;
tt
.
createApp
=
global
.
createApp
=
createApp
;
tt
.
createPage
=
createPage
;
tt
.
createComponent
=
createComponent
;
tt
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-lark/src/runtime/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -3,6 +3,7 @@ import {
initCreateApp
,
initCreatePage
,
initCreateComponent
,
initCreateSubpackageApp
,
}
from
'
@dcloudio/uni-mp-core
'
import
'
@dcloudio/uni-mp-polyfill
'
...
...
@@ -13,7 +14,9 @@ import * as parseComponentOptions from '@dcloudio/uni-mp-toutiao/src/runtime/par
export
const
createApp
=
initCreateApp
()
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
export
const
createSubpackageApp
=
initCreateSubpackageApp
()
;(
tt
as
any
).
EventChannel
=
EventChannel
;(
tt
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
tt
as
any
).
createPage
=
createPage
;(
tt
as
any
).
createComponent
=
createComponent
;(
tt
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -319,6 +319,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
qq
.
onAppShow
)
{
qq
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
qq
.
onAppHide
)
{
qq
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
qq
.
getLaunchOptionsSync
&&
qq
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
qq
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -781,13 +818,16 @@ var parseOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parseOptions
);
const
createComponent
=
initCreateComponent
(
parseOptions
);
const
createSubpackageApp
=
initCreateSubpackageApp
();
wx
.
createApp
=
global
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent
;
wx
.
createSubpackageApp
=
createSubpackageApp
;
qq
.
EventChannel
=
EventChannel
;
qq
.
createApp
=
global
.
createApp
=
createApp
;
qq
.
createPage
=
createPage
;
qq
.
createComponent
=
createComponent
;
qq
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-qq/src/runtime/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -3,6 +3,7 @@ import {
createApp
,
createPage
,
createComponent
,
createSubpackageApp
,
}
from
'
@dcloudio/uni-mp-weixin/src/runtime
'
export
*
from
'
@dcloudio/uni-mp-weixin/src/runtime
'
...
...
@@ -10,3 +11,4 @@ export * from '@dcloudio/uni-mp-weixin/src/runtime'
;(
qq
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
qq
as
any
).
createPage
=
createPage
;(
qq
as
any
).
createComponent
=
createComponent
;(
qq
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -322,6 +322,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
tt
.
onAppShow
)
{
tt
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
tt
.
onAppHide
)
{
tt
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
tt
.
getLaunchOptionsSync
&&
tt
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
tt
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -977,9 +1014,11 @@ var parsePageOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
const
createSubpackageApp
=
initCreateSubpackageApp
();
tt
.
EventChannel
=
EventChannel
;
tt
.
createApp
=
global
.
createApp
=
createApp
;
tt
.
createPage
=
createPage
;
tt
.
createComponent
=
createComponent
;
tt
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-toutiao/src/runtime/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -3,6 +3,7 @@ import {
initCreateApp
,
initCreatePage
,
initCreateComponent
,
initCreateSubpackageApp
,
}
from
'
@dcloudio/uni-mp-core
'
import
'
@dcloudio/uni-mp-polyfill
'
...
...
@@ -13,7 +14,9 @@ import * as parseComponentOptions from './parseComponentOptions'
export
const
createApp
=
initCreateApp
()
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
export
const
createSubpackageApp
=
initCreateSubpackageApp
()
;(
tt
as
any
).
EventChannel
=
EventChannel
;(
tt
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
tt
as
any
).
createPage
=
createPage
;(
tt
as
any
).
createComponent
=
createComponent
;(
tt
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-vite/src/index.ts
浏览文件 @
b2e1e8d5
import
{
extend
}
from
'
@vue/shared
'
import
type
{
SFCScriptCompileOptions
}
from
'
@vue/compiler-sfc
'
import
{
initProvide
,
uniViteInjectPlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
{
uniMiniProgramPlugin
,
UniMiniProgramPluginOptions
}
from
'
./plugin
'
import
{
uniUsingComponentsPlugin
}
from
'
./plugins/usingComponents
'
import
{
uniMainJsPlugin
}
from
'
./plugins/mainJs
'
import
{
uniManifestJsonPlugin
}
from
'
./plugins/manifestJson
'
import
{
uniPagesJsonPlugin
}
from
'
./plugins/pagesJson
'
import
{
uniEntryPlugin
}
from
'
./plugins/entry
'
import
type
{
SFCScriptCompileOptions
}
from
'
@vue/compiler-sfc
'
import
{
uniRenderjsPlugin
}
from
'
./plugins/renderjs
'
import
{
uniSubpackagePlugin
}
from
'
./plugins/subpackage
'
export
{
UniMiniProgramPluginOptions
}
from
'
./plugin
'
export
default
(
options
:
UniMiniProgramPluginOptions
)
=>
{
if
(
!
options
.
app
.
subpackages
)
{
delete
process
.
env
.
UNI_SUBPACKAGE
}
return
[
(
options
:
{
vueOptions
?:
{
script
?:
Partial
<
SFCScriptCompileOptions
>
}
...
...
@@ -28,5 +35,6 @@ export default (options: UniMiniProgramPluginOptions) => {
})
=>
{
return
uniUsingComponentsPlugin
(
options
.
vueOptions
?.
script
)
},
...(
process
.
env
.
UNI_SUBPACKAGE
?
[
uniSubpackagePlugin
(
options
)]
:
[]),
]
}
packages/uni-mp-vite/src/plugin/configResolved.ts
浏览文件 @
b2e1e8d5
...
...
@@ -10,6 +10,7 @@ import {
removeExt
,
transformScopedCss
,
normalizeMiniProgramFilename
,
relativeFile
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
UniMiniProgramPluginOptions
}
from
'
.
'
import
{
getNVueCssPaths
}
from
'
../plugins/pagesJson
'
...
...
@@ -67,7 +68,10 @@ export function createConfigResolved({
const
normalized
=
normalizePath
(
filename
)
if
(
nvueCssPaths
.
find
((
pageCssPath
)
=>
pageCssPath
===
normalized
))
{
debugNVueCss
(
normalized
)
return
`@import "/nvue
${
extname
}
";\n`
+
cssCode
return
(
`@import "
${
relativeFile
(
normalized
,
'
nvue
'
+
extname
)}
";\n`
+
cssCode
)
}
return
cssCode
},
...
...
packages/uni-mp-vite/src/plugins/subpackage.ts
0 → 100644
浏览文件 @
b2e1e8d5
import
{
OutputAsset
,
OutputChunk
}
from
'
rollup
'
import
type
{
Plugin
}
from
'
vite
'
import
{
isPageFile
,
relativeFile
}
from
'
@dcloudio/uni-cli-shared
'
import
{
UniMiniProgramPluginOptions
}
from
'
../plugin
'
export
function
uniSubpackagePlugin
({
style
:
{
extname
},
}:
UniMiniProgramPluginOptions
):
Plugin
{
return
{
name
:
'
vite:uni-mp-subpackage
'
,
enforce
:
'
post
'
,
generateBundle
(
_
,
bundle
)
{
;[
'
project.config.json
'
,
'
app.json
'
].
forEach
((
name
)
=>
{
delete
bundle
[
name
]
})
const
appJsFile
=
'
app.js
'
const
appCssFile
=
'
app
'
+
extname
Object
.
keys
(
bundle
).
forEach
((
name
)
=>
{
if
(
!
isPageFile
(
name
))
{
return
}
// 仅页面级 wxss 需要补充 app.wxss
if
(
name
.
endsWith
(
extname
))
{
const
cssFile
=
bundle
[
name
]
as
OutputAsset
cssFile
.
source
=
`@import "
${
relativeFile
(
name
,
appCssFile
)}
";\n`
+
cssFile
.
source
.
toString
()
}
else
if
(
name
.
endsWith
(
'
.js
'
))
{
const
jsFile
=
bundle
[
name
]
as
OutputChunk
jsFile
.
code
=
`require('
${
relativeFile
(
name
,
appJsFile
)}
');\n`
+
jsFile
.
code
}
})
},
}
}
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -4898,12 +4898,15 @@ var plugin = {
},
};
function
getCreateApp
()
{
const
method
=
process
.
env
.
UNI_SUBPACKAGE
?
'
createSubpackageApp
'
:
'
createApp
'
;
if
(
typeof
global
!==
'
undefined
'
)
{
return
global
.
createApp
;
return
global
[
method
]
;
}
else
if
(
typeof
my
!==
'
undefined
'
)
{
// 支付宝小程序没有global
return
my
.
createApp
;
return
my
[
method
]
;
}
}
...
...
packages/uni-mp-vue/src/plugin.ts
浏览文件 @
b2e1e8d5
...
...
@@ -28,10 +28,13 @@ export default {
}
function
getCreateApp
()
{
const
method
=
process
.
env
.
UNI_SUBPACKAGE
?
'
createSubpackageApp
'
:
'
createApp
'
if
(
typeof
global
!==
'
undefined
'
)
{
return
(
global
as
any
)
.
createApp
return
(
global
as
any
)
[
method
]
}
else
if
(
typeof
my
!==
'
undefined
'
)
{
// 支付宝小程序没有global
return
(
my
as
any
)
.
createApp
return
(
my
as
any
)
[
method
]
}
}
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -256,6 +256,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
wx
.
onAppShow
)
{
wx
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
wx
.
onAppHide
)
{
wx
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
wx
.
getLaunchOptionsSync
&&
wx
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
wx
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -721,8 +758,10 @@ var parseOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parseOptions
);
const
createComponent
=
initCreateComponent
(
parseOptions
);
const
createSubpackageApp
=
initCreateSubpackageApp
();
wx
.
createApp
=
global
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent
;
wx
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-weixin/src/runtime/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -2,6 +2,7 @@ import {
initCreateApp
,
initCreatePage
,
initCreateComponent
,
initCreateSubpackageApp
,
}
from
'
@dcloudio/uni-mp-core
'
import
'
@dcloudio/uni-mp-polyfill
'
...
...
@@ -11,6 +12,8 @@ import * as parseOptions from './parseOptions'
export
const
createApp
=
initCreateApp
()
export
const
createPage
=
initCreatePage
(
parseOptions
)
export
const
createComponent
=
initCreateComponent
(
parseOptions
)
export
const
createSubpackageApp
=
initCreateSubpackageApp
()
;(
wx
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
wx
as
any
).
createPage
=
createPage
;(
wx
as
any
).
createComponent
=
createComponent
;(
wx
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
b2e1e8d5
...
...
@@ -319,6 +319,43 @@ function initCreateApp(parseAppOptions) {
return
App
(
parseApp
(
vm
,
parseAppOptions
));
};
}
function
initCreateSubpackageApp
(
parseAppOptions
)
{
return
function
createApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
,
parseAppOptions
);
const
app
=
getApp
({
allowDefault
:
true
,
});
vm
.
$
.
ctx
.
$scope
=
app
;
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
((
name
)
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
if
(
isFunction
(
appOptions
.
onShow
)
&&
qa
.
onAppShow
)
{
qa
.
onAppShow
((
args
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onHide
)
&&
qa
.
onAppHide
)
{
qa
.
onAppHide
((
args
)
=>
{
vm
.
$callHook
(
'
onHide
'
,
args
);
});
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
qa
.
getLaunchOptionsSync
&&
qa
.
getLaunchOptionsSync
();
vm
.
$callHook
(
'
onLaunch
'
,
args
);
}
return
App
(
appOptions
);
};
}
function
initLocale
(
appVm
)
{
const
locale
=
ref
(
qa
.
getSystemInfoSync
().
language
||
'
zh-Hans
'
);
Object
.
defineProperty
(
appVm
,
'
$locale
'
,
{
...
...
@@ -941,9 +978,11 @@ var parsePageOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
const
createSubpackageApp
=
initCreateSubpackageApp
();
qa
.
EventChannel
=
EventChannel
;
qa
.
createApp
=
global
.
createApp
=
createApp
;
qa
.
createPage
=
createPage
;
qa
.
createComponent
=
createComponent
;
qa
.
createSubpackageApp
=
createSubpackageApp
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-quickapp-webview/src/runtime/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -3,6 +3,7 @@ import {
initCreateApp
,
initCreatePage
,
initCreateComponent
,
initCreateSubpackageApp
,
}
from
'
@dcloudio/uni-mp-core
'
import
'
@dcloudio/uni-mp-polyfill
'
...
...
@@ -13,7 +14,9 @@ import * as parseComponentOptions from './parseComponentOptions'
export
const
createApp
=
initCreateApp
()
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
export
const
createSubpackageApp
=
initCreateSubpackageApp
()
;(
qa
as
any
).
EventChannel
=
EventChannel
;(
qa
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
qa
as
any
).
createPage
=
createPage
;(
qa
as
any
).
createComponent
=
createComponent
;(
qa
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/vite-plugin-uni/src/cli/index.ts
浏览文件 @
b2e1e8d5
...
...
@@ -23,6 +23,7 @@ export interface CliOptions {
clearScreen
?:
boolean
autoHost
?:
string
autoPort
?:
number
subpackage
?:
string
}
cli
...
...
@@ -36,8 +37,9 @@ cli
.
option
(
'
--clearScreen
'
,
`[boolean] allow/disable clear screen when logging`
)
.
option
(
'
-d, --debug [feat]
'
,
`[string | boolean] show debug logs`
)
.
option
(
'
-f, --filter <filter>
'
,
`[string] filter debug logs`
)
.
option
(
'
--autoHost
'
,
`[string] specify automator hostname`
)
.
option
(
'
--autoPort
'
,
`[number] specify automator port`
)
.
option
(
'
--autoHost [autoHost]
'
,
`[string] specify automator hostname`
)
.
option
(
'
--autoPort [autoPort]
'
,
`[number] specify automator port`
)
.
option
(
'
--subpackage [subpackage]
'
,
`[string] specify subpackage to build`
)
cli
.
command
(
''
)
...
...
packages/vite-plugin-uni/src/cli/utils.ts
浏览文件 @
b2e1e8d5
...
...
@@ -89,6 +89,12 @@ export function initEnv(type: 'dev' | 'build', options: CliOptions) {
process
.
env
.
UNI_OUTPUT_DIR
=
(
options
as
BuildOptions
).
outDir
!
}
if
(
options
.
subpackage
)
{
process
.
env
.
UNI_SUBPACKAGE
=
options
.
subpackage
process
.
env
.
UNI_OUTPUT_DIR
=
(
options
as
BuildOptions
).
outDir
=
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
options
.
subpackage
)
}
initAutomator
(
options
)
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
...
...
@@ -122,7 +128,8 @@ export function initEnv(type: 'dev' | 'build', options: CliOptions) {
}
function
initAutomator
({
autoHost
,
autoPort
}:
CliOptions
)
{
if
(
!
autoPort
)
{
// 发行分包也不需要自动化测试
if
(
!
autoPort
||
process
.
env
.
UNI_SUBPACKAGE
)
{
return
}
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录