2025/2/8第一次更新

This commit is contained in:
爱吃咸鱼小猫咪
2025-02-08 18:50:38 +08:00
commit d7af560866
26519 changed files with 5046029 additions and 0 deletions
@@ -0,0 +1,2 @@
export declare function initArguments(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
export declare function parseArguments(pagesJson: UniApp.PagesJson): string | undefined;
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseArguments = exports.initArguments = void 0;
function initArguments(manifestJson, pagesJson) {
const args = parseArguments(pagesJson);
if (args) {
manifestJson.plus.arguments = args;
}
}
exports.initArguments = initArguments;
function parseArguments(pagesJson) {
if (process.env.NODE_ENV !== 'development') {
return;
}
// 指定了入口
if (process.env.UNI_CLI_LAUNCH_PAGE_PATH) {
return JSON.stringify({
path: process.env.UNI_CLI_LAUNCH_PAGE_PATH,
query: process.env.UNI_CLI_LAUNCH_PAGE_QUERY,
});
}
const condition = pagesJson.condition;
if (condition && condition.list?.length) {
const list = condition.list;
let current = condition.current || 0;
if (current < 0) {
current = 0;
}
if (current >= list.length) {
current = 0;
}
return JSON.stringify(list[current]);
}
}
exports.parseArguments = parseArguments;
@@ -0,0 +1 @@
export declare function initCheckSystemWebview(manifestJson: Record<string, any>): void;
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initCheckSystemWebview = void 0;
function initCheckSystemWebview(manifestJson) {
// 检查Android系统webview版本 || 下载X5后启动
let plusWebView = manifestJson.plus.webView;
if (plusWebView) {
manifestJson.plus['uni-app'].webView = plusWebView;
delete manifestJson.plus.webView;
}
else {
manifestJson.plus['uni-app'].webView = {
minUserAgentVersion: '49.0',
};
}
}
exports.initCheckSystemWebview = initCheckSystemWebview;
@@ -0,0 +1,4 @@
export declare const APP_CONFUSION_FILENAME = "app-confusion.js";
export declare function isConfusionFile(filename: string): boolean;
export declare function hasConfusionFile(inputDir?: string): boolean;
export declare function initConfusion(manifestJson: Record<string, any>): void;
@@ -0,0 +1,75 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initConfusion = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = void 0;
const path_1 = __importDefault(require("path"));
const utils_1 = require("../../../utils");
const constants_1 = require("../../../constants");
const manifest_1 = require("../../manifest");
function isJsFile(filename) {
return constants_1.EXTNAME_JS_RE.test(filename);
}
function isStaticJsFile(filename) {
return (filename.indexOf('hybrid/html') === 0 ||
filename.indexOf('static/') === 0 ||
filename.indexOf('/static/') !== -1); // subpackages, uni_modules 中的 static 目录
}
const dynamicConfusionJsFiles = [];
exports.APP_CONFUSION_FILENAME = 'app-confusion.js';
function isConfusionFile(filename) {
return dynamicConfusionJsFiles.includes((0, utils_1.normalizePath)(filename));
}
exports.isConfusionFile = isConfusionFile;
function hasConfusionFile(inputDir) {
if (inputDir) {
const manifestJson = (0, manifest_1.parseManifestJsonOnce)(inputDir);
const resources = manifestJson['app-plus']?.confusion?.resources;
if (resources && parseConfusion(resources)[1].length) {
return true;
}
}
return !!dynamicConfusionJsFiles.length;
}
exports.hasConfusionFile = hasConfusionFile;
function parseConfusion(resources) {
const res = {};
const dynamicJsFiles = [];
Object.keys(resources).reduce((res, name) => {
const extname = path_1.default.extname(name);
if (extname === '.nvue') {
res[name.replace('.nvue', '.js')] = resources[name];
}
else if (isJsFile(name)) {
// 静态 js 加密
if (isStaticJsFile(name)) {
res[name] = resources[name];
}
else {
// 非静态 js 将被合并进 app-confusion.js
dynamicJsFiles.push(name);
}
}
else {
throw new Error(`原生混淆仅支持 nvue 页面,错误的页面路径:${name}`);
}
// TODO 旧编译器会检查要加密的 nvue 页面(包括subnvue)是否被使用?后续有时间再考虑支持吧,意义不太大
return res;
}, res);
if (dynamicJsFiles.length) {
res[exports.APP_CONFUSION_FILENAME] = {};
}
return [res, dynamicJsFiles];
}
function initConfusion(manifestJson) {
dynamicConfusionJsFiles.length = 0;
if (!manifestJson.plus.confusion?.resources) {
return;
}
const resources = manifestJson.plus.confusion.resources;
const [res, dynamicJsFiles] = parseConfusion(resources);
manifestJson.plus.confusion.resources = res;
dynamicConfusionJsFiles.push(...dynamicJsFiles);
}
exports.initConfusion = initConfusion;
@@ -0,0 +1 @@
export declare function initDefaultManifestJson(): any;
@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDefaultManifestJson = void 0;
function initDefaultManifestJson() {
return JSON.parse(defaultManifestJson);
}
exports.initDefaultManifestJson = initDefaultManifestJson;
const defaultManifestJson = `{
"@platforms": [
"android",
"iPhone",
"iPad"
],
"id": "__WEAPP_ID",
"name": "__WEAPP_NAME",
"version": {
"name": "1.0",
"code": ""
},
"description": "",
"developer": {
"name": "",
"email": "",
"url": ""
},
"permissions": {},
"plus": {
"useragent": {
"value": "",
"concatenate": true
},
"splashscreen": {
"target":"id:1",
"autoclose": true,
"waiting": true,
"alwaysShowBeforeRender":true
},
"popGesture": "close",
"launchwebview": {}
},
"app-harmony": {
"useragent": {
"value": "",
"concatenate": true
}
}
}`;
@@ -0,0 +1,3 @@
export declare function getAppRenderer(manifestJson: Record<string, any>): "" | "native";
export declare function getAppCodeSpliting(manifestJson: Record<string, any>): boolean;
export declare function getAppStyleIsolation(manifestJson: Record<string, any>): 'apply-shared' | 'isolated' | 'shared';
+22
View File
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAppStyleIsolation = exports.getAppCodeSpliting = exports.getAppRenderer = void 0;
function getAppRenderer(manifestJson) {
const platformOptions = manifestJson['app-plus'];
if (platformOptions && platformOptions.renderer === 'native') {
return 'native';
}
return '';
}
exports.getAppRenderer = getAppRenderer;
function getAppCodeSpliting(manifestJson) {
if (manifestJson['app-plus']?.optimization?.codeSpliting === true) {
return true;
}
return false;
}
exports.getAppCodeSpliting = getAppCodeSpliting;
function getAppStyleIsolation(manifestJson) {
return (manifestJson['app-plus']?.optimization?.styleIsolation ?? 'apply-shared');
}
exports.getAppStyleIsolation = getAppStyleIsolation;
@@ -0,0 +1 @@
export declare function initI18n(manifestJson: Record<string, any>): Record<string, any>;
+14
View File
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initI18n = void 0;
const uni_i18n_1 = require("@dcloudio/uni-i18n");
const i18n_1 = require("../../../i18n");
function initI18n(manifestJson) {
const i18nOptions = (0, i18n_1.initI18nOptions)(process.env.UNI_PLATFORM, process.env.UNI_INPUT_DIR, true);
if (i18nOptions) {
manifestJson = JSON.parse((0, uni_i18n_1.compileI18nJsonStr)(JSON.stringify(manifestJson), i18nOptions));
manifestJson.fallbackLocale = i18nOptions.locale;
}
return manifestJson;
}
exports.initI18n = initI18n;
@@ -0,0 +1,5 @@
export declare function normalizeAppManifestJson(userManifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): Record<string, any>;
export * from './env';
export { APP_CONFUSION_FILENAME, isConfusionFile, hasConfusionFile, } from './confusion';
export { getNVueCompiler, getNVueStyleCompiler, getNVueFlexDirection, } from './nvue';
export { parseArguments } from './arguments';
+63
View File
@@ -0,0 +1,63 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseArguments = exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = exports.normalizeAppManifestJson = void 0;
const shared_1 = require("@vue/shared");
const merge_1 = require("./merge");
const defaultManifestJson_1 = require("./defaultManifestJson");
const statusbar_1 = require("./statusbar");
const plus_1 = require("./plus");
const nvue_1 = require("./nvue");
const arguments_1 = require("./arguments");
const safearea_1 = require("./safearea");
const splashscreen_1 = require("./splashscreen");
const confusion_1 = require("./confusion");
const uniApp_1 = require("./uniApp");
const launchwebview_1 = require("./launchwebview");
const checksystemwebview_1 = require("./checksystemwebview");
const tabBar_1 = require("./tabBar");
const i18n_1 = require("./i18n");
const theme_1 = require("../../theme");
function normalizeAppManifestJson(userManifestJson, pagesJson) {
const manifestJson = (0, merge_1.initRecursiveMerge)((0, defaultManifestJson_1.initDefaultManifestJson)(), userManifestJson);
const { pages, globalStyle, tabBar } = (0, theme_1.initTheme)(manifestJson, pagesJson);
(0, shared_1.extend)(pagesJson, JSON.parse(JSON.stringify({ pages, globalStyle, tabBar })));
(0, statusbar_1.initAppStatusbar)(manifestJson, pagesJson);
(0, arguments_1.initArguments)(manifestJson, pagesJson);
(0, plus_1.initPlus)(manifestJson, pagesJson);
(0, nvue_1.initNVue)(manifestJson, pagesJson);
(0, safearea_1.initSafearea)(manifestJson, pagesJson);
(0, splashscreen_1.initSplashscreen)(manifestJson, userManifestJson);
(0, confusion_1.initConfusion)(manifestJson);
(0, uniApp_1.initUniApp)(manifestJson);
// 依赖 initArguments 先执行
(0, tabBar_1.initTabBar)((0, launchwebview_1.initLaunchwebview)(manifestJson, pagesJson), manifestJson, pagesJson);
// 依赖 initUniApp 先执行
(0, checksystemwebview_1.initCheckSystemWebview)(manifestJson);
return (0, i18n_1.initI18n)(manifestJson);
}
exports.normalizeAppManifestJson = normalizeAppManifestJson;
__exportStar(require("./env"), exports);
var confusion_2 = require("./confusion");
Object.defineProperty(exports, "APP_CONFUSION_FILENAME", { enumerable: true, get: function () { return confusion_2.APP_CONFUSION_FILENAME; } });
Object.defineProperty(exports, "isConfusionFile", { enumerable: true, get: function () { return confusion_2.isConfusionFile; } });
Object.defineProperty(exports, "hasConfusionFile", { enumerable: true, get: function () { return confusion_2.hasConfusionFile; } });
var nvue_2 = require("./nvue");
Object.defineProperty(exports, "getNVueCompiler", { enumerable: true, get: function () { return nvue_2.getNVueCompiler; } });
Object.defineProperty(exports, "getNVueStyleCompiler", { enumerable: true, get: function () { return nvue_2.getNVueStyleCompiler; } });
Object.defineProperty(exports, "getNVueFlexDirection", { enumerable: true, get: function () { return nvue_2.getNVueFlexDirection; } });
var arguments_2 = require("./arguments");
Object.defineProperty(exports, "parseArguments", { enumerable: true, get: function () { return arguments_2.parseArguments; } });
@@ -0,0 +1 @@
export declare function initLaunchwebview(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): string;
@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initLaunchwebview = void 0;
const shared_1 = require("@vue/shared");
function initLaunchwebview(manifestJson, pagesJson) {
let entryPagePath = pagesJson.pages[0].path;
// 依赖前置执行initArguments
if (manifestJson.plus.arguments) {
try {
const args = JSON.parse(manifestJson.plus.arguments);
if (args.path) {
entryPagePath = args.path;
}
}
catch (e) { }
}
if (manifestJson.plus.useragent.concatenate) {
if (manifestJson.plus.useragent.value) {
manifestJson.plus.useragent.value = [
'uni-app',
manifestJson.plus.useragent.value,
].join(' ');
}
else {
manifestJson.plus.useragent.value = 'uni-app';
}
}
if (manifestJson['app-harmony'].useragent.concatenate) {
if (manifestJson['app-harmony'].useragent.value) {
manifestJson['app-harmony'].useragent.value = [
'uni-app',
manifestJson['app-harmony'].useragent.value,
].join(' ');
}
else {
manifestJson['app-harmony'].useragent.value = 'uni-app';
}
}
(0, shared_1.extend)(manifestJson.plus.launchwebview, {
id: '1',
kernel: 'WKWebview',
});
// 首页为nvue
const entryPage = pagesJson.pages.find((p) => p.path === entryPagePath);
if (entryPage?.style.isNVue) {
manifestJson.plus.launchwebview.uniNView = { path: entryPagePath + '.js' };
}
else {
manifestJson.launch_path = '__uniappview.html';
}
return entryPagePath;
}
exports.initLaunchwebview = initLaunchwebview;
@@ -0,0 +1 @@
export declare function initRecursiveMerge(manifestJson: Record<string, any>, userManifestJson: Record<string, any>): Record<string, any>;
+22
View File
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initRecursiveMerge = void 0;
const merge_1 = require("merge");
function initRecursiveMerge(manifestJson, userManifestJson) {
const platformConfig = {
plus: userManifestJson['app-plus'],
};
platformConfig['app-harmony'] = userManifestJson['app-harmony'];
return (0, merge_1.recursive)(true, manifestJson, {
id: userManifestJson.appid || '',
name: userManifestJson.name || '',
description: userManifestJson.description || '',
version: {
name: userManifestJson.versionName,
code: userManifestJson.versionCode,
},
locale: userManifestJson.locale,
uniStatistics: userManifestJson.uniStatistics,
}, platformConfig);
}
exports.initRecursiveMerge = initRecursiveMerge;
@@ -0,0 +1,4 @@
export declare function initNVue(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
export declare function getNVueCompiler(manifestJson: Record<string, any>): "uni-app" | "vue" | "weex" | "vite";
export declare function getNVueStyleCompiler(manifestJson: Record<string, any>): "uni-app" | "weex";
export declare function getNVueFlexDirection(manifestJson: Record<string, any>): "column" | "row" | "row-reverse" | "column-reverse";
+41
View File
@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.initNVue = void 0;
function initNVue(manifestJson, pagesJson) { }
exports.initNVue = initNVue;
function getNVueCompiler(manifestJson) {
const platformOptions = manifestJson['app-plus'];
if (platformOptions) {
const { nvueCompiler } = platformOptions;
if (nvueCompiler === 'weex') {
return 'weex';
}
if (nvueCompiler === 'vue') {
return 'vue';
}
if (nvueCompiler === 'vite') {
return 'vite';
}
}
return 'uni-app';
}
exports.getNVueCompiler = getNVueCompiler;
function getNVueStyleCompiler(manifestJson) {
const platformOptions = manifestJson['app-plus'];
if (platformOptions && platformOptions.nvueStyleCompiler === 'uni-app') {
return 'uni-app';
}
return 'weex';
}
exports.getNVueStyleCompiler = getNVueStyleCompiler;
const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
function getNVueFlexDirection(manifestJson) {
let flexDir = 'column';
const appPlusJson = manifestJson['app-plus'] || manifestJson['plus'];
if (appPlusJson?.nvue?.['flex-direction'] &&
flexDirs.includes(appPlusJson?.nvue?.['flex-direction'])) {
flexDir = appPlusJson.nvue['flex-direction'];
}
return flexDir;
}
exports.getNVueFlexDirection = getNVueFlexDirection;
@@ -0,0 +1 @@
export declare function initPlus(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
+131
View File
@@ -0,0 +1,131 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initPlus = void 0;
const shared_1 = require("@vue/shared");
const merge_1 = require("merge");
const wxPageOrientationMapping = {
auto: [
'portrait-primary',
'portrait-secondary',
'landscape-primary',
'landscape-secondary',
],
portrait: ['portrait-primary', 'portrait-secondary'],
landscape: ['landscape-primary', 'landscape-secondary'],
};
function initPlus(manifestJson, pagesJson) {
initUniStatistics(manifestJson);
// 转换为老版本配置
if (manifestJson.plus.modules) {
manifestJson.permissions = manifestJson.plus.modules;
delete manifestJson.plus.modules;
}
const distribute = manifestJson.plus.distribute;
if (distribute) {
if (distribute.android) {
manifestJson.plus.distribute.google = distribute.android;
delete manifestJson.plus.distribute.android;
}
if (distribute.ios) {
manifestJson.plus.distribute.apple = distribute.ios;
delete manifestJson.plus.distribute.ios;
}
if (distribute.sdkConfigs) {
manifestJson.plus.distribute.plugins = distribute.sdkConfigs;
delete manifestJson.plus.distribute.sdkConfigs;
}
if (manifestJson.plus.darkmode) {
if (!(distribute.google || (distribute.google = {})).defaultNightMode) {
distribute.google.defaultNightMode = 'auto';
}
if (!(distribute.apple || (distribute.apple = {})).UIUserInterfaceStyle) {
distribute.apple.UIUserInterfaceStyle = 'Automatic';
}
}
}
// 屏幕启动方向
if (manifestJson.plus.screenOrientation) {
// app平台优先使用 manifest 配置
manifestJson.screenOrientation = manifestJson.plus.screenOrientation;
delete manifestJson.plus.screenOrientation;
}
else if (pagesJson.globalStyle?.pageOrientation) {
// 兼容微信小程序
const pageOrientationValue = wxPageOrientationMapping[pagesJson.globalStyle
.pageOrientation];
if (pageOrientationValue) {
manifestJson.screenOrientation = pageOrientationValue;
}
}
// 全屏配置
manifestJson.fullscreen = manifestJson.plus.fullscreen;
// 地图坐标系
if (manifestJson.permissions && manifestJson.permissions.Maps) {
manifestJson.permissions.Maps.coordType = 'gcj02';
}
if (!manifestJson.permissions) {
manifestJson.permissions = {};
}
manifestJson.permissions.UniNView = {
description: 'UniNView原生渲染',
};
// 允许内联播放视频
manifestJson.plus.allowsInlineMediaPlayback = true;
if (!manifestJson.plus.distribute) {
manifestJson.plus.distribute = {
plugins: {},
};
}
if (!manifestJson.plus.distribute.plugins) {
manifestJson.plus.distribute.plugins = {};
}
// 录音支持 mp3
manifestJson.plus.distribute.plugins.audio = {
mp3: {
description: 'Android平台录音支持MP3格式文件',
},
};
// 有效值为 close,none
if (!['close', 'none'].includes(manifestJson.plus.popGesture)) {
manifestJson.plus.popGesture = 'close';
}
}
exports.initPlus = initPlus;
function initUniStatistics(manifestJson) {
// 根节点配置了统计
if (manifestJson.uniStatistics) {
manifestJson.plus.uniStatistics = (0, merge_1.recursive)(true, manifestJson.uniStatistics, manifestJson.plus.uniStatistics);
manifestJson['app-harmony'].uniStatistics = (0, merge_1.recursive)(true, manifestJson.uniStatistics, manifestJson['app-harmony'].uniStatistics);
delete manifestJson.uniStatistics;
}
if (!process.env.UNI_CLOUD_PROVIDER) {
return;
}
let spaces = [];
try {
spaces = JSON.parse(process.env.UNI_CLOUD_PROVIDER);
}
catch (e) { }
if (!(0, shared_1.isArray)(spaces) || !spaces.length) {
return;
}
const space = spaces[0];
if (!space) {
return;
}
const uniStatistics = manifestJson.plus?.uniStatistics;
if (!uniStatistics) {
return;
}
if (uniStatistics.version === 2 || uniStatistics.version === '2') {
if (uniStatistics.uniCloud && uniStatistics.uniCloud.spaceId) {
return;
}
uniStatistics.uniCloud = {
provider: space.provider,
spaceId: space.spaceId,
clientSecret: space.clientSecret,
endpoint: space.endpoint,
};
}
}
@@ -0,0 +1 @@
export declare function initSafearea(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initSafearea = void 0;
function initSafearea(manifestJson, pagesJson) {
if (pagesJson.tabBar?.list?.length) {
// 安全区配置 仅包含 tabBar 的时候才配置
if (!manifestJson.plus.safearea) {
manifestJson.plus.safearea = {
background: pagesJson.tabBar.backgroundColor || '#FFFFFF',
bottom: {
offset: 'auto',
},
};
}
if (!manifestJson['app-harmony'].safearea) {
manifestJson['app-harmony'].safearea = {
background: pagesJson.tabBar.backgroundColor || '#FFFFFF',
bottom: {
offset: 'auto',
},
};
}
}
else {
if (!manifestJson.plus.launchwebview) {
manifestJson.plus.launchwebview = {
render: 'always',
};
}
else if (!manifestJson.plus.launchwebview.render) {
manifestJson.plus.launchwebview.render = 'always';
}
}
}
exports.initSafearea = initSafearea;
@@ -0,0 +1,5 @@
export declare function initSplashscreen(manifestJson: Record<string, any>, userManifestJson: Record<string, any>): void;
export declare function getSplashscreen(manifestJson: Record<string, any>): {
autoclose: boolean;
alwaysShowBeforeRender: boolean;
};
@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSplashscreen = exports.initSplashscreen = void 0;
const shared_1 = require("@vue/shared");
function initSplashscreen(manifestJson, userManifestJson) {
if (!manifestJson.plus.splashscreen) {
return;
}
// 强制白屏检测
const splashscreenOptions = userManifestJson['app-plus'] && userManifestJson['app-plus'].splashscreen;
const hasAlwaysShowBeforeRender = splashscreenOptions && (0, shared_1.hasOwn)(splashscreenOptions, 'alwaysShowBeforeRender');
if (!hasAlwaysShowBeforeRender &&
manifestJson.plus.splashscreen.autoclose === false) {
// 兼容旧版本仅配置了 autoclose 为 false
manifestJson.plus.splashscreen.alwaysShowBeforeRender = false;
}
if (manifestJson.plus.splashscreen.alwaysShowBeforeRender) {
// 白屏检测
if (!manifestJson.plus.splashscreen.target) {
manifestJson.plus.splashscreen.target = 'id:1';
}
manifestJson.plus.splashscreen.autoclose = true;
manifestJson.plus.splashscreen.delay = 0;
}
else {
// 不启用白屏检测
delete manifestJson.plus.splashscreen.target;
if (manifestJson.plus.splashscreen.autoclose) {
// 启用 uni-app 框架关闭 splash
manifestJson.plus.splashscreen.autoclose = false; // 原 5+ autoclose 改为 false
}
}
delete manifestJson.plus.splashscreen.alwaysShowBeforeRender;
}
exports.initSplashscreen = initSplashscreen;
function getSplashscreen(manifestJson) {
const splashscreenOptions = manifestJson['app-plus']?.splashscreen || {};
return {
autoclose: splashscreenOptions.autoclose !== false,
alwaysShowBeforeRender: splashscreenOptions.alwaysShowBeforeRender !== false,
};
}
exports.getSplashscreen = getSplashscreen;
@@ -0,0 +1 @@
export declare function initAppStatusbar(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): Record<string, any>;
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initAppStatusbar = void 0;
function initAppStatusbar(manifestJson, pagesJson) {
const titleColor = pagesJson.pages[0].style.navigationBar.titleColor ||
pagesJson.globalStyle.navigationBar.titleColor ||
'#000000';
const backgroundColor = pagesJson.globalStyle.navigationBar.backgroundColor || '#000000';
manifestJson.plus.statusbar = {
immersed: 'supportedDevice',
style: titleColor === '#ffffff' ? 'light' : 'dark',
background: backgroundColor,
};
return manifestJson;
}
exports.initAppStatusbar = initAppStatusbar;
@@ -0,0 +1 @@
export declare function initTabBar(entryPagePath: string, manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
+24
View File
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initTabBar = void 0;
const uni_shared_1 = require("@dcloudio/uni-shared");
function initTabBar(entryPagePath, manifestJson, pagesJson) {
if (!pagesJson.tabBar?.list?.length) {
return;
}
const tabBar = JSON.parse(JSON.stringify(pagesJson.tabBar));
tabBar.borderStyle = (0, uni_shared_1.normalizeTabBarStyles)(tabBar.borderStyle);
if (!tabBar.selectedColor) {
tabBar.selectedColor = uni_shared_1.SELECTED_COLOR;
}
tabBar.height = `${parseFloat(tabBar.height) || uni_shared_1.TABBAR_HEIGHT}px`;
// 首页是 tabBar 页面
const item = tabBar.list.find((page) => page.pagePath === entryPagePath);
if (item) {
;
tabBar.child = ['lauchwebview'];
tabBar.selected = tabBar.list.indexOf(item);
}
manifestJson.plus.tabBar = tabBar;
}
exports.initTabBar = initTabBar;
@@ -0,0 +1 @@
export declare function initUniApp(manifestJson: Record<string, any>): void;
+19
View File
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initUniApp = void 0;
const nvue_1 = require("./nvue");
function initUniApp(manifestJson) {
manifestJson.plus['uni-app'] = {
control: 'uni-v3',
vueVersion: '3',
compilerVersion: process.env.UNI_COMPILER_VERSION,
nvueCompiler: (0, nvue_1.getNVueCompiler)(manifestJson),
renderer: 'auto',
nvue: {
'flex-direction': (0, nvue_1.getNVueFlexDirection)(manifestJson),
},
nvueLaunchMode: manifestJson.plus.nvueLaunchMode === 'fast' ? 'fast' : 'normal',
};
delete manifestJson.plus.nvueLaunchMode;
}
exports.initUniApp = initUniApp;