@dcloudio/uni-cli-shared 3.0.0-alpha-3020720210917002 → 3.0.0-alpha-3021020210930001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkUpdate.js +9 -9
- package/dist/constants.js +2 -2
- package/dist/easycom.js +9 -9
- package/dist/env/define.js +2 -2
- package/dist/hbx/alias.js +1 -1
- package/dist/hbx/env.js +3 -3
- package/dist/i18n.js +5 -5
- package/dist/json/app/manifest/i18n.js +2 -2
- package/dist/json/app/manifest/index.js +10 -10
- package/dist/json/app/manifest/launchwebview.js +1 -1
- package/dist/json/app/manifest/merge.js +1 -1
- package/dist/json/app/manifest/splashscreen.js +1 -1
- package/dist/json/app/manifest/uniApp.js +2 -2
- package/dist/json/app/pages/definePage.js +2 -2
- package/dist/json/app/pages/index.js +3 -3
- package/dist/json/app/pages/nvue.js +3 -3
- package/dist/json/app/pages/uniConfig.js +5 -5
- package/dist/json/app/pages/uniRoutes.js +1 -1
- package/dist/json/json.js +1 -1
- package/dist/json/manifest.js +9 -9
- package/dist/json/pages.js +34 -32
- package/dist/logs/console.js +1 -1
- package/dist/logs/format.js +4 -4
- package/dist/postcss/plugins/stylePluginScoped.js +1 -1
- package/dist/postcss/plugins/uniapp.js +6 -6
- package/dist/preprocess/context.js +2 -2
- package/dist/preprocess/index.js +4 -4
- package/dist/renderjs.js +2 -2
- package/dist/utils.js +2 -2
- package/dist/vite/features.d.ts +1 -0
- package/dist/vite/features.js +15 -4
- package/dist/vite/plugins/console.js +5 -5
- package/dist/vite/plugins/css.js +3 -3
- package/dist/vite/plugins/cssScoped.js +4 -4
- package/dist/vite/plugins/inject.js +11 -11
- package/dist/vite/plugins/jsonJs.js +1 -1
- package/dist/vite/plugins/mainJs.js +1 -1
- package/dist/vite/plugins/vitejs/plugins/asset.js +9 -9
- package/dist/vite/plugins/vitejs/plugins/css.js +20 -17
- package/dist/vite/utils/ast.js +8 -8
- package/dist/vite/utils/plugin.js +3 -3
- package/dist/watcher.js +1 -1
- package/package.json +2 -2
package/dist/checkUpdate.js
CHANGED
|
@@ -14,14 +14,14 @@ const compare_versions_1 = __importDefault(require("compare-versions"));
|
|
|
14
14
|
const shared_1 = require("@vue/shared");
|
|
15
15
|
const json_1 = require("./json");
|
|
16
16
|
const hbx_1 = require("./hbx");
|
|
17
|
-
const debugCheckUpdate = debug_1.default('uni:check-update');
|
|
17
|
+
const debugCheckUpdate = (0, debug_1.default)('uni:check-update');
|
|
18
18
|
const INTERVAL = 1000 * 60 * 60 * 24;
|
|
19
19
|
async function checkUpdate(options) {
|
|
20
20
|
if (process.env.CI) {
|
|
21
21
|
debugCheckUpdate('isInCI');
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
if (hbx_1.isInHBuilderX()) {
|
|
24
|
+
if ((0, hbx_1.isInHBuilderX)()) {
|
|
25
25
|
debugCheckUpdate('isInHBuilderX');
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
@@ -29,13 +29,13 @@ async function checkUpdate(options) {
|
|
|
29
29
|
const updateCache = readCheckUpdateCache(inputDir);
|
|
30
30
|
const res = checkLocalCache(updateCache, compilerVersion);
|
|
31
31
|
if (res) {
|
|
32
|
-
if (shared_1.isString(res)) {
|
|
32
|
+
if ((0, shared_1.isString)(res)) {
|
|
33
33
|
console.log();
|
|
34
34
|
console.log(res);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
await checkVersion(options, normalizeUpdateCache(updateCache, json_1.parseManifestJsonOnce(inputDir)));
|
|
38
|
+
await checkVersion(options, normalizeUpdateCache(updateCache, (0, json_1.parseManifestJsonOnce)(inputDir)));
|
|
39
39
|
}
|
|
40
40
|
writeCheckUpdateCache(inputDir, statUpdateCache(normalizeUpdateCache(updateCache)));
|
|
41
41
|
}
|
|
@@ -111,7 +111,7 @@ function checkLocalCache(updateCache, compilerVersion, interval = INTERVAL) {
|
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
113
113
|
if (updateCache.newVersion &&
|
|
114
|
-
compare_versions_1.default(updateCache.newVersion, compilerVersion) > 0) {
|
|
114
|
+
(0, compare_versions_1.default)(updateCache.newVersion, compilerVersion) > 0) {
|
|
115
115
|
debugCheckUpdate('cache: find new version');
|
|
116
116
|
return updateCache.note;
|
|
117
117
|
}
|
|
@@ -164,8 +164,8 @@ function createPostData({ versionType, compilerVersion }, manifestJson, updateCa
|
|
|
164
164
|
}
|
|
165
165
|
Object.keys(updateCache).forEach((name) => {
|
|
166
166
|
const value = updateCache[name];
|
|
167
|
-
if (shared_1.isPlainObject(value) &&
|
|
168
|
-
(shared_1.hasOwn(value, 'dev') || shared_1.hasOwn(value, 'build'))) {
|
|
167
|
+
if ((0, shared_1.isPlainObject)(value) &&
|
|
168
|
+
((0, shared_1.hasOwn)(value, 'dev') || (0, shared_1.hasOwn)(value, 'build'))) {
|
|
169
169
|
data[name] = value;
|
|
170
170
|
}
|
|
171
171
|
});
|
|
@@ -194,9 +194,9 @@ function handleCheckVersion({ code, isUpdate, newVersion, note }, updateCache) {
|
|
|
194
194
|
const HOSTNAME = 'uniapp.dcloud.net.cn';
|
|
195
195
|
const PATH = '/update/cli';
|
|
196
196
|
function checkVersion(options, updateCache) {
|
|
197
|
-
const postData = createPostData(options, json_1.parseManifestJsonOnce(options.inputDir), updateCache);
|
|
197
|
+
const postData = createPostData(options, (0, json_1.parseManifestJsonOnce)(options.inputDir), updateCache);
|
|
198
198
|
let responseData = '';
|
|
199
|
-
const req = https_1.request({
|
|
199
|
+
const req = (0, https_1.request)({
|
|
200
200
|
hostname: HOSTNAME,
|
|
201
201
|
path: PATH,
|
|
202
202
|
port: 443,
|
package/dist/constants.js
CHANGED
|
@@ -7,9 +7,9 @@ exports.EXTNAME_VUE = ['.vue', '.nvue'];
|
|
|
7
7
|
exports.EXTNAME_VUE_RE = /\.(vue|nvue)$/;
|
|
8
8
|
exports.EXTNAME_JS_RE = /\.[jt]sx?$/;
|
|
9
9
|
// APP 平台解析页面后缀的优先级
|
|
10
|
-
exports.PAGE_EXTNAME_APP = ['.nvue', '.vue'];
|
|
10
|
+
exports.PAGE_EXTNAME_APP = ['.nvue', '.vue', '.tsx', '.jsx', '.js'];
|
|
11
11
|
// 其他平台解析页面后缀的优先级
|
|
12
|
-
exports.PAGE_EXTNAME = ['.vue', '.nvue'];
|
|
12
|
+
exports.PAGE_EXTNAME = ['.vue', '.nvue', '.tsx', '.jsx', '.js'];
|
|
13
13
|
exports.H5_API_STYLE_PATH = '@dcloudio/uni-h5/style/api/';
|
|
14
14
|
exports.H5_FRAMEWORK_STYLE_PATH = '@dcloudio/uni-h5/style/framework/';
|
|
15
15
|
exports.H5_COMPONENTS_STYLE_PATH = '@dcloudio/uni-h5/style/';
|
package/dist/easycom.js
CHANGED
|
@@ -13,7 +13,7 @@ const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
|
13
13
|
const utils_1 = require("./utils");
|
|
14
14
|
const pages_1 = require("./json/pages");
|
|
15
15
|
const messages_1 = require("./messages");
|
|
16
|
-
const debugEasycom = debug_1.default('uni:easycom');
|
|
16
|
+
const debugEasycom = (0, debug_1.default)('uni:easycom');
|
|
17
17
|
const easycoms = [];
|
|
18
18
|
const easycomsCache = new Map();
|
|
19
19
|
const easycomsInvalidCache = new Set();
|
|
@@ -29,7 +29,7 @@ function initEasycoms(inputDir, platform) {
|
|
|
29
29
|
const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
|
|
30
30
|
const initEasycomOptions = (pagesJson) => {
|
|
31
31
|
// 初始化时,从once中读取缓存,refresh时,实时读取
|
|
32
|
-
const { easycom } = pagesJson || pages_1.parsePagesJson(inputDir, platform, false);
|
|
32
|
+
const { easycom } = pagesJson || (0, pages_1.parsePagesJson)(inputDir, platform, false);
|
|
33
33
|
const easycomOptions = {
|
|
34
34
|
dirs: easycom && easycom.autoscan === false
|
|
35
35
|
? [buildInComponentsDir] // 禁止自动扫描
|
|
@@ -45,11 +45,11 @@ function initEasycoms(inputDir, platform) {
|
|
|
45
45
|
debugEasycom(easycomOptions);
|
|
46
46
|
return easycomOptions;
|
|
47
47
|
};
|
|
48
|
-
const options = initEasycomOptions(pages_1.parsePagesJsonOnce(inputDir, platform));
|
|
48
|
+
const options = initEasycomOptions((0, pages_1.parsePagesJsonOnce)(inputDir, platform));
|
|
49
49
|
initEasycom(options);
|
|
50
50
|
const res = {
|
|
51
51
|
options,
|
|
52
|
-
filter: pluginutils_1.createFilter(['components/*/*.vue', 'uni_modules/*/components/*/*.vue'], [], {
|
|
52
|
+
filter: (0, pluginutils_1.createFilter)(['components/*/*.vue', 'uni_modules/*/components/*/*.vue'], [], {
|
|
53
53
|
resolve: inputDir,
|
|
54
54
|
}),
|
|
55
55
|
refresh() {
|
|
@@ -61,7 +61,7 @@ function initEasycoms(inputDir, platform) {
|
|
|
61
61
|
return res;
|
|
62
62
|
}
|
|
63
63
|
exports.initEasycoms = initEasycoms;
|
|
64
|
-
exports.initEasycomsOnce = uni_shared_1.once(initEasycoms);
|
|
64
|
+
exports.initEasycomsOnce = (0, uni_shared_1.once)(initEasycoms);
|
|
65
65
|
function initUniModulesEasycomDirs(uniModulesDir) {
|
|
66
66
|
if (!fs_1.default.existsSync(uniModulesDir)) {
|
|
67
67
|
return [];
|
|
@@ -80,13 +80,13 @@ function initEasycom({ dirs, rootDir, custom, extensions = ['.vue'], }) {
|
|
|
80
80
|
clearEasycom();
|
|
81
81
|
const easycomsObj = Object.create(null);
|
|
82
82
|
if (dirs && dirs.length && rootDir) {
|
|
83
|
-
shared_1.extend(easycomsObj, initAutoScanEasycoms(dirs, rootDir, extensions));
|
|
83
|
+
(0, shared_1.extend)(easycomsObj, initAutoScanEasycoms(dirs, rootDir, extensions));
|
|
84
84
|
}
|
|
85
85
|
if (custom) {
|
|
86
86
|
Object.keys(custom).forEach((name) => {
|
|
87
87
|
const componentPath = custom[name];
|
|
88
88
|
easycomsObj[name] = componentPath.startsWith('@/')
|
|
89
|
-
? utils_1.normalizePath(path_1.default.join(rootDir, componentPath.substr(2)))
|
|
89
|
+
? (0, utils_1.normalizePath)(path_1.default.join(rootDir, componentPath.substr(2)))
|
|
90
90
|
: componentPath;
|
|
91
91
|
});
|
|
92
92
|
}
|
|
@@ -136,7 +136,7 @@ function initAutoScanEasycom(dir, rootDir, extensions) {
|
|
|
136
136
|
if (!isDir(folder)) {
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
const importDir = utils_1.normalizePath(folder);
|
|
139
|
+
const importDir = (0, utils_1.normalizePath)(folder);
|
|
140
140
|
const files = fs_1.default.readdirSync(folder);
|
|
141
141
|
// 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确)
|
|
142
142
|
for (let i = 0; i < extensions.length; i++) {
|
|
@@ -176,5 +176,5 @@ function initAutoScanEasycoms(dirs, rootDir, extensions) {
|
|
|
176
176
|
return res;
|
|
177
177
|
}
|
|
178
178
|
function normalizeCompath(compath, rootDir) {
|
|
179
|
-
return utils_1.normalizePath(path_1.default.relative(rootDir, compath));
|
|
179
|
+
return (0, utils_1.normalizePath)(path_1.default.relative(rootDir, compath));
|
|
180
180
|
}
|
package/dist/env/define.js
CHANGED
|
@@ -4,8 +4,8 @@ exports.initDefine = void 0;
|
|
|
4
4
|
const env_1 = require("../hbx/env");
|
|
5
5
|
const json_1 = require("../json");
|
|
6
6
|
function initDefine(stringifyBoolean = false) {
|
|
7
|
-
const manifestJson = json_1.parseManifestJsonOnce(process.env.UNI_INPUT_DIR);
|
|
8
|
-
const isRunByHBuilderX = env_1.runByHBuilderX();
|
|
7
|
+
const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
|
|
8
|
+
const isRunByHBuilderX = (0, env_1.runByHBuilderX)();
|
|
9
9
|
return {
|
|
10
10
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
11
11
|
'process.env.UNI_APP_ID': JSON.stringify(manifestJson.appid || ''),
|
package/dist/hbx/alias.js
CHANGED
|
@@ -15,7 +15,7 @@ const hbxPlugins = {
|
|
|
15
15
|
// pug: 'compile-pug-cli/node_modules/pug',
|
|
16
16
|
};
|
|
17
17
|
function initModuleAlias() {
|
|
18
|
-
if (env_1.isInHBuilderX()) {
|
|
18
|
+
if ((0, env_1.isInHBuilderX)()) {
|
|
19
19
|
Object.keys(hbxPlugins).forEach((name) => {
|
|
20
20
|
module_alias_1.default.addAlias(name, path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, hbxPlugins[name]));
|
|
21
21
|
});
|
package/dist/hbx/env.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.initModulePaths = exports.runByHBuilderX = exports.isInHBuilderX = void
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const module_1 = __importDefault(require("module"));
|
|
9
9
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
10
|
-
exports.isInHBuilderX = uni_shared_1.once(() => {
|
|
10
|
+
exports.isInHBuilderX = (0, uni_shared_1.once)(() => {
|
|
11
11
|
try {
|
|
12
12
|
const { name } = require(path_1.default.resolve(process.cwd(), '../about/package.json'));
|
|
13
13
|
return name === 'about';
|
|
@@ -17,14 +17,14 @@ exports.isInHBuilderX = uni_shared_1.once(() => {
|
|
|
17
17
|
}
|
|
18
18
|
return false;
|
|
19
19
|
});
|
|
20
|
-
exports.runByHBuilderX = uni_shared_1.once(() => {
|
|
20
|
+
exports.runByHBuilderX = (0, uni_shared_1.once)(() => {
|
|
21
21
|
return !!process.env.UNI_HBUILDERX_PLUGINS;
|
|
22
22
|
});
|
|
23
23
|
/**
|
|
24
24
|
* 增加 node_modules
|
|
25
25
|
*/
|
|
26
26
|
function initModulePaths() {
|
|
27
|
-
if (!exports.isInHBuilderX()) {
|
|
27
|
+
if (!(0, exports.isInHBuilderX)()) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const Module = module.constructor.length > 1 ? module.constructor : module_1.default;
|
package/dist/i18n.js
CHANGED
|
@@ -16,7 +16,7 @@ function initI18nOptions(platform, inputDir, warning = false, withMessages = tru
|
|
|
16
16
|
if (!Object.keys(locales).length) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const manifestJson = json_1.parseManifestJsonOnce(inputDir);
|
|
19
|
+
const manifestJson = (0, json_1.parseManifestJsonOnce)(inputDir);
|
|
20
20
|
const fallbackLocale = manifestJson.fallbackLocale || manifestJson.locale;
|
|
21
21
|
const locale = resolveI18nLocale(platform, Object.keys(locales), fallbackLocale);
|
|
22
22
|
if (warning) {
|
|
@@ -34,7 +34,7 @@ function initI18nOptions(platform, inputDir, warning = false, withMessages = tru
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
exports.initI18nOptions = initI18nOptions;
|
|
37
|
-
exports.initI18nOptionsOnce = uni_shared_1.once(initI18nOptions);
|
|
37
|
+
exports.initI18nOptionsOnce = (0, uni_shared_1.once)(initI18nOptions);
|
|
38
38
|
const localeJsonRE = /uni-app.*.json/;
|
|
39
39
|
function isUniAppLocaleFile(filepath) {
|
|
40
40
|
if (!filepath) {
|
|
@@ -44,14 +44,14 @@ function isUniAppLocaleFile(filepath) {
|
|
|
44
44
|
}
|
|
45
45
|
exports.isUniAppLocaleFile = isUniAppLocaleFile;
|
|
46
46
|
function parseLocaleJson(filepath) {
|
|
47
|
-
let jsonObj = json_1.parseJson(fs_1.default.readFileSync(filepath, 'utf8'));
|
|
47
|
+
let jsonObj = (0, json_1.parseJson)(fs_1.default.readFileSync(filepath, 'utf8'));
|
|
48
48
|
if (isUniAppLocaleFile(filepath)) {
|
|
49
49
|
jsonObj = jsonObj.common || {};
|
|
50
50
|
}
|
|
51
51
|
return jsonObj;
|
|
52
52
|
}
|
|
53
53
|
function getLocaleFiles(cwd) {
|
|
54
|
-
return fast_glob_1.sync('*.json', { cwd, absolute: true });
|
|
54
|
+
return (0, fast_glob_1.sync)('*.json', { cwd, absolute: true });
|
|
55
55
|
}
|
|
56
56
|
exports.getLocaleFiles = getLocaleFiles;
|
|
57
57
|
function initLocales(dir, withMessages = true) {
|
|
@@ -65,7 +65,7 @@ function initLocales(dir, withMessages = true) {
|
|
|
65
65
|
.basename(filename)
|
|
66
66
|
.replace(/(uni-app.)?(.*).json/, '$2');
|
|
67
67
|
if (withMessages) {
|
|
68
|
-
shared_1.extend(res[locale] || (res[locale] = {}), parseLocaleJson(path_1.default.join(dir, filename)));
|
|
68
|
+
(0, shared_1.extend)(res[locale] || (res[locale] = {}), parseLocaleJson(path_1.default.join(dir, filename)));
|
|
69
69
|
}
|
|
70
70
|
else {
|
|
71
71
|
res[locale] = {};
|
|
@@ -4,9 +4,9 @@ exports.initI18n = void 0;
|
|
|
4
4
|
const uni_i18n_1 = require("@dcloudio/uni-i18n");
|
|
5
5
|
const i18n_1 = require("../../../i18n");
|
|
6
6
|
function initI18n(manifestJson) {
|
|
7
|
-
const i18nOptions = i18n_1.initI18nOptions(process.env.UNI_PLATFORM, process.env.UNI_INPUT_DIR, true);
|
|
7
|
+
const i18nOptions = (0, i18n_1.initI18nOptions)(process.env.UNI_PLATFORM, process.env.UNI_INPUT_DIR, true);
|
|
8
8
|
if (i18nOptions) {
|
|
9
|
-
manifestJson = JSON.parse(uni_i18n_1.compileI18nJsonStr(JSON.stringify(manifestJson), i18nOptions));
|
|
9
|
+
manifestJson = JSON.parse((0, uni_i18n_1.compileI18nJsonStr)(JSON.stringify(manifestJson), i18nOptions));
|
|
10
10
|
manifestJson.fallbackLocale = i18nOptions.locale;
|
|
11
11
|
}
|
|
12
12
|
return manifestJson;
|
|
@@ -25,17 +25,17 @@ const launchwebview_1 = require("./launchwebview");
|
|
|
25
25
|
const tabBar_1 = require("./tabBar");
|
|
26
26
|
const i18n_1 = require("./i18n");
|
|
27
27
|
function normalizeAppManifestJson(userManifestJson, pagesJson) {
|
|
28
|
-
const manifestJson = merge_1.initRecursiveMerge(statusbar_1.initAppStatusbar(defaultManifestJson_1.initDefaultManifestJson(), pagesJson), userManifestJson);
|
|
29
|
-
arguments_1.initArguments(manifestJson, pagesJson);
|
|
30
|
-
plus_1.initPlus(manifestJson, pagesJson);
|
|
31
|
-
nvue_1.initNVue(manifestJson, pagesJson);
|
|
32
|
-
safearea_1.initSafearea(manifestJson, pagesJson);
|
|
33
|
-
splashscreen_1.initSplashscreen(manifestJson, userManifestJson);
|
|
34
|
-
confusion_1.initConfusion(manifestJson);
|
|
35
|
-
uniApp_1.initUniApp(manifestJson);
|
|
28
|
+
const manifestJson = (0, merge_1.initRecursiveMerge)((0, statusbar_1.initAppStatusbar)((0, defaultManifestJson_1.initDefaultManifestJson)(), pagesJson), userManifestJson);
|
|
29
|
+
(0, arguments_1.initArguments)(manifestJson, pagesJson);
|
|
30
|
+
(0, plus_1.initPlus)(manifestJson, pagesJson);
|
|
31
|
+
(0, nvue_1.initNVue)(manifestJson, pagesJson);
|
|
32
|
+
(0, safearea_1.initSafearea)(manifestJson, pagesJson);
|
|
33
|
+
(0, splashscreen_1.initSplashscreen)(manifestJson, userManifestJson);
|
|
34
|
+
(0, confusion_1.initConfusion)(manifestJson);
|
|
35
|
+
(0, uniApp_1.initUniApp)(manifestJson);
|
|
36
36
|
// 依赖 initArguments 先执行
|
|
37
|
-
tabBar_1.initTabBar(launchwebview_1.initLaunchwebview(manifestJson, pagesJson), manifestJson, pagesJson);
|
|
38
|
-
return i18n_1.initI18n(manifestJson);
|
|
37
|
+
(0, tabBar_1.initTabBar)((0, launchwebview_1.initLaunchwebview)(manifestJson, pagesJson), manifestJson, pagesJson);
|
|
38
|
+
return (0, i18n_1.initI18n)(manifestJson);
|
|
39
39
|
}
|
|
40
40
|
exports.normalizeAppManifestJson = normalizeAppManifestJson;
|
|
41
41
|
__exportStar(require("./env"), exports);
|
|
@@ -15,7 +15,7 @@ function initLaunchwebview(manifestJson, pagesJson) {
|
|
|
15
15
|
catch (e) { }
|
|
16
16
|
}
|
|
17
17
|
manifestJson.plus.useragent.value = 'uni-app';
|
|
18
|
-
shared_1.extend(manifestJson.plus.launchwebview, {
|
|
18
|
+
(0, shared_1.extend)(manifestJson.plus.launchwebview, {
|
|
19
19
|
id: '1',
|
|
20
20
|
kernel: 'WKWebview',
|
|
21
21
|
});
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initRecursiveMerge = void 0;
|
|
4
4
|
const merge_1 = require("merge");
|
|
5
5
|
function initRecursiveMerge(manifestJson, userManifestJson) {
|
|
6
|
-
return merge_1.recursive(true, manifestJson, {
|
|
6
|
+
return (0, merge_1.recursive)(true, manifestJson, {
|
|
7
7
|
id: userManifestJson.appid || '',
|
|
8
8
|
name: userManifestJson.name || '',
|
|
9
9
|
description: userManifestJson.description || '',
|
|
@@ -8,7 +8,7 @@ function initSplashscreen(manifestJson, userManifestJson) {
|
|
|
8
8
|
}
|
|
9
9
|
// 强制白屏检测
|
|
10
10
|
const splashscreenOptions = userManifestJson['app-plus'] && userManifestJson['app-plus'].splashscreen;
|
|
11
|
-
const hasAlwaysShowBeforeRender = splashscreenOptions && shared_1.hasOwn(splashscreenOptions, 'alwaysShowBeforeRender');
|
|
11
|
+
const hasAlwaysShowBeforeRender = splashscreenOptions && (0, shared_1.hasOwn)(splashscreenOptions, 'alwaysShowBeforeRender');
|
|
12
12
|
if (!hasAlwaysShowBeforeRender &&
|
|
13
13
|
manifestJson.plus.splashscreen.autoclose === false) {
|
|
14
14
|
// 兼容旧版本仅配置了 autoclose 为 false
|
|
@@ -7,10 +7,10 @@ function initUniApp(manifestJson) {
|
|
|
7
7
|
control: 'uni-v3',
|
|
8
8
|
vueVersion: '3',
|
|
9
9
|
compilerVersion: process.env.UNI_COMPILER_VERSION,
|
|
10
|
-
nvueCompiler: nvue_1.getNVueCompiler(manifestJson),
|
|
10
|
+
nvueCompiler: (0, nvue_1.getNVueCompiler)(manifestJson),
|
|
11
11
|
renderer: 'auto',
|
|
12
12
|
nvue: {
|
|
13
|
-
'flex-direction': nvue_1.getNVueFlexDirection(manifestJson),
|
|
13
|
+
'flex-direction': (0, nvue_1.getNVueFlexDirection)(manifestJson),
|
|
14
14
|
},
|
|
15
15
|
nvueLaunchMode: manifestJson.plus.nvueLaunchMode === 'fast' ? 'fast' : 'normal',
|
|
16
16
|
};
|
|
@@ -10,8 +10,8 @@ function definePageCode(pagesJson) {
|
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const pagePath = page.path;
|
|
13
|
-
const pageIdentifier = utils_1.normalizeIdentifier(pagePath);
|
|
14
|
-
const pagePathWithExtname = utils_1.normalizePagePath(pagePath, 'app');
|
|
13
|
+
const pageIdentifier = (0, utils_1.normalizeIdentifier)(pagePath);
|
|
14
|
+
const pagePathWithExtname = (0, utils_1.normalizePagePath)(pagePath, 'app');
|
|
15
15
|
if (pagePathWithExtname) {
|
|
16
16
|
if (process.env.UNI_APP_CODE_SPLITING) {
|
|
17
17
|
// 拆分页面
|
|
@@ -17,15 +17,15 @@ const uniConfig_1 = require("./uniConfig");
|
|
|
17
17
|
const uniRoutes_1 = require("./uniRoutes");
|
|
18
18
|
__exportStar(require("./nvue"), exports);
|
|
19
19
|
function normalizeAppPagesJson(pagesJson) {
|
|
20
|
-
return code_1.polyfillCode + code_1.restoreGlobalCode + definePage_1.definePageCode(pagesJson);
|
|
20
|
+
return code_1.polyfillCode + code_1.restoreGlobalCode + (0, definePage_1.definePageCode)(pagesJson);
|
|
21
21
|
}
|
|
22
22
|
exports.normalizeAppPagesJson = normalizeAppPagesJson;
|
|
23
23
|
function normalizeAppConfigService(pagesJson, manifestJson) {
|
|
24
24
|
return `
|
|
25
25
|
;(function(){
|
|
26
26
|
let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
|
|
27
|
-
const __uniConfig = ${uniConfig_1.normalizeAppUniConfig(pagesJson, manifestJson)};
|
|
28
|
-
const __uniRoutes = ${uniRoutes_1.normalizeAppUniRoutes(pagesJson)}.map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
|
|
27
|
+
const __uniConfig = ${(0, uniConfig_1.normalizeAppUniConfig)(pagesJson, manifestJson)};
|
|
28
|
+
const __uniRoutes = ${(0, uniRoutes_1.normalizeAppUniRoutes)(pagesJson)}.map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
|
|
29
29
|
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
|
30
30
|
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
|
31
31
|
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,${code_1.globalCode}}}}});
|
|
@@ -20,7 +20,7 @@ function initWebpackNVueEntry(pages) {
|
|
|
20
20
|
if (!path) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
const subNVuePath = utils_1.removeExt(path.split('?')[0]);
|
|
23
|
+
const subNVuePath = (0, utils_1.removeExt)(path.split('?')[0]);
|
|
24
24
|
process.UNI_NVUE_ENTRY[subNVuePath] = genWebpackBase64Code(genNVueEntryCode(subNVuePath));
|
|
25
25
|
});
|
|
26
26
|
});
|
|
@@ -31,7 +31,7 @@ function genWebpackBase64Code(code) {
|
|
|
31
31
|
}
|
|
32
32
|
function genNVueEntryCode(route) {
|
|
33
33
|
return `import '${genWebpackBase64Code(genNVueAppStyle())}'
|
|
34
|
-
import App from '${utils_1.normalizePath(path_1.default.resolve(process.env.UNI_INPUT_DIR, route))}.nvue?mpType=page'
|
|
34
|
+
import App from '${(0, utils_1.normalizePath)(path_1.default.resolve(process.env.UNI_INPUT_DIR, route))}.nvue?mpType=page'
|
|
35
35
|
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
|
|
36
36
|
Promise.prototype.finally = function(callback) {
|
|
37
37
|
var promise = this.constructor
|
|
@@ -70,7 +70,7 @@ function genNVueAppStyle() {
|
|
|
70
70
|
const stringifyRequest = (r) => loaderUtils.stringifyRequest({}, r);
|
|
71
71
|
styles.forEach((style, index) => {
|
|
72
72
|
if (!style.src) {
|
|
73
|
-
style.src = utils_1.normalizePath(appVuePath);
|
|
73
|
+
style.src = (0, utils_1.normalizePath)(appVuePath);
|
|
74
74
|
}
|
|
75
75
|
code =
|
|
76
76
|
code +
|
|
@@ -14,9 +14,9 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
|
|
|
14
14
|
pages: [],
|
|
15
15
|
globalStyle: pagesJson.globalStyle,
|
|
16
16
|
nvue: {
|
|
17
|
-
compiler: manifest_2.getNVueCompiler(manifestJson),
|
|
18
|
-
styleCompiler: manifest_2.getNVueStyleCompiler(manifestJson),
|
|
19
|
-
'flex-direction': manifest_2.getNVueFlexDirection(manifestJson),
|
|
17
|
+
compiler: (0, manifest_2.getNVueCompiler)(manifestJson),
|
|
18
|
+
styleCompiler: (0, manifest_2.getNVueStyleCompiler)(manifestJson),
|
|
19
|
+
'flex-direction': (0, manifest_2.getNVueFlexDirection)(manifestJson),
|
|
20
20
|
},
|
|
21
21
|
renderer: ((_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.renderer) === 'native' ? 'native' : 'auto',
|
|
22
22
|
appname: manifestJson.name || '',
|
|
@@ -29,9 +29,9 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
|
|
|
29
29
|
},
|
|
30
30
|
compilerVersion: process.env.UNI_COMPILER_VERSION,
|
|
31
31
|
entryPagePath: pagesJson.pages[0].path,
|
|
32
|
-
networkTimeout: manifest_1.normalizeNetworkTimeout(manifestJson.networkTimeout),
|
|
32
|
+
networkTimeout: (0, manifest_1.normalizeNetworkTimeout)(manifestJson.networkTimeout),
|
|
33
33
|
tabBar: pagesJson.tabBar,
|
|
34
|
-
locales: i18n_1.initLocales(path_1.default.join(process.env.UNI_INPUT_DIR, 'locale')),
|
|
34
|
+
locales: (0, i18n_1.initLocales)(path_1.default.join(process.env.UNI_INPUT_DIR, 'locale')),
|
|
35
35
|
};
|
|
36
36
|
// TODO 待支持分包
|
|
37
37
|
return JSON.stringify(config);
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeAppUniRoutes = void 0;
|
|
4
4
|
const pages_1 = require("../../pages");
|
|
5
5
|
function normalizeAppUniRoutes(pagesJson) {
|
|
6
|
-
return JSON.stringify(pages_1.normalizePagesRoute(pagesJson));
|
|
6
|
+
return JSON.stringify((0, pages_1.normalizePagesRoute)(pagesJson));
|
|
7
7
|
}
|
|
8
8
|
exports.normalizeAppUniRoutes = normalizeAppUniRoutes;
|
package/dist/json/json.js
CHANGED
|
@@ -4,6 +4,6 @@ exports.parseJson = void 0;
|
|
|
4
4
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
5
5
|
const preprocess_1 = require("../preprocess");
|
|
6
6
|
function parseJson(jsonStr, shouldPre = false) {
|
|
7
|
-
return jsonc_parser_1.parse(shouldPre ? preprocess_1.preJson(jsonStr) : jsonStr);
|
|
7
|
+
return (0, jsonc_parser_1.parse)(shouldPre ? (0, preprocess_1.preJson)(jsonStr) : jsonStr);
|
|
8
8
|
}
|
|
9
9
|
exports.parseJson = parseJson;
|
package/dist/json/manifest.js
CHANGED
|
@@ -10,19 +10,19 @@ const shared_1 = require("@vue/shared");
|
|
|
10
10
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
11
11
|
const json_1 = require("./json");
|
|
12
12
|
const parseManifestJson = (inputDir) => {
|
|
13
|
-
return json_1.parseJson(fs_1.default.readFileSync(path_1.default.join(inputDir, 'manifest.json'), 'utf8'));
|
|
13
|
+
return (0, json_1.parseJson)(fs_1.default.readFileSync(path_1.default.join(inputDir, 'manifest.json'), 'utf8'));
|
|
14
14
|
};
|
|
15
15
|
exports.parseManifestJson = parseManifestJson;
|
|
16
|
-
exports.parseManifestJsonOnce = uni_shared_1.once(exports.parseManifestJson);
|
|
17
|
-
exports.parseRpx2UnitOnce = uni_shared_1.once((inputDir) => {
|
|
18
|
-
const { h5 } = exports.parseManifestJsonOnce(inputDir);
|
|
19
|
-
return shared_1.extend({}, uni_shared_1.defaultRpx2Unit, (h5 && h5.rpx) || {});
|
|
16
|
+
exports.parseManifestJsonOnce = (0, uni_shared_1.once)(exports.parseManifestJson);
|
|
17
|
+
exports.parseRpx2UnitOnce = (0, uni_shared_1.once)((inputDir) => {
|
|
18
|
+
const { h5 } = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
19
|
+
return (0, shared_1.extend)({}, uni_shared_1.defaultRpx2Unit, (h5 && h5.rpx) || {});
|
|
20
20
|
});
|
|
21
21
|
function parseCompatConfig(_inputDir) {
|
|
22
22
|
// 不支持 mode:2
|
|
23
23
|
return { MODE: 3 }; //parseManifestJsonOnce(inputDir).compatConfig || {}
|
|
24
24
|
}
|
|
25
|
-
exports.parseCompatConfigOnce = uni_shared_1.once(parseCompatConfig);
|
|
25
|
+
exports.parseCompatConfigOnce = (0, uni_shared_1.once)(parseCompatConfig);
|
|
26
26
|
const defaultNetworkTimeout = {
|
|
27
27
|
request: 60000,
|
|
28
28
|
connectSocket: 60000,
|
|
@@ -37,12 +37,12 @@ function normalizeNetworkTimeout(networkTimeout) {
|
|
|
37
37
|
}
|
|
38
38
|
exports.normalizeNetworkTimeout = normalizeNetworkTimeout;
|
|
39
39
|
function getUniStatistics(inputDir, platform) {
|
|
40
|
-
const manifest = exports.parseManifestJsonOnce(inputDir);
|
|
41
|
-
return shared_1.extend({}, manifest.uniStatistics, manifest[platform] && manifest[platform].uniStatistics);
|
|
40
|
+
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
41
|
+
return (0, shared_1.extend)({}, manifest.uniStatistics, manifest[platform] && manifest[platform].uniStatistics);
|
|
42
42
|
}
|
|
43
43
|
exports.getUniStatistics = getUniStatistics;
|
|
44
44
|
function getRouterOptions(manifestJson) {
|
|
45
45
|
var _a;
|
|
46
|
-
return shared_1.extend({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.router);
|
|
46
|
+
return (0, shared_1.extend)({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.router);
|
|
47
47
|
}
|
|
48
48
|
exports.getRouterOptions = getRouterOptions;
|