@dcloudio/uni-cli-shared 3.0.0-4020920240930001 → 3.0.0-4040420241231001
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/LICENSE +0 -0
- package/dist/deps.d.ts +2 -2
- package/dist/deps.js +45 -34
- package/dist/easycom.js +15 -8
- package/dist/env/define.d.ts +1 -0
- package/dist/env/define.js +15 -0
- package/dist/env/index.d.ts +1 -1
- package/dist/env/index.js +1 -2
- package/dist/env/provide.d.ts +0 -3
- package/dist/env/provide.js +1 -7
- package/dist/hbx/index.d.ts +1 -0
- package/dist/hbx/index.js +8 -1
- package/dist/hbx/log.d.ts +1 -0
- package/dist/hbx/log.js +56 -25
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -3
- package/dist/json/app/manifest/defaultManifestJson.js +8 -2
- package/dist/json/app/manifest/launchwebview.js +22 -1
- package/dist/json/app/manifest/merge.js +5 -1
- package/dist/json/app/manifest/plus.js +1 -0
- package/dist/json/app/manifest/safearea.js +8 -0
- package/dist/json/app/pages/uniConfig.js +2 -0
- package/dist/json/index.d.ts +1 -1
- package/dist/json/index.js +2 -1
- package/dist/json/manifest.js +2 -1
- package/dist/json/mp/jsonFile.d.ts +15 -0
- package/dist/json/mp/jsonFile.js +16 -2
- package/dist/json/mp/pages.d.ts +1 -1
- package/dist/json/mp/pages.js +12 -1
- package/dist/json/mp/project.d.ts +1 -0
- package/dist/json/mp/project.js +16 -4
- package/dist/json/pages.js +1 -1
- package/dist/json/uni-x/index.d.ts +1 -1
- package/dist/json/uni-x/index.js +23 -6
- package/dist/json/uni-x/manifest.d.ts +1 -0
- package/dist/json/uni-x/manifest.js +9 -1
- package/dist/json/uni-x/uniConfig.d.ts +15 -1
- package/dist/json/uni-x/uniConfig.js +1 -1
- package/dist/logs/console.d.ts +1 -0
- package/dist/logs/console.js +6 -2
- package/dist/logs/format.js +1 -0
- package/dist/mp/plugin.js +8 -1
- package/dist/mp/template.d.ts +14 -1
- package/dist/mp/usingComponents.js +2 -2
- package/dist/platform.js +4 -0
- package/dist/preprocess/context.d.ts +5 -0
- package/dist/preprocess/context.js +16 -5
- package/dist/resolve.d.ts +2 -1
- package/dist/resolve.js +14 -3
- package/dist/uni_modules.cloud.d.ts +49 -0
- package/dist/uni_modules.cloud.js +332 -0
- package/dist/uni_modules.d.ts +0 -49
- package/dist/uni_modules.js +7 -331
- package/dist/utils.d.ts +8 -0
- package/dist/utils.js +44 -6
- package/dist/uts.d.ts +10 -2
- package/dist/uts.js +197 -41
- package/dist/vite/autoImport.js +8 -1
- package/dist/vite/cloud.d.ts +1 -0
- package/dist/vite/cloud.js +52 -10
- package/dist/vite/extApi.d.ts +2 -0
- package/dist/vite/extApi.js +43 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +1 -0
- package/dist/vite/plugins/console.js +7 -0
- package/dist/vite/plugins/copy.js +8 -1
- package/dist/vite/plugins/index.d.ts +3 -1
- package/dist/vite/plugins/index.js +4 -1
- package/dist/vite/plugins/pre.d.ts +6 -0
- package/dist/vite/plugins/pre.js +59 -0
- package/dist/vite/plugins/sourceMap.d.ts +5 -0
- package/dist/vite/plugins/sourceMap.js +70 -0
- package/dist/vite/plugins/uts/uni_modules.d.ts +6 -0
- package/dist/vite/plugins/uts/uni_modules.js +322 -23
- package/dist/vite/plugins/vitejs/plugins/asset.js +4 -2
- package/dist/vite/plugins/vitejs/plugins/css.d.ts +1 -0
- package/dist/vite/plugins/vitejs/plugins/css.js +25 -5
- package/dist/vite/utils/index.js +2 -1
- package/dist/vite/utils/utils.js +12 -6
- package/dist/vue/transforms/index.d.ts +2 -0
- package/dist/vue/transforms/index.js +2 -0
- package/dist/vue/transforms/x/transformDirection.d.ts +6 -0
- package/dist/vue/transforms/x/transformDirection.js +55 -0
- package/dist/vue/transforms/x/transformMPBuiltInTag.d.ts +12 -0
- package/dist/vue/transforms/x/transformMPBuiltInTag.js +101 -0
- package/dist/vue/utils.d.ts +1 -0
- package/dist/vue/utils.js +13 -1
- package/dist/watcher.js +18 -3
- package/lib/preprocess/LICENSE +0 -0
- package/lib/preprocess/README.md +0 -0
- package/lib/preprocess/lib/preprocess.js +0 -0
- package/lib/preprocess/lib/regexrules.js +0 -0
- package/lib/preprocess/package.json +0 -0
- package/license.md +1 -1
- package/package.json +9 -9
package/LICENSE
CHANGED
|
File without changes
|
package/dist/deps.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const API_DEPS_CSS: {
|
|
1
|
+
export declare const API_DEPS_CSS: (isX: boolean) => {
|
|
2
2
|
showModal: string[];
|
|
3
3
|
showToast: string[];
|
|
4
4
|
showActionSheet: string[];
|
|
@@ -6,7 +6,7 @@ export declare const API_DEPS_CSS: {
|
|
|
6
6
|
openLocation: string[];
|
|
7
7
|
chooseLocation: string[];
|
|
8
8
|
};
|
|
9
|
-
export declare const COMPONENT_DEPS_CSS: {
|
|
9
|
+
export declare const COMPONENT_DEPS_CSS: (isX: boolean) => {
|
|
10
10
|
canvas: string[];
|
|
11
11
|
image: string[];
|
|
12
12
|
'movable-area': string[];
|
package/dist/deps.js
CHANGED
|
@@ -4,39 +4,50 @@ exports.COMPONENT_DEPS_CSS = exports.API_DEPS_CSS = void 0;
|
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
const RESIZE_SENSOR_CSS = constants_1.BASE_COMPONENTS_STYLE_PATH + 'resize-sensor.css';
|
|
6
6
|
const REFRESHER_CSS = constants_1.BASE_COMPONENTS_STYLE_PATH + 'refresher.css';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
const API_DEPS_CSS = (isX) => {
|
|
8
|
+
return {
|
|
9
|
+
showModal: [`${constants_1.H5_API_STYLE_PATH}modal.css`],
|
|
10
|
+
showToast: [`${constants_1.H5_API_STYLE_PATH}toast.css`],
|
|
11
|
+
showActionSheet: [`${constants_1.H5_API_STYLE_PATH}action-sheet.css`],
|
|
12
|
+
previewImage: [
|
|
13
|
+
RESIZE_SENSOR_CSS,
|
|
14
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}swiper.css`,
|
|
15
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}swiper-item.css`,
|
|
16
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}movable-area.css`,
|
|
17
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}movable-view.css`,
|
|
18
|
+
],
|
|
19
|
+
openLocation: [`${constants_1.H5_API_STYLE_PATH}location-view.css`],
|
|
20
|
+
chooseLocation: [
|
|
21
|
+
...(isX
|
|
22
|
+
? [
|
|
23
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}/view.css`,
|
|
24
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}/text.css`,
|
|
25
|
+
]
|
|
26
|
+
: [`${constants_1.H5_API_STYLE_PATH}/location-picker.css`]),
|
|
27
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}/input.css`,
|
|
28
|
+
`${constants_1.H5_COMPONENTS_STYLE_PATH}/map.css`,
|
|
29
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}/scroll-view.css`,
|
|
30
|
+
],
|
|
31
|
+
};
|
|
25
32
|
};
|
|
26
|
-
exports.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
RESIZE_SENSOR_CSS,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
exports.API_DEPS_CSS = API_DEPS_CSS;
|
|
34
|
+
const COMPONENT_DEPS_CSS = (isX) => {
|
|
35
|
+
return {
|
|
36
|
+
canvas: [RESIZE_SENSOR_CSS],
|
|
37
|
+
image: [RESIZE_SENSOR_CSS],
|
|
38
|
+
'movable-area': [RESIZE_SENSOR_CSS],
|
|
39
|
+
'picker-view': [RESIZE_SENSOR_CSS],
|
|
40
|
+
'picker-view-column': [RESIZE_SENSOR_CSS],
|
|
41
|
+
'rich-text': [RESIZE_SENSOR_CSS],
|
|
42
|
+
textarea: [RESIZE_SENSOR_CSS],
|
|
43
|
+
'web-view': [RESIZE_SENSOR_CSS],
|
|
44
|
+
picker: [
|
|
45
|
+
RESIZE_SENSOR_CSS,
|
|
46
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}picker-view.css`,
|
|
47
|
+
`${constants_1.BASE_COMPONENTS_STYLE_PATH}picker-view-column.css`,
|
|
48
|
+
],
|
|
49
|
+
'scroll-view': [REFRESHER_CSS],
|
|
50
|
+
'list-view': [RESIZE_SENSOR_CSS, REFRESHER_CSS],
|
|
51
|
+
};
|
|
42
52
|
};
|
|
53
|
+
exports.COMPONENT_DEPS_CSS = COMPONENT_DEPS_CSS;
|
package/dist/easycom.js
CHANGED
|
@@ -64,8 +64,11 @@ function initEasycoms(inputDir, { dirs, platform, isX, }) {
|
|
|
64
64
|
globalThis.uts2jsSourceCodeMap.initUts2jsEasycom(easycoms);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
// ext-api 模式下,不存在 easycom 特性
|
|
68
|
+
if (process.env.UNI_COMPILE_TARGET !== 'ext-api') {
|
|
69
|
+
initEasycom(options);
|
|
70
|
+
initUTSEasycom();
|
|
71
|
+
}
|
|
69
72
|
const componentExtNames = isX ? 'uvue|vue' : 'vue';
|
|
70
73
|
const res = {
|
|
71
74
|
options,
|
|
@@ -79,8 +82,10 @@ function initEasycoms(inputDir, { dirs, platform, isX, }) {
|
|
|
79
82
|
}),
|
|
80
83
|
refresh() {
|
|
81
84
|
res.options = initEasycomOptions();
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
if (process.env.UNI_COMPILE_TARGET !== 'ext-api') {
|
|
86
|
+
initEasycom(res.options);
|
|
87
|
+
initUTSEasycom();
|
|
88
|
+
}
|
|
84
89
|
},
|
|
85
90
|
easycoms,
|
|
86
91
|
};
|
|
@@ -186,11 +191,13 @@ function initAutoScanEasycom(dir, rootDir, extensions) {
|
|
|
186
191
|
return easycoms;
|
|
187
192
|
}
|
|
188
193
|
const is_uni_modules = path_1.default.basename(path_1.default.resolve(dir, '../..')) === 'uni_modules';
|
|
189
|
-
const
|
|
194
|
+
const is_easycom_encrypt_uni_modules = // uni_modules模式不需要此逻辑
|
|
190
195
|
process.env.UNI_COMPILE_TARGET !== 'uni_modules' &&
|
|
191
196
|
is_uni_modules &&
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
// 前端加密插件,不能包含utssdk目录
|
|
198
|
+
fs_1.default.existsSync(path_1.default.resolve(dir, '../encrypt')) &&
|
|
199
|
+
!fs_1.default.existsSync(path_1.default.resolve(dir, '../utssdk'));
|
|
200
|
+
const uni_modules_plugin_id = is_easycom_encrypt_uni_modules && path_1.default.basename(path_1.default.resolve(dir, '..'));
|
|
194
201
|
fs_1.default.readdirSync(dir).forEach((name) => {
|
|
195
202
|
const folder = path_1.default.resolve(dir, name);
|
|
196
203
|
if (!isDir(folder)) {
|
|
@@ -202,7 +209,7 @@ function initAutoScanEasycom(dir, rootDir, extensions) {
|
|
|
202
209
|
for (let i = 0; i < extensions.length; i++) {
|
|
203
210
|
const ext = extensions[i];
|
|
204
211
|
if (files.includes(name + ext)) {
|
|
205
|
-
easycoms[`^${name}$`] =
|
|
212
|
+
easycoms[`^${name}$`] = is_easycom_encrypt_uni_modules
|
|
206
213
|
? (0, utils_1.normalizePath)(path_1.default.join(rootDir, `uni_modules/${uni_modules_plugin_id}?${
|
|
207
214
|
// android 走 proxy
|
|
208
215
|
process.env.UNI_APP_X === 'true' &&
|
package/dist/env/define.d.ts
CHANGED
package/dist/env/define.js
CHANGED
|
@@ -8,6 +8,20 @@ function initDefine(stringifyBoolean = false) {
|
|
|
8
8
|
const platformManifestJson = (0, json_1.getPlatformManifestJsonOnce)();
|
|
9
9
|
const isRunByHBuilderX = (0, env_1.runByHBuilderX)();
|
|
10
10
|
const isDebug = !!manifestJson.debug;
|
|
11
|
+
const isX = process.env.UNI_APP_X === 'true';
|
|
12
|
+
const isMP = process.env.UNI_PLATFORM.startsWith('mp');
|
|
13
|
+
process.env['UNI_APP_ID'] = manifestJson.appid;
|
|
14
|
+
let mpXDefine = isX && isMP
|
|
15
|
+
? {
|
|
16
|
+
__UNI_FEATURE_VIRTUAL_HOST__: true,
|
|
17
|
+
}
|
|
18
|
+
: {
|
|
19
|
+
__UNI_FEATURE_VIRTUAL_HOST__: false,
|
|
20
|
+
};
|
|
21
|
+
if (isX && isMP) {
|
|
22
|
+
mpXDefine.__UNI_FEATURE_VIRTUAL_HOST__ =
|
|
23
|
+
platformManifestJson.enableVirtualHost !== false;
|
|
24
|
+
}
|
|
11
25
|
return {
|
|
12
26
|
...initCustomDefine(),
|
|
13
27
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
@@ -33,6 +47,7 @@ function initDefine(stringifyBoolean = false) {
|
|
|
33
47
|
// 兼容旧版本
|
|
34
48
|
'process.env.VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM || ''),
|
|
35
49
|
'process.env.VUE_APP_DARK_MODE': JSON.stringify(platformManifestJson.darkmode || false),
|
|
50
|
+
...mpXDefine,
|
|
36
51
|
};
|
|
37
52
|
}
|
|
38
53
|
exports.initDefine = initDefine;
|
package/dist/env/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { initDefine } from './define';
|
|
2
|
-
export { initAppProvide
|
|
2
|
+
export { initAppProvide } from './provide';
|
package/dist/env/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initAppProvide = exports.initDefine = void 0;
|
|
4
4
|
var define_1 = require("./define");
|
|
5
5
|
Object.defineProperty(exports, "initDefine", { enumerable: true, get: function () { return define_1.initDefine; } });
|
|
6
6
|
var provide_1 = require("./provide");
|
|
7
7
|
Object.defineProperty(exports, "initAppProvide", { enumerable: true, get: function () { return provide_1.initAppProvide; } });
|
|
8
|
-
Object.defineProperty(exports, "initH5Provide", { enumerable: true, get: function () { return provide_1.initH5Provide; } });
|
package/dist/env/provide.d.ts
CHANGED
package/dist/env/provide.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.initAppProvide = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const libDir = path_1.default.resolve(__dirname, '../../lib');
|
|
9
9
|
function initAppProvide() {
|
|
@@ -18,9 +18,3 @@ function initAppProvide() {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
exports.initAppProvide = initAppProvide;
|
|
21
|
-
function initH5Provide() {
|
|
22
|
-
return {
|
|
23
|
-
__f__: ['@dcloudio/uni-app', 'formatH5Log'],
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.initH5Provide = initH5Provide;
|
package/dist/hbx/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { formatAtFilename } from './log';
|
|
|
2
2
|
export * from './env';
|
|
3
3
|
export { initModuleAlias, installHBuilderXPlugin, formatInstallHBuilderXPluginTips, } from './alias';
|
|
4
4
|
export declare function uniHBuilderXConsolePlugin(method?: string): import("vite").Plugin<any>;
|
|
5
|
+
export declare function isEnableConsole(): boolean;
|
package/dist/hbx/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.uniHBuilderXConsolePlugin = exports.formatInstallHBuilderXPluginTips = exports.installHBuilderXPlugin = exports.initModuleAlias = exports.formatAtFilename = void 0;
|
|
20
|
+
exports.isEnableConsole = exports.uniHBuilderXConsolePlugin = exports.formatInstallHBuilderXPluginTips = exports.installHBuilderXPlugin = exports.initModuleAlias = exports.formatAtFilename = void 0;
|
|
21
21
|
const path_1 = __importDefault(require("path"));
|
|
22
22
|
const utils_1 = require("../utils");
|
|
23
23
|
const console_1 = require("../vite/plugins/console");
|
|
@@ -41,3 +41,10 @@ function uniHBuilderXConsolePlugin(method = '__f__') {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
exports.uniHBuilderXConsolePlugin = uniHBuilderXConsolePlugin;
|
|
44
|
+
function isEnableConsole() {
|
|
45
|
+
return !!(process.env.NODE_ENV === 'development' &&
|
|
46
|
+
process.env.UNI_SOCKET_HOSTS &&
|
|
47
|
+
process.env.UNI_SOCKET_PORT &&
|
|
48
|
+
process.env.UNI_SOCKET_ID);
|
|
49
|
+
}
|
|
50
|
+
exports.isEnableConsole = isEnableConsole;
|
package/dist/hbx/log.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export declare function formatAtFilename(filename: string, line?: number, column
|
|
|
4
4
|
export declare const h5ServeFormatter: Formatter;
|
|
5
5
|
export declare const removeInfoFormatter: Formatter;
|
|
6
6
|
export declare const removeWarnFormatter: Formatter;
|
|
7
|
+
export declare const removeDuplicatePluginFormatter: Formatter;
|
|
7
8
|
export declare const errorFormatter: Formatter<LogErrorOptions>;
|
package/dist/hbx/log.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.errorFormatter = exports.removeWarnFormatter = exports.removeInfoFormatter = exports.h5ServeFormatter = exports.formatAtFilename = void 0;
|
|
6
|
+
exports.errorFormatter = exports.removeDuplicatePluginFormatter = exports.removeWarnFormatter = exports.removeInfoFormatter = exports.h5ServeFormatter = exports.formatAtFilename = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
@@ -44,7 +44,10 @@ if (typeof console !== 'undefined') {
|
|
|
44
44
|
// overridedConsole('error', console.error, ZERO_WIDTH_CHAR.ERROR)
|
|
45
45
|
}
|
|
46
46
|
function formatAtFilename(filename, line, column) {
|
|
47
|
-
|
|
47
|
+
filename = filename.replace('\x00', '').split('?')[0];
|
|
48
|
+
const file = process.env.UNI_INPUT_DIR
|
|
49
|
+
? path_1.default.relative(process.env.UNI_INPUT_DIR, filename)
|
|
50
|
+
: filename;
|
|
48
51
|
return `at ${picocolors_1.default.cyan((0, utils_1.normalizePath)(file === 'pages-json-uts' ? 'pages.json' : file) +
|
|
49
52
|
':' +
|
|
50
53
|
(line || 1) +
|
|
@@ -100,6 +103,20 @@ exports.removeWarnFormatter = {
|
|
|
100
103
|
return '';
|
|
101
104
|
},
|
|
102
105
|
};
|
|
106
|
+
exports.removeDuplicatePluginFormatter = {
|
|
107
|
+
test() {
|
|
108
|
+
return true;
|
|
109
|
+
},
|
|
110
|
+
format(msg) {
|
|
111
|
+
// [plugin:vite:vue] [plugin vite:vue]
|
|
112
|
+
// 正则匹配获取第一个插件名称,然后移除 [plugin vite:vue]
|
|
113
|
+
const pluginName = msg.match(/\[plugin\s([^\]]+)\]/)?.[1];
|
|
114
|
+
if (pluginName) {
|
|
115
|
+
return msg.replace(`[plugin ${pluginName}]`, '');
|
|
116
|
+
}
|
|
117
|
+
return msg;
|
|
118
|
+
},
|
|
119
|
+
};
|
|
103
120
|
exports.errorFormatter = {
|
|
104
121
|
test(_, opts) {
|
|
105
122
|
return !!(opts && opts.error);
|
|
@@ -110,32 +127,46 @@ exports.errorFormatter = {
|
|
|
110
127
|
};
|
|
111
128
|
function buildErrorMessage(err, args = [], includeStack = true) {
|
|
112
129
|
if (err.plugin) {
|
|
113
|
-
|
|
114
|
-
if (err.message.
|
|
115
|
-
|
|
116
|
-
err.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
// 避免出现这样的错误:[plugin:vite:vue] [plugin vite:vue]
|
|
131
|
+
if (err.message.startsWith(`[plugin ${err.plugin}]`)) {
|
|
132
|
+
let msg = err.message.replace(`[plugin ${err.plugin}]`, '');
|
|
133
|
+
if (err.loc) {
|
|
134
|
+
// [plugin:vite:vue] pages/index/index.vue (2:12): v-on="" is not supported
|
|
135
|
+
const locStr = `(${err.loc.line}:${err.loc.column}):`;
|
|
136
|
+
if (msg.includes(locStr)) {
|
|
137
|
+
msg = msg.split(locStr)[1];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
args.push(`${picocolors_1.default.magenta('[plugin:' + err.plugin + ']')} ${picocolors_1.default.red(msg)}`);
|
|
120
141
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
142
|
+
else {
|
|
143
|
+
const otherMsgs = [];
|
|
144
|
+
if (err.message.includes(': [plugin ')) {
|
|
145
|
+
const messages = err.message.split(': [plugin ');
|
|
146
|
+
err.message = messages[0];
|
|
147
|
+
messages.slice(1).forEach((msg) => {
|
|
148
|
+
otherMsgs.push(`[plugin:${msg}`);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
args.push(`${picocolors_1.default.magenta('[plugin:' + err.plugin + ']')} ${picocolors_1.default.red(err.message)}`);
|
|
152
|
+
args.push(...otherMsgs);
|
|
153
|
+
if (err.loc &&
|
|
154
|
+
err.hook === 'transform' &&
|
|
155
|
+
err.plugin === 'rollup-plugin-dynamic-import-variables' &&
|
|
156
|
+
err.id &&
|
|
157
|
+
constants_1.EXTNAME_VUE_RE.test(err.id)) {
|
|
158
|
+
try {
|
|
159
|
+
const ast = (0, ast_1.parseVue)(fs_1.default.readFileSync(err.id, 'utf8'), []);
|
|
160
|
+
const scriptNode = ast.children.find((node) => node.type === compiler_core_1.NodeTypes.ELEMENT && node.tag === 'script');
|
|
161
|
+
if (scriptNode) {
|
|
162
|
+
const scriptLoc = scriptNode.loc;
|
|
163
|
+
args.push(picocolors_1.default.yellow(pad((0, utils_2.generateCodeFrame)(scriptLoc.source, err.loc))));
|
|
164
|
+
// correct error location
|
|
165
|
+
err.loc.line = scriptLoc.start.line + err.loc.line - 1;
|
|
166
|
+
}
|
|
136
167
|
}
|
|
168
|
+
catch (e) { }
|
|
137
169
|
}
|
|
138
|
-
catch (e) { }
|
|
139
170
|
}
|
|
140
171
|
}
|
|
141
172
|
else {
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export * from './resolve';
|
|
|
22
22
|
export * from './scripts';
|
|
23
23
|
export * from './platform';
|
|
24
24
|
export * from './utsUtils';
|
|
25
|
-
export { parseUniExtApi, parseUniExtApis, parseInjects,
|
|
25
|
+
export { parseUniExtApi, parseUniExtApis, parseInjects, Define, DefineOptions, Defines, getUniExtApiProviderRegisters, formatExtApiProviderName, } from './uni_modules';
|
|
26
|
+
export { parseUniModulesArtifacts, resolveEncryptUniModule, } from './uni_modules.cloud';
|
|
26
27
|
export { M } from './messages';
|
|
27
28
|
export * from './exports';
|
|
28
29
|
export { checkUpdate } from './checkUpdate';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.checkUpdate = exports.M = exports.
|
|
17
|
+
exports.checkUpdate = exports.M = exports.resolveEncryptUniModule = exports.parseUniModulesArtifacts = exports.formatExtApiProviderName = exports.getUniExtApiProviderRegisters = exports.parseInjects = exports.parseUniExtApis = exports.parseUniExtApi = void 0;
|
|
18
18
|
__exportStar(require("./fs"), exports);
|
|
19
19
|
__exportStar(require("./mp"), exports);
|
|
20
20
|
__exportStar(require("./url"), exports);
|
|
@@ -43,10 +43,11 @@ var uni_modules_1 = require("./uni_modules");
|
|
|
43
43
|
Object.defineProperty(exports, "parseUniExtApi", { enumerable: true, get: function () { return uni_modules_1.parseUniExtApi; } });
|
|
44
44
|
Object.defineProperty(exports, "parseUniExtApis", { enumerable: true, get: function () { return uni_modules_1.parseUniExtApis; } });
|
|
45
45
|
Object.defineProperty(exports, "parseInjects", { enumerable: true, get: function () { return uni_modules_1.parseInjects; } });
|
|
46
|
-
Object.defineProperty(exports, "parseUniModulesArtifacts", { enumerable: true, get: function () { return uni_modules_1.parseUniModulesArtifacts; } });
|
|
47
46
|
Object.defineProperty(exports, "getUniExtApiProviderRegisters", { enumerable: true, get: function () { return uni_modules_1.getUniExtApiProviderRegisters; } });
|
|
48
|
-
Object.defineProperty(exports, "resolveEncryptUniModule", { enumerable: true, get: function () { return uni_modules_1.resolveEncryptUniModule; } });
|
|
49
47
|
Object.defineProperty(exports, "formatExtApiProviderName", { enumerable: true, get: function () { return uni_modules_1.formatExtApiProviderName; } });
|
|
48
|
+
var uni_modules_cloud_1 = require("./uni_modules.cloud");
|
|
49
|
+
Object.defineProperty(exports, "parseUniModulesArtifacts", { enumerable: true, get: function () { return uni_modules_cloud_1.parseUniModulesArtifacts; } });
|
|
50
|
+
Object.defineProperty(exports, "resolveEncryptUniModule", { enumerable: true, get: function () { return uni_modules_cloud_1.resolveEncryptUniModule; } });
|
|
50
51
|
var messages_1 = require("./messages");
|
|
51
52
|
Object.defineProperty(exports, "M", { enumerable: true, get: function () { return messages_1.M; } });
|
|
52
53
|
__exportStar(require("./exports"), exports);
|
|
@@ -26,7 +26,7 @@ const defaultManifestJson = `{
|
|
|
26
26
|
"permissions": {},
|
|
27
27
|
"plus": {
|
|
28
28
|
"useragent": {
|
|
29
|
-
"value": "
|
|
29
|
+
"value": "",
|
|
30
30
|
"concatenate": true
|
|
31
31
|
},
|
|
32
32
|
"splashscreen": {
|
|
@@ -37,5 +37,11 @@ const defaultManifestJson = `{
|
|
|
37
37
|
},
|
|
38
38
|
"popGesture": "close",
|
|
39
39
|
"launchwebview": {}
|
|
40
|
+
},
|
|
41
|
+
"app-harmony": {
|
|
42
|
+
"useragent": {
|
|
43
|
+
"value": "",
|
|
44
|
+
"concatenate": true
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
|
-
|
|
47
|
+
}`;
|
|
@@ -14,7 +14,28 @@ function initLaunchwebview(manifestJson, pagesJson) {
|
|
|
14
14
|
}
|
|
15
15
|
catch (e) { }
|
|
16
16
|
}
|
|
17
|
-
manifestJson.plus.useragent.
|
|
17
|
+
if (manifestJson.plus.useragent.concatenate) {
|
|
18
|
+
if (manifestJson.plus.useragent.value) {
|
|
19
|
+
manifestJson.plus.useragent.value = [
|
|
20
|
+
'uni-app',
|
|
21
|
+
manifestJson.plus.useragent.value,
|
|
22
|
+
].join(' ');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
manifestJson.plus.useragent.value = 'uni-app';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (manifestJson['app-harmony'].useragent.concatenate) {
|
|
29
|
+
if (manifestJson['app-harmony'].useragent.value) {
|
|
30
|
+
manifestJson['app-harmony'].useragent.value = [
|
|
31
|
+
'uni-app',
|
|
32
|
+
manifestJson['app-harmony'].useragent.value,
|
|
33
|
+
].join(' ');
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
manifestJson['app-harmony'].useragent.value = 'uni-app';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
18
39
|
(0, shared_1.extend)(manifestJson.plus.launchwebview, {
|
|
19
40
|
id: '1',
|
|
20
41
|
kernel: 'WKWebview',
|
|
@@ -3,6 +3,10 @@ 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
|
+
const platformConfig = {
|
|
7
|
+
plus: userManifestJson['app-plus'],
|
|
8
|
+
};
|
|
9
|
+
platformConfig['app-harmony'] = userManifestJson['app-harmony'];
|
|
6
10
|
return (0, merge_1.recursive)(true, manifestJson, {
|
|
7
11
|
id: userManifestJson.appid || '',
|
|
8
12
|
name: userManifestJson.name || '',
|
|
@@ -13,6 +17,6 @@ function initRecursiveMerge(manifestJson, userManifestJson) {
|
|
|
13
17
|
},
|
|
14
18
|
locale: userManifestJson.locale,
|
|
15
19
|
uniStatistics: userManifestJson.uniStatistics,
|
|
16
|
-
},
|
|
20
|
+
}, platformConfig);
|
|
17
21
|
}
|
|
18
22
|
exports.initRecursiveMerge = initRecursiveMerge;
|
|
@@ -95,6 +95,7 @@ function initUniStatistics(manifestJson) {
|
|
|
95
95
|
// 根节点配置了统计
|
|
96
96
|
if (manifestJson.uniStatistics) {
|
|
97
97
|
manifestJson.plus.uniStatistics = (0, merge_1.recursive)(true, manifestJson.uniStatistics, manifestJson.plus.uniStatistics);
|
|
98
|
+
manifestJson['app-harmony'].uniStatistics = (0, merge_1.recursive)(true, manifestJson.uniStatistics, manifestJson['app-harmony'].uniStatistics);
|
|
98
99
|
delete manifestJson.uniStatistics;
|
|
99
100
|
}
|
|
100
101
|
if (!process.env.UNI_CLOUD_PROVIDER) {
|
|
@@ -12,6 +12,14 @@ function initSafearea(manifestJson, pagesJson) {
|
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
+
if (!manifestJson['app-harmony'].safearea) {
|
|
16
|
+
manifestJson['app-harmony'].safearea = {
|
|
17
|
+
background: pagesJson.tabBar.backgroundColor || '#FFFFFF',
|
|
18
|
+
bottom: {
|
|
19
|
+
offset: 'auto',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
15
23
|
}
|
|
16
24
|
else {
|
|
17
25
|
if (!manifestJson.plus.launchwebview) {
|
|
@@ -36,6 +36,8 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
|
|
|
36
36
|
locales: (0, i18n_1.initLocales)(path_1.default.join(process.env.UNI_INPUT_DIR, 'locale')),
|
|
37
37
|
darkmode: platformConfig.darkmode || false,
|
|
38
38
|
themeConfig: (0, theme_1.normalizeThemeConfigOnce)(platformConfig),
|
|
39
|
+
// @ts-expect-error
|
|
40
|
+
qqMapKey: platformConfig?.distribute?.sdkConfigs?.maps?.tencent?.key,
|
|
39
41
|
};
|
|
40
42
|
// TODO 待支持分包
|
|
41
43
|
return JSON.stringify(config);
|
package/dist/json/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export * from './json';
|
|
|
4
4
|
export * from './pages';
|
|
5
5
|
export * from './manifest';
|
|
6
6
|
export * from './theme';
|
|
7
|
-
export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, checkPagesJson, parseUniXFlexDirection, parseUniXSplashScreen, } from './uni-x';
|
|
7
|
+
export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, checkPagesJson, parseUniXFlexDirection, parseUniXSplashScreen, parseUniXUniStatistics, } from './uni-x';
|
package/dist/json/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.checkPagesJson = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
|
|
17
|
+
exports.parseUniXUniStatistics = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.checkPagesJson = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
|
|
18
18
|
__exportStar(require("./mp"), exports);
|
|
19
19
|
__exportStar(require("./app"), exports);
|
|
20
20
|
__exportStar(require("./json"), exports);
|
|
@@ -27,3 +27,4 @@ Object.defineProperty(exports, "normalizeUniAppXAppConfig", { enumerable: true,
|
|
|
27
27
|
Object.defineProperty(exports, "checkPagesJson", { enumerable: true, get: function () { return uni_x_1.checkPagesJson; } });
|
|
28
28
|
Object.defineProperty(exports, "parseUniXFlexDirection", { enumerable: true, get: function () { return uni_x_1.parseUniXFlexDirection; } });
|
|
29
29
|
Object.defineProperty(exports, "parseUniXSplashScreen", { enumerable: true, get: function () { return uni_x_1.parseUniXSplashScreen; } });
|
|
30
|
+
Object.defineProperty(exports, "parseUniXUniStatistics", { enumerable: true, get: function () { return uni_x_1.parseUniXUniStatistics; } });
|
package/dist/json/manifest.js
CHANGED
|
@@ -9,10 +9,11 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const shared_1 = require("@vue/shared");
|
|
10
10
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
11
11
|
const json_1 = require("./json");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
12
13
|
const parseManifestJson = (inputDir) => {
|
|
13
14
|
const manifestFilename = path_1.default.join(inputDir, 'manifest.json');
|
|
14
15
|
if (!fs_1.default.existsSync(manifestFilename)) {
|
|
15
|
-
if (
|
|
16
|
+
if (!(0, utils_1.isNormalCompileTarget)()) {
|
|
16
17
|
return {};
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -24,5 +24,20 @@ export declare function findMiniProgramUsingComponents({ filename, inputDir, com
|
|
|
24
24
|
inputDir: string;
|
|
25
25
|
componentsDir?: string;
|
|
26
26
|
}): MiniProgramComponents;
|
|
27
|
+
/**
|
|
28
|
+
* 开发者在配置usingComponents时,可以指向具体路径(不含文件后缀),也可以指向目录(指向目录时查找目录下的index.wxml/.json等)
|
|
29
|
+
* 当usingComponents配置为`"demo": "/components/demo"`时,查找优先级为:
|
|
30
|
+
* 1. /components/demo.wxml
|
|
31
|
+
* 2. /components/demo/index.wxml
|
|
32
|
+
*
|
|
33
|
+
* 注意如下配置是非法的:
|
|
34
|
+
* - "demo": "/components/demo.wxml"
|
|
35
|
+
* - "demo": "/components/demo/"
|
|
36
|
+
*
|
|
37
|
+
* 注意用户的pages.json内可以配置如下三种路径:
|
|
38
|
+
* - "demo": "/wxcomponents/demo"
|
|
39
|
+
* - "demo": "wxcomponents/demo"
|
|
40
|
+
* - [TODO 待确认] "demo": "../wxcomponents/demo"
|
|
41
|
+
*/
|
|
27
42
|
export declare function findUsingComponentsJson(pathInpages: string, componentsDir: string): Record<any, any>;
|
|
28
43
|
export {};
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -165,6 +165,21 @@ function findMiniProgramUsingComponent(usingComponents, componentsDir) {
|
|
|
165
165
|
return res;
|
|
166
166
|
}, {});
|
|
167
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* 开发者在配置usingComponents时,可以指向具体路径(不含文件后缀),也可以指向目录(指向目录时查找目录下的index.wxml/.json等)
|
|
170
|
+
* 当usingComponents配置为`"demo": "/components/demo"`时,查找优先级为:
|
|
171
|
+
* 1. /components/demo.wxml
|
|
172
|
+
* 2. /components/demo/index.wxml
|
|
173
|
+
*
|
|
174
|
+
* 注意如下配置是非法的:
|
|
175
|
+
* - "demo": "/components/demo.wxml"
|
|
176
|
+
* - "demo": "/components/demo/"
|
|
177
|
+
*
|
|
178
|
+
* 注意用户的pages.json内可以配置如下三种路径:
|
|
179
|
+
* - "demo": "/wxcomponents/demo"
|
|
180
|
+
* - "demo": "wxcomponents/demo"
|
|
181
|
+
* - [TODO 待确认] "demo": "../wxcomponents/demo"
|
|
182
|
+
*/
|
|
168
183
|
function findUsingComponentsJson(pathInpages, componentsDir) {
|
|
169
184
|
// 兼容test case
|
|
170
185
|
if (!process.env.UNI_INPUT_DIR)
|
|
@@ -176,8 +191,7 @@ function findUsingComponentsJson(pathInpages, componentsDir) {
|
|
|
176
191
|
}
|
|
177
192
|
dir = '.' + dir;
|
|
178
193
|
const fulldir = path_1.default.resolve(process.env.UNI_INPUT_DIR, componentsDir, dir);
|
|
179
|
-
let
|
|
180
|
-
let jsonPath = path_1.default.resolve(fulldir, filename);
|
|
194
|
+
let jsonPath = fulldir + '.json';
|
|
181
195
|
if (fs_1.default.existsSync(jsonPath)) {
|
|
182
196
|
return require(jsonPath);
|
|
183
197
|
}
|
package/dist/json/mp/pages.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export declare function parseMiniProgramPagesJson(jsonStr: string, platform: Uni
|
|
|
13
13
|
pageJsons: Record<string, PageWindowOptions>;
|
|
14
14
|
nvuePages: string[];
|
|
15
15
|
};
|
|
16
|
-
export declare function mergeMiniProgramAppJson(appJson: Record<string, any>, platformJson?: Record<string, any>): void;
|
|
16
|
+
export declare function mergeMiniProgramAppJson(appJson: Record<string, any>, platformJson?: Record<string, any>, source?: Record<string, any>): void;
|
|
17
17
|
export {};
|