提交 b8d73c59 编写于 作者: fxy060608's avatar fxy060608

chore(h5): tree shaking

上级 40e85ce7
......@@ -37,6 +37,7 @@ declare var __UNI_FEATURE_NVUE__: boolean
declare var __UNI_FEATURE_PROMISE__: boolean
declare var __UNI_FEATURE_LONGPRESS__: boolean
declare var __UNI_FEATURE_ROUTER_MODE__: 'hash' | 'history'
declare var __UNI_FEATURE_UNI_CLOUD__: boolean
declare var __UNI_FEATURE_PAGES__: boolean
declare var __UNI_FEATURE_TABBAR__: boolean
......
......@@ -9992,7 +9992,9 @@ var serviceContext = (function (vue) {
}
initOptionMergeStrategies(appConfig.optionMergeStrategies);
const globalProperties = appConfig.globalProperties;
uniIdMixin(globalProperties);
{
uniIdMixin(globalProperties);
}
{
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
......
......@@ -10,6 +10,7 @@ interface ProjectFeatures {
i18nFr: boolean
i18nZhHans: boolean
i18nZhHant: boolean
uniCloud: boolean
}
interface PagesFeatures {
nvue: boolean
......@@ -44,6 +45,7 @@ function initProjectFeature({ inputDir }: InitFeaturesOptions) {
i18nFr: true,
i18nZhHans: true,
i18nZhHant: true,
uniCloud: false,
}
const localesDir = path.resolve(inputDir, 'locale')
if (fs.existsSync(localesDir)) {
......@@ -53,6 +55,14 @@ function initProjectFeature({ inputDir }: InitFeaturesOptions) {
features.i18nLocale = true
}
}
if (process.env.UNI_CLOUD_PROVIDER) {
try {
const providers = JSON.parse(process.env.UNI_CLOUD_PROVIDER)
if (providers.length) {
features.uniCloud = true
}
} catch (e) {}
}
return features
}
......@@ -207,6 +217,7 @@ export function initFeatures(options: InitFeaturesOptions) {
wxs,
rpx,
nvue,
uniCloud,
i18nEn,
i18nEs,
i18nFr,
......@@ -250,6 +261,7 @@ export function initFeatures(options: InitFeaturesOptions) {
__UNI_FEATURE_I18N_ZH_HANS__: i18nZhHans, // 是否启用zh_Hans
__UNI_FEATURE_I18N_ZH_HANT__: i18nZhHant, // 是否启用zh_Hant
// 以下特性,编译器已自动识别是否需要启用
__UNI_FEATURE_UNI_CLOUD__: uniCloud, // 是否启用uniCloud
__UNI_FEATURE_I18N_LOCALE__: i18nLocale, // 是否启用i18n
__UNI_FEATURE_NVUE__: nvue, // 是否启用nvue
__UNI_FEATURE_ROUTER_MODE__: routerMode, // 路由模式
......
......@@ -6565,7 +6565,11 @@ function initApp$1(app) {
}
initOptionMergeStrategies(appConfig.optionMergeStrategies);
const globalProperties = appConfig.globalProperties;
uniIdMixin(globalProperties);
{
if (__UNI_FEATURE_UNI_CLOUD__) {
uniIdMixin(globalProperties);
}
}
{
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
......
......@@ -13283,7 +13283,11 @@ function initApp$1(app) {
}
initOptionMergeStrategies(appConfig.optionMergeStrategies);
const globalProperties = appConfig.globalProperties;
uniIdMixin(globalProperties);
{
if (__UNI_FEATURE_UNI_CLOUD__) {
uniIdMixin(globalProperties);
}
}
{
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
......@@ -18042,7 +18046,7 @@ function useToastIcon(props2) {
let showToastState;
let showType = "";
let timeoutId;
const scope = effectScope();
const scope = /* @__PURE__ */ effectScope();
function watchVisible() {
scope.run(() => {
watch([() => showToastState.visible, () => showToastState.duration], ([visible, duration]) => {
......
......@@ -30,7 +30,8 @@ let showToastState: ToastProps
let showType: 'onShowToast' | 'onShowLoading' | '' = ''
let timeoutId: number
const scope = effectScope()
const scope = /*#__PURE__*/ effectScope()
function watchVisible() {
scope.run(() => {
watch(
......
......@@ -4555,7 +4555,9 @@ function initApp(app) {
}
initOptionMergeStrategies(appConfig.optionMergeStrategies);
const globalProperties = appConfig.globalProperties;
uniIdMixin(globalProperties);
{
uniIdMixin(globalProperties);
}
if (__VUE_OPTIONS_API__) {
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
......
......@@ -16,7 +16,13 @@ export function initApp(app: App) {
initOptionMergeStrategies(appConfig.optionMergeStrategies)
const globalProperties = appConfig.globalProperties
uniIdMixin(globalProperties)
if (__PLATFORM__ === 'h5') {
if (__UNI_FEATURE_UNI_CLOUD__) {
uniIdMixin(globalProperties)
}
} else {
uniIdMixin(globalProperties)
}
if (__VUE_OPTIONS_API__) {
globalProperties.$set = set
globalProperties.$applyOptions = applyOptions
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册