@dcloudio/uni-cli-shared 3.0.0-alpha-4070620250731001 → 3.0.0-alpha-4070720250804001
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/easycom.d.ts +1 -0
- package/dist/easycom.js +17 -13
- package/dist/env/define.js +1 -3
- package/dist/hbx/alias.js +43 -10
- package/dist/hbx/index.js +10 -0
- package/dist/hbx/log.js +23 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/json/index.d.ts +1 -1
- package/dist/json/index.js +2 -1
- package/dist/json/manifest.d.ts +1 -0
- package/dist/json/manifest.js +11 -1
- package/dist/json/mp/jsonFile.js +4 -2
- package/dist/json/mp/pages.js +1 -0
- package/dist/json/mp/types.d.ts +4 -1
- package/dist/json/uni-x/manifest.d.ts +1 -0
- package/dist/json/uni-x/manifest.js +5 -1
- package/dist/messages/zh_CN.js +1 -0
- package/dist/uni_modules.cloud.d.ts +10 -4
- package/dist/uni_modules.cloud.js +58 -19
- package/dist/uni_modules.d.ts +2 -0
- package/dist/uni_modules.js +81 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +7 -3
- package/dist/uts.js +16 -0
- package/dist/vite/autoImport.js +2 -0
- package/dist/vite/cloud.js +51 -5
- package/dist/vite/plugins/index.d.ts +1 -0
- package/dist/vite/plugins/index.js +3 -1
- package/dist/vite/plugins/inject.js +3 -1
- package/dist/vite/plugins/stats.d.ts +2 -0
- package/dist/vite/plugins/stats.js +42 -0
- package/dist/vite/plugins/uts/uni_modules.d.ts +1 -0
- package/dist/vite/plugins/uts/uni_modules.js +63 -14
- package/dist/vite/plugins/uts/uvue.js +17 -3
- package/dist/vite/plugins/vitejs/plugins/css.js +40 -5
- package/dist/vue/transforms/transformUTSComponent.js +8 -3
- package/dist/workers.d.ts +14 -0
- package/dist/workers.js +187 -0
- package/lib/vapor/@vitejs/plugin-vue/LICENSE +21 -0
- package/lib/vapor/@vitejs/plugin-vue/README.md +278 -0
- package/lib/vapor/@vitejs/plugin-vue/dist/index.cjs +3105 -0
- package/lib/vapor/@vitejs/plugin-vue/dist/index.d.cts +113 -0
- package/lib/vapor/@vitejs/plugin-vue/dist/index.d.mts +111 -0
- package/lib/vapor/@vitejs/plugin-vue/dist/index.d.ts +113 -0
- package/lib/vapor/@vitejs/plugin-vue/dist/index.mjs +3090 -0
- package/lib/vapor/@vitejs/plugin-vue/package.json +50 -0
- package/lib/vapor/@vue/compiler-core/LICENSE +21 -0
- package/lib/vapor/@vue/compiler-core/README.md +1 -0
- package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.js +6902 -0
- package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6779 -0
- package/lib/vapor/@vue/compiler-core/dist/compiler-core.esm-bundler.js +5870 -0
- package/lib/vapor/@vue/compiler-core/index.js +7 -0
- package/lib/vapor/@vue/compiler-core/package.json +58 -0
- package/lib/vapor/@vue/compiler-dom/LICENSE +21 -0
- package/lib/vapor/@vue/compiler-dom/README.md +1 -0
- package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.js +936 -0
- package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +856 -0
- package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +6682 -0
- package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +14 -0
- package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +693 -0
- package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.js +6855 -0
- package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.prod.js +14 -0
- package/lib/vapor/@vue/compiler-dom/index.js +7 -0
- package/lib/vapor/@vue/compiler-dom/package.json +57 -0
- package/lib/vapor/@vue/compiler-sfc/LICENSE +21 -0
- package/lib/vapor/@vue/compiler-sfc/README.md +80 -0
- package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +21682 -0
- package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +66272 -0
- package/lib/vapor/@vue/compiler-sfc/package.json +68 -0
- package/lib/vapor/@vue/compiler-ssr/LICENSE +21 -0
- package/lib/vapor/@vue/compiler-ssr/README.md +1 -0
- package/lib/vapor/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1402 -0
- package/lib/vapor/@vue/compiler-ssr/package.json +34 -0
- package/lib/vapor/@vue/compiler-vapor/LICENSE +21 -0
- package/lib/vapor/@vue/compiler-vapor/README.md +1 -0
- package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +4540 -0
- package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +37020 -0
- package/lib/vapor/@vue/compiler-vapor/package.json +49 -0
- package/lib/vapor/@vue/reactivity/LICENSE +21 -0
- package/lib/vapor/@vue/reactivity/README.md +19 -0
- package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.js +2033 -0
- package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.prod.js +1841 -0
- package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.js +2023 -0
- package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.prod.js +5 -0
- package/lib/vapor/@vue/reactivity/dist/reactivity.esm-bundler.js +1992 -0
- package/lib/vapor/@vue/reactivity/dist/reactivity.global.js +2082 -0
- package/lib/vapor/@vue/reactivity/dist/reactivity.global.prod.js +5 -0
- package/lib/vapor/@vue/reactivity/index.js +7 -0
- package/lib/vapor/@vue/reactivity/package.json +55 -0
- package/lib/vapor/@vue/runtime-core/LICENSE +21 -0
- package/lib/vapor/@vue/runtime-core/README.md +28 -0
- package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.js +8972 -0
- package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.prod.js +7088 -0
- package/lib/vapor/@vue/runtime-core/dist/runtime-core.esm-bundler.js +8913 -0
- package/lib/vapor/@vue/runtime-core/index.js +7 -0
- package/lib/vapor/@vue/runtime-core/package.json +54 -0
- package/lib/vapor/@vue/runtime-dom/LICENSE +21 -0
- package/lib/vapor/@vue/runtime-dom/README.md +13 -0
- package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.js +1797 -0
- package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1646 -0
- package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +12929 -0
- package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +6 -0
- package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1838 -0
- package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.js +13086 -0
- package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.prod.js +6 -0
- package/lib/vapor/@vue/runtime-dom/index.js +7 -0
- package/lib/vapor/@vue/runtime-dom/package.json +60 -0
- package/lib/vapor/@vue/runtime-vapor/LICENSE +21 -0
- package/lib/vapor/@vue/runtime-vapor/README.md +8 -0
- package/lib/vapor/@vue/runtime-vapor/dist/runtime-vapor.esm-bundler.js +3242 -0
- package/lib/vapor/@vue/runtime-vapor/package.json +47 -0
- package/lib/vapor/@vue/server-renderer/LICENSE +21 -0
- package/lib/vapor/@vue/server-renderer/README.md +178 -0
- package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.js +1144 -0
- package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.prod.js +871 -0
- package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.js +8756 -0
- package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.prod.js +5 -0
- package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-bundler.js +1366 -0
- package/lib/vapor/@vue/server-renderer/index.js +7 -0
- package/lib/vapor/@vue/server-renderer/package.json +55 -0
- package/lib/vapor/@vue/shared/LICENSE +21 -0
- package/lib/vapor/@vue/shared/README.md +3 -0
- package/lib/vapor/@vue/shared/dist/shared.cjs.js +698 -0
- package/lib/vapor/@vue/shared/dist/shared.cjs.prod.js +690 -0
- package/lib/vapor/@vue/shared/dist/shared.esm-bundler.js +616 -0
- package/lib/vapor/@vue/shared/index.js +7 -0
- package/lib/vapor/@vue/shared/package.json +47 -0
- package/lib/vapor/@vue/vue/LICENSE +21 -0
- package/lib/vapor/@vue/vue/README.md +62 -0
- package/lib/vapor/@vue/vue/compiler-sfc/index.browser.js +1 -0
- package/lib/vapor/@vue/vue/compiler-sfc/index.browser.mjs +1 -0
- package/lib/vapor/@vue/vue/compiler-sfc/index.d.mts +1 -0
- package/lib/vapor/@vue/vue/compiler-sfc/index.d.ts +1 -0
- package/lib/vapor/@vue/vue/compiler-sfc/index.js +3 -0
- package/lib/vapor/@vue/vue/compiler-sfc/index.mjs +3 -0
- package/lib/vapor/@vue/vue/compiler-sfc/package.json +4 -0
- package/lib/vapor/@vue/vue/compiler-sfc/register-ts.js +3 -0
- package/lib/vapor/@vue/vue/dist/vue.cjs.js +80 -0
- package/lib/vapor/@vue/vue/dist/vue.cjs.prod.js +66 -0
- package/lib/vapor/@vue/vue/dist/vue.esm-browser.js +18840 -0
- package/lib/vapor/@vue/vue/dist/vue.esm-browser.prod.js +12 -0
- package/lib/vapor/@vue/vue/dist/vue.esm-bundler.js +72 -0
- package/lib/vapor/@vue/vue/dist/vue.global.js +18820 -0
- package/lib/vapor/@vue/vue/dist/vue.global.prod.js +12 -0
- package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.js +15648 -0
- package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.prod.js +9 -0
- package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.js +12953 -0
- package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.prod.js +6 -0
- package/lib/vapor/@vue/vue/dist/vue.runtime.esm-bundler.js +29 -0
- package/lib/vapor/@vue/vue/dist/vue.runtime.global.js +13111 -0
- package/lib/vapor/@vue/vue/dist/vue.runtime.global.prod.js +6 -0
- package/lib/vapor/@vue/vue/index.js +7 -0
- package/lib/vapor/@vue/vue/index.mjs +1 -0
- package/lib/vapor/@vue/vue/jsx-runtime/index.d.ts +25 -0
- package/lib/vapor/@vue/vue/jsx-runtime/index.js +15 -0
- package/lib/vapor/@vue/vue/jsx-runtime/index.mjs +12 -0
- package/lib/vapor/@vue/vue/jsx-runtime/package.json +5 -0
- package/lib/vapor/@vue/vue/jsx.d.ts +22 -0
- package/lib/vapor/@vue/vue/package.json +114 -0
- package/lib/vapor/@vue/vue/server-renderer/index.d.mts +1 -0
- package/lib/vapor/@vue/vue/server-renderer/index.d.ts +1 -0
- package/lib/vapor/@vue/vue/server-renderer/index.js +1 -0
- package/lib/vapor/@vue/vue/server-renderer/index.mjs +1 -0
- package/lib/vapor/@vue/vue/server-renderer/package.json +4 -0
- package/package.json +38 -38
package/dist/easycom.d.ts
CHANGED
package/dist/easycom.js
CHANGED
|
@@ -32,6 +32,7 @@ function initEasycoms(inputDir, { dirs, platform, isX, }) {
|
|
|
32
32
|
// 初始化时,从once中读取缓存,refresh时,实时读取
|
|
33
33
|
const { easycom } = pagesJson || (0, pages_1.parsePagesJson)(inputDir, platform, false);
|
|
34
34
|
const easycomOptions = {
|
|
35
|
+
platform,
|
|
35
36
|
isX,
|
|
36
37
|
dirs: easycom && easycom.autoscan === false
|
|
37
38
|
? [...dirs] // 禁止自动扫描
|
|
@@ -127,11 +128,11 @@ function initUniModulesEasycomDirs(uniModulesDir, componentsDir = 'components')
|
|
|
127
128
|
})
|
|
128
129
|
.filter(Boolean);
|
|
129
130
|
}
|
|
130
|
-
function initEasycom({ isX, dirs, rootDir, custom, extensions, }) {
|
|
131
|
+
function initEasycom({ platform, isX, dirs, rootDir, custom, extensions, }) {
|
|
131
132
|
rootDir = (0, utils_1.normalizePath)(rootDir);
|
|
132
133
|
const easycomsObj = Object.create(null);
|
|
133
134
|
if (dirs && dirs.length && rootDir) {
|
|
134
|
-
const autoEasyComObj = initAutoScanEasycoms(dirs, rootDir, extensions);
|
|
135
|
+
const autoEasyComObj = initAutoScanEasycoms(platform, dirs, rootDir, extensions);
|
|
135
136
|
if (isX) {
|
|
136
137
|
Object.keys(autoEasyComObj).forEach((tagName) => {
|
|
137
138
|
let source = autoEasyComObj[tagName];
|
|
@@ -201,7 +202,7 @@ const isDir = (path) => {
|
|
|
201
202
|
}
|
|
202
203
|
return false;
|
|
203
204
|
};
|
|
204
|
-
function initAutoScanEasycom(dir, rootDir, extensions) {
|
|
205
|
+
function initAutoScanEasycom(platform, dir, rootDir, extensions) {
|
|
205
206
|
if (!path_1.default.isAbsolute(dir)) {
|
|
206
207
|
dir = path_1.default.resolve(rootDir, dir);
|
|
207
208
|
}
|
|
@@ -209,6 +210,7 @@ function initAutoScanEasycom(dir, rootDir, extensions) {
|
|
|
209
210
|
if (!fs_1.default.existsSync(dir)) {
|
|
210
211
|
return easycoms;
|
|
211
212
|
}
|
|
213
|
+
const isMp = platform.startsWith('mp-');
|
|
212
214
|
const is_uni_modules = path_1.default.basename(path_1.default.resolve(dir, '../..')) === 'uni_modules';
|
|
213
215
|
const is_easycom_encrypt_uni_modules = // uni_modules模式不需要此逻辑
|
|
214
216
|
process.env.UNI_COMPILE_TARGET !== 'uni_modules' &&
|
|
@@ -228,24 +230,26 @@ function initAutoScanEasycom(dir, rootDir, extensions) {
|
|
|
228
230
|
for (let i = 0; i < extensions.length; i++) {
|
|
229
231
|
const ext = extensions[i];
|
|
230
232
|
if (files.includes(name + ext)) {
|
|
231
|
-
easycoms[`^${name}$`] =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
easycoms[`^${name}$`] =
|
|
234
|
+
// mp平台,这里不处理,由uniEntryPlugin处理
|
|
235
|
+
is_easycom_encrypt_uni_modules && !isMp
|
|
236
|
+
? (0, utils_1.normalizePath)(path_1.default.join(rootDir, `uni_modules/${uni_modules_plugin_id}?${
|
|
237
|
+
// android 走 proxy
|
|
238
|
+
process.env.UNI_APP_X === 'true' &&
|
|
239
|
+
process.env.UNI_UTS_PLATFORM === 'app-android'
|
|
240
|
+
? 'uts-proxy'
|
|
241
|
+
: 'uni_helpers'}`))
|
|
242
|
+
: `${importDir}/${name}${ext}`;
|
|
239
243
|
break;
|
|
240
244
|
}
|
|
241
245
|
}
|
|
242
246
|
});
|
|
243
247
|
return easycoms;
|
|
244
248
|
}
|
|
245
|
-
function initAutoScanEasycoms(dirs, rootDir, extensions) {
|
|
249
|
+
function initAutoScanEasycoms(platform, dirs, rootDir, extensions) {
|
|
246
250
|
const conflict = {};
|
|
247
251
|
const res = dirs.reduce((easycoms, dir) => {
|
|
248
|
-
const curEasycoms = initAutoScanEasycom(dir, rootDir, extensions);
|
|
252
|
+
const curEasycoms = initAutoScanEasycom(platform, dir, rootDir, extensions);
|
|
249
253
|
Object.keys(curEasycoms).forEach((name) => {
|
|
250
254
|
// Use the first component when name conflict
|
|
251
255
|
const componentPath = easycoms[name];
|
package/dist/env/define.js
CHANGED
|
@@ -48,9 +48,7 @@ function initDefine(stringifyBoolean = false) {
|
|
|
48
48
|
// 兼容旧版本
|
|
49
49
|
'process.env.VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM || ''),
|
|
50
50
|
'process.env.VUE_APP_DARK_MODE': JSON.stringify(platformManifestJson.darkmode || false),
|
|
51
|
-
__UNI_PRELOAD_SHADOW_IMAGE__: JSON.stringify(process.env.UNI_PLATFORM === 'mp-weixin'
|
|
52
|
-
? (0, utils_1.createShadowImageUrl)(1, 'grey').slice(5)
|
|
53
|
-
: ''),
|
|
51
|
+
__UNI_PRELOAD_SHADOW_IMAGE__: JSON.stringify(process.env.UNI_PLATFORM === 'mp-weixin' ? (0, utils_1.getShadowImagePath)('grey') : ''),
|
|
54
52
|
...mpXDefine,
|
|
55
53
|
};
|
|
56
54
|
}
|
package/dist/hbx/alias.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.formatInstallHBuilderXPluginTips = exports.moduleAliasFormatter = exports.installHBuilderXPlugin = exports.initModuleAlias = void 0;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const module_alias_1 = __importDefault(require("module-alias"));
|
|
10
11
|
const utils_1 = require("./utils");
|
|
@@ -19,16 +20,48 @@ function initModuleAlias() {
|
|
|
19
20
|
const libDir = path_1.default.resolve(__dirname, '../../lib');
|
|
20
21
|
const compilerSfcPath = path_1.default.resolve(libDir, '@vue/compiler-sfc');
|
|
21
22
|
const serverRendererPath = require.resolve('@vue/server-renderer');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// TODO 临时开关启用vapor
|
|
24
|
+
if (!process.env.UNI_VUE_VAPOR &&
|
|
25
|
+
process.env.UNI_INPUT_DIR &&
|
|
26
|
+
// 该代码执行较早,不能使用UNI_UTS_PLATFORM
|
|
27
|
+
(process.env.UNI_PLATFORM === 'app-harmony' ||
|
|
28
|
+
(process.env.UNI_PLATFORM === 'app' &&
|
|
29
|
+
process.env.UNI_APP_PLATFORM === 'ios'))) {
|
|
30
|
+
const vaporConfig = path_1.default.resolve(process.env.UNI_INPUT_DIR, '.vapor');
|
|
31
|
+
if (fs_1.default.existsSync(vaporConfig)) {
|
|
32
|
+
process.env.UNI_VUE_VAPOR = 'true';
|
|
33
|
+
if (fs_1.default.readFileSync(vaporConfig, 'utf-8').trim() === '*') {
|
|
34
|
+
process.env.UNI_VUE_VAPOR_ALL = 'true';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (process.env.UNI_VUE_VAPOR === 'true') {
|
|
39
|
+
const vuePkgs = [
|
|
40
|
+
'@vue/compiler-core',
|
|
41
|
+
'@vue/compiler-dom',
|
|
42
|
+
'@vue/compiler-sfc',
|
|
43
|
+
'@vue/compiler-ssr',
|
|
44
|
+
'@vue/compiler-vapor',
|
|
45
|
+
'@vue/server-renderer',
|
|
46
|
+
'@vue/shared',
|
|
47
|
+
];
|
|
48
|
+
vuePkgs.forEach((pkg) => {
|
|
49
|
+
module_alias_1.default.addAlias(pkg, path_1.default.resolve(libDir, 'vapor', '@vue', pkg.split('/').pop()));
|
|
50
|
+
});
|
|
51
|
+
module_alias_1.default.addAlias('@vitejs/plugin-vue', path_1.default.resolve(libDir, 'vapor', '@vitejs', 'plugin-vue'));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
module_alias_1.default.addAliases({
|
|
55
|
+
'@vue/shared': require.resolve('@vue/shared'),
|
|
56
|
+
'@vue/shared/dist/shared.esm-bundler.js': require.resolve('@vue/shared/dist/shared.esm-bundler.js'),
|
|
57
|
+
'@vue/compiler-core': path_1.default.resolve(libDir, '@vue/compiler-core'),
|
|
58
|
+
'@vue/compiler-dom': require.resolve('@vue/compiler-dom'),
|
|
59
|
+
'@vue/compiler-sfc': compilerSfcPath,
|
|
60
|
+
'@vue/server-renderer': serverRendererPath,
|
|
61
|
+
'vue/compiler-sfc': compilerSfcPath,
|
|
62
|
+
'vue/server-renderer': serverRendererPath,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
32
65
|
if (process.env.VITEST) {
|
|
33
66
|
module_alias_1.default.addAliases({
|
|
34
67
|
vue: '@dcloudio/uni-h5-vue',
|
package/dist/hbx/index.js
CHANGED
|
@@ -21,6 +21,7 @@ exports.isEnableConsole = exports.uniHBuilderXConsolePlugin = exports.formatInst
|
|
|
21
21
|
const path_1 = __importDefault(require("path"));
|
|
22
22
|
const utils_1 = require("../utils");
|
|
23
23
|
const console_1 = require("../vite/plugins/console");
|
|
24
|
+
const workers_1 = require("../workers");
|
|
24
25
|
var log_1 = require("./log");
|
|
25
26
|
Object.defineProperty(exports, "formatAtFilename", { enumerable: true, get: function () { return log_1.formatAtFilename; } });
|
|
26
27
|
__exportStar(require("./env"), exports);
|
|
@@ -29,8 +30,17 @@ Object.defineProperty(exports, "initModuleAlias", { enumerable: true, get: funct
|
|
|
29
30
|
Object.defineProperty(exports, "installHBuilderXPlugin", { enumerable: true, get: function () { return alias_1.installHBuilderXPlugin; } });
|
|
30
31
|
Object.defineProperty(exports, "formatInstallHBuilderXPluginTips", { enumerable: true, get: function () { return alias_1.formatInstallHBuilderXPluginTips; } });
|
|
31
32
|
function uniHBuilderXConsolePlugin(method = '__f__') {
|
|
33
|
+
const exclude = [];
|
|
34
|
+
if (process.env.UNI_APP_X === 'true') {
|
|
35
|
+
const workersDir = (0, workers_1.resolveWorkersDir)(process.env.UNI_INPUT_DIR);
|
|
36
|
+
if (workersDir) {
|
|
37
|
+
// 排除workers目录
|
|
38
|
+
exclude.push((0, utils_1.pathToGlob)(path_1.default.join(process.env.UNI_INPUT_DIR, workersDir), '**/*'));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
32
41
|
return (0, console_1.uniConsolePlugin)({
|
|
33
42
|
method,
|
|
43
|
+
exclude,
|
|
34
44
|
filename(filename) {
|
|
35
45
|
filename = path_1.default.relative(process.env.UNI_INPUT_DIR, filename);
|
|
36
46
|
if (filename.startsWith('.') || path_1.default.isAbsolute(filename)) {
|
package/dist/hbx/log.js
CHANGED
|
@@ -125,7 +125,22 @@ exports.errorFormatter = {
|
|
|
125
125
|
return buildErrorMessage(opts.error, [], false);
|
|
126
126
|
},
|
|
127
127
|
};
|
|
128
|
+
const VITE_ROLLUP_FAILED_TO_RESOLVE_IMPORT_RE = /\[vite\]: Rollup failed to resolve import "([^"]+)" from "([^"]+)"/;
|
|
128
129
|
function buildErrorMessage(err, args = [], includeStack = true) {
|
|
130
|
+
if (err.customPrint) {
|
|
131
|
+
err.customPrint();
|
|
132
|
+
return '';
|
|
133
|
+
}
|
|
134
|
+
if (VITE_ROLLUP_FAILED_TO_RESOLVE_IMPORT_RE.test(err.message)) {
|
|
135
|
+
const [, importPath, fromPath] = err.message.match(VITE_ROLLUP_FAILED_TO_RESOLVE_IMPORT_RE) || [];
|
|
136
|
+
err.message = `Could not resolve "${importPath}" from "${fromPath}"`;
|
|
137
|
+
err.id = fromPath;
|
|
138
|
+
}
|
|
139
|
+
// 移除 from 后面的内容
|
|
140
|
+
// 主要是处理:Could not resolve "./static/logo1.png" from "../../../../../../Users/xxx/HBuilderProjects/test-x/pages/index/index.uvue?vue&type=script&lang.uts"
|
|
141
|
+
if (err.id && err.message.startsWith('Could not resolve ')) {
|
|
142
|
+
err.message = err.message.split(' from ')[0];
|
|
143
|
+
}
|
|
129
144
|
if (err.plugin) {
|
|
130
145
|
// 避免出现这样的错误:[plugin:vite:vue] [plugin vite:vue]
|
|
131
146
|
if (err.message.startsWith(`[plugin ${err.plugin}]`)) {
|
|
@@ -134,7 +149,7 @@ function buildErrorMessage(err, args = [], includeStack = true) {
|
|
|
134
149
|
// [plugin:vite:vue] pages/index/index.vue (2:12): v-on="" is not supported
|
|
135
150
|
const locStr = `(${err.loc.line}:${err.loc.column}):`;
|
|
136
151
|
if (msg.includes(locStr)) {
|
|
137
|
-
msg = msg.split(locStr)[1];
|
|
152
|
+
msg = msg.split(locStr)[1].trim();
|
|
138
153
|
}
|
|
139
154
|
}
|
|
140
155
|
args.push(`${picocolors_1.default.magenta('[plugin:' + err.plugin + ']')} ${picocolors_1.default.red(msg)}`);
|
|
@@ -148,6 +163,13 @@ function buildErrorMessage(err, args = [], includeStack = true) {
|
|
|
148
163
|
otherMsgs.push(`[plugin:${msg}`);
|
|
149
164
|
});
|
|
150
165
|
}
|
|
166
|
+
if (err.loc) {
|
|
167
|
+
// [plugin:vite:vue] pages/index/index.vue (2:12): v-on="" is not supported
|
|
168
|
+
const locStr = `(${err.loc.line}:${err.loc.column}):`;
|
|
169
|
+
if (err.message.includes(locStr)) {
|
|
170
|
+
err.message = err.message.split(locStr)[1].trim();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
151
173
|
args.push(`${picocolors_1.default.magenta('[plugin:' + err.plugin + ']')} ${picocolors_1.default.red(err.message)}`);
|
|
152
174
|
args.push(...otherMsgs);
|
|
153
175
|
if (err.loc &&
|
package/dist/index.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export * from './resolve';
|
|
|
22
22
|
export * from './scripts';
|
|
23
23
|
export * from './platform';
|
|
24
24
|
export * from './utsUtils';
|
|
25
|
+
export * from './workers';
|
|
25
26
|
export { parseUniExtApi, parseUniExtApis, parseInjects, Define, DefineOptions, Defines, getUniExtApiProviderRegisters, formatExtApiProviderName, } from './uni_modules';
|
|
26
|
-
export { parseUniModulesArtifacts, resolveEncryptUniModule, } from './uni_modules.cloud';
|
|
27
|
+
export { getUniModulesEncryptType, parseUniModulesArtifacts, resolveEncryptUniModule, } from './uni_modules.cloud';
|
|
27
28
|
import type { EncryptPackageJson } from './uni_modules.cloud';
|
|
28
29
|
export type EncryptArtifacts = EncryptPackageJson['uni_modules']['artifacts'];
|
|
29
30
|
export { M } from './messages';
|
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.resolveEncryptUniModule = exports.parseUniModulesArtifacts = exports.formatExtApiProviderName = exports.getUniExtApiProviderRegisters = exports.parseInjects = exports.parseUniExtApis = exports.parseUniExtApi = void 0;
|
|
17
|
+
exports.checkUpdate = exports.M = exports.resolveEncryptUniModule = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = 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);
|
|
@@ -39,6 +39,7 @@ __exportStar(require("./resolve"), exports);
|
|
|
39
39
|
__exportStar(require("./scripts"), exports);
|
|
40
40
|
__exportStar(require("./platform"), exports);
|
|
41
41
|
__exportStar(require("./utsUtils"), exports);
|
|
42
|
+
__exportStar(require("./workers"), exports);
|
|
42
43
|
var uni_modules_1 = require("./uni_modules");
|
|
43
44
|
Object.defineProperty(exports, "parseUniExtApi", { enumerable: true, get: function () { return uni_modules_1.parseUniExtApi; } });
|
|
44
45
|
Object.defineProperty(exports, "parseUniExtApis", { enumerable: true, get: function () { return uni_modules_1.parseUniExtApis; } });
|
|
@@ -46,6 +47,7 @@ Object.defineProperty(exports, "parseInjects", { enumerable: true, get: function
|
|
|
46
47
|
Object.defineProperty(exports, "getUniExtApiProviderRegisters", { enumerable: true, get: function () { return uni_modules_1.getUniExtApiProviderRegisters; } });
|
|
47
48
|
Object.defineProperty(exports, "formatExtApiProviderName", { enumerable: true, get: function () { return uni_modules_1.formatExtApiProviderName; } });
|
|
48
49
|
var uni_modules_cloud_1 = require("./uni_modules.cloud");
|
|
50
|
+
Object.defineProperty(exports, "getUniModulesEncryptType", { enumerable: true, get: function () { return uni_modules_cloud_1.getUniModulesEncryptType; } });
|
|
49
51
|
Object.defineProperty(exports, "parseUniModulesArtifacts", { enumerable: true, get: function () { return uni_modules_cloud_1.parseUniModulesArtifacts; } });
|
|
50
52
|
Object.defineProperty(exports, "resolveEncryptUniModule", { enumerable: true, get: function () { return uni_modules_cloud_1.resolveEncryptUniModule; } });
|
|
51
53
|
var messages_1 = require("./messages");
|
package/dist/json/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export * from './json';
|
|
|
4
4
|
export * from './pages';
|
|
5
5
|
export * from './manifest';
|
|
6
6
|
export * from './theme';
|
|
7
|
-
export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, parseUniXFlexDirection, parseUniXSplashScreen, isUniXPageFile, getUniXPagePaths, } from './uni-x';
|
|
7
|
+
export { normalizeUniAppXAppPagesJson, normalizeUniAppXAppConfig, parseUniXFlexDirection, parseUniXSplashScreen, isUniXPageFile, getUniXPagePaths, parseUniXAppAndroidPackage, } from './uni-x';
|
|
8
8
|
export { checkPagesJson } from './utils';
|
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.checkPagesJson = exports.getUniXPagePaths = exports.isUniXPageFile = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
|
|
17
|
+
exports.checkPagesJson = exports.parseUniXAppAndroidPackage = exports.getUniXPagePaths = exports.isUniXPageFile = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = exports.normalizeUniAppXAppConfig = exports.normalizeUniAppXAppPagesJson = void 0;
|
|
18
18
|
__exportStar(require("./mp"), exports);
|
|
19
19
|
__exportStar(require("./app"), exports);
|
|
20
20
|
__exportStar(require("./json"), exports);
|
|
@@ -28,5 +28,6 @@ Object.defineProperty(exports, "parseUniXFlexDirection", { enumerable: true, get
|
|
|
28
28
|
Object.defineProperty(exports, "parseUniXSplashScreen", { enumerable: true, get: function () { return uni_x_1.parseUniXSplashScreen; } });
|
|
29
29
|
Object.defineProperty(exports, "isUniXPageFile", { enumerable: true, get: function () { return uni_x_1.isUniXPageFile; } });
|
|
30
30
|
Object.defineProperty(exports, "getUniXPagePaths", { enumerable: true, get: function () { return uni_x_1.getUniXPagePaths; } });
|
|
31
|
+
Object.defineProperty(exports, "parseUniXAppAndroidPackage", { enumerable: true, get: function () { return uni_x_1.parseUniXAppAndroidPackage; } });
|
|
31
32
|
var utils_1 = require("./utils");
|
|
32
33
|
Object.defineProperty(exports, "checkPagesJson", { enumerable: true, get: function () { return utils_1.checkPagesJson; } });
|
package/dist/json/manifest.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const parseManifestJson: (inputDir: string) => any;
|
|
2
2
|
export declare const parseManifestJsonOnce: (inputDir: string) => any;
|
|
3
3
|
export declare const parseRpx2UnitOnce: (inputDir: string, platform?: UniApp.PLATFORM) => any;
|
|
4
|
+
export declare function getNativeTags(inputDir?: string, platform?: UniApp.PLATFORM): any;
|
|
4
5
|
interface CompilerCompatConfig {
|
|
5
6
|
MODE?: 2 | 3;
|
|
6
7
|
}
|
package/dist/json/manifest.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.validateThemeValue = exports.getPlatformManifestJsonOnce = exports.getPlatformManifestJson = exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.hasPushModule = exports.isEnableSecureNetwork = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
|
|
6
|
+
exports.validateThemeValue = exports.getPlatformManifestJsonOnce = exports.getPlatformManifestJson = exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.hasPushModule = exports.isEnableSecureNetwork = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.getNativeTags = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const shared_1 = require("@vue/shared");
|
|
@@ -32,6 +32,16 @@ exports.parseRpx2UnitOnce = (0, uni_shared_1.once)((inputDir, platform = 'h5') =
|
|
|
32
32
|
}
|
|
33
33
|
return (0, shared_1.extend)({}, rpx2unit);
|
|
34
34
|
});
|
|
35
|
+
// 获取配置的小程序原生组件
|
|
36
|
+
function getNativeTags(inputDir, platform) {
|
|
37
|
+
if (!inputDir || !platform) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const manifestJson = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
41
|
+
const platformOptions = getPlatformManifestJson(manifestJson, platform);
|
|
42
|
+
return platformOptions?.nativeTags || [];
|
|
43
|
+
}
|
|
44
|
+
exports.getNativeTags = getNativeTags;
|
|
35
45
|
function parseCompatConfig(_inputDir) {
|
|
36
46
|
// 不支持 mode:2
|
|
37
47
|
return { MODE: 3 }; //parseManifestJsonOnce(inputDir).compatConfig || {}
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -93,8 +93,10 @@ function findChangedJsonFiles(supportGlobalUsingComponents = true) {
|
|
|
93
93
|
findChangedFile(name, jsonsCache.get(name));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
if (process.env.UNI_COMPILE_TARGET !== 'uni_modules') {
|
|
97
|
+
findChangedFile('app', appJsonCache);
|
|
98
|
+
findChangedFiles(jsonPagesCache);
|
|
99
|
+
}
|
|
98
100
|
findChangedFiles(jsonComponentsCache);
|
|
99
101
|
return changedJsonFiles;
|
|
100
102
|
}
|
package/dist/json/mp/pages.js
CHANGED
package/dist/json/mp/types.d.ts
CHANGED
|
@@ -101,7 +101,10 @@ export interface AppJson {
|
|
|
101
101
|
debug?: boolean;
|
|
102
102
|
functionalPages?: boolean;
|
|
103
103
|
subPackages?: SubPackage[];
|
|
104
|
-
workers?: string
|
|
104
|
+
workers?: string | {
|
|
105
|
+
path: string;
|
|
106
|
+
isSubpackage: boolean;
|
|
107
|
+
};
|
|
105
108
|
requiredBackgroundModes?: string[];
|
|
106
109
|
plugins?: Plugins;
|
|
107
110
|
preloadRule?: PreloadRule;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function parseUniXFlexDirection(manifestJson: Record<string, any>): any;
|
|
2
2
|
export declare function parseUniXSplashScreen(platform: 'app-android' | 'app-ios' | 'app-harmony', manifestJson: Record<string, any>): false | object;
|
|
3
|
+
export declare function parseUniXAppAndroidPackage(appid: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = void 0;
|
|
3
|
+
exports.parseUniXAppAndroidPackage = exports.parseUniXSplashScreen = exports.parseUniXFlexDirection = void 0;
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
5
|
const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
6
6
|
function parseUniXFlexDirection(manifestJson) {
|
|
@@ -19,3 +19,7 @@ function parseUniXSplashScreen(platform, manifestJson) {
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
exports.parseUniXSplashScreen = parseUniXSplashScreen;
|
|
22
|
+
function parseUniXAppAndroidPackage(appid) {
|
|
23
|
+
return 'uni.' + appid.replace(/_/g, '');
|
|
24
|
+
}
|
|
25
|
+
exports.parseUniXAppAndroidPackage = parseUniXAppAndroidPackage;
|
package/dist/messages/zh_CN.js
CHANGED
|
@@ -44,6 +44,7 @@ exports.default = {
|
|
|
44
44
|
'prompt.run.devtools.quickapp-webview-huawei': '华为快应用开发者工具',
|
|
45
45
|
'prompt.run.devtools.quickapp-webview-union': '快应用联盟开发者工具',
|
|
46
46
|
'uvue.unsupported': 'uvue 暂不支持 {platform} 平台',
|
|
47
|
+
// 重要:HBuilderX也会用到,如果调整了文案,需要同步调整HBuilderX的文案
|
|
47
48
|
'uvue.dev.watching.end.empty': '本次代码变更,编译结果未发生变化,跳过同步手机端程序文件。',
|
|
48
49
|
'uni_modules.import': '插件[{0}]仅支持 @/uni_modules/{1} 方式引入,不支持直接导入内部文件 {2}。',
|
|
49
50
|
'pages.json.page.notfound': '页面"{pagePath}"不存在,请确保填写的页面路径不包含文件后缀,且必须与真实的文件路径大小写保持一致。',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function genEncryptEasyComModuleCode(platform: typeof process.env.UNI_UTS_PLATFORM, components: Record<string, '.vue' | '.uvue'>): string;
|
|
1
|
+
export declare function genEncryptEasyComModuleCode(pluginId: string, platform: typeof process.env.UNI_UTS_PLATFORM, components: Record<string, '.vue' | '.uvue'>): string;
|
|
2
2
|
export declare function genEncryptUTSModuleCode(module: string, inputDir: string, platform: typeof process.env.UNI_UTS_PLATFORM): string;
|
|
3
3
|
export declare function parseUniModulesWithComponents(inputDir: string, platform: typeof process.env.UNI_UTS_PLATFORM): Record<string, string>;
|
|
4
4
|
/**
|
|
@@ -19,7 +19,7 @@ export declare function parseEasyComComponents(pluginId: string, inputDir: strin
|
|
|
19
19
|
* @param cacheDir
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
|
-
export declare function findCloudEncryptUniModules(platform: typeof process.env.UNI_UTS_PLATFORM, inputDir: string, cacheDir?: string): Record<string, EncryptPackageJson | undefined>;
|
|
22
|
+
export declare function findCloudEncryptUniModules(platform: typeof process.env.UNI_UTS_PLATFORM, inputDir: string, cacheDir?: string, sdkType?: CloudCompileSdkType): Record<string, EncryptPackageJson | undefined>;
|
|
23
23
|
export declare function findUploadEncryptUniModulesFiles(uniModules: Record<string, EncryptPackageJson | undefined>, platform: typeof process.env.UNI_UTS_PLATFORM, inputDir: string): Record<string, string[]>;
|
|
24
24
|
export declare function packUploadEncryptUniModules(uniModules: Record<string, EncryptPackageJson | undefined>, platform: typeof process.env.UNI_UTS_PLATFORM, inputDir: string, cacheDir: string): {
|
|
25
25
|
zipFile: string;
|
|
@@ -47,7 +47,8 @@ export interface EncryptPackageJson {
|
|
|
47
47
|
}
|
|
48
48
|
export declare function initCheckEnv(): Record<string, string>;
|
|
49
49
|
export declare function resolveEncryptUniModule(id: string, platform: typeof process.env.UNI_UTS_PLATFORM, isX?: boolean): string | undefined;
|
|
50
|
-
|
|
50
|
+
type CloudCompileSdkType = 'utssdk' | 'easycom' | 'all';
|
|
51
|
+
export interface CloudCompileParams {
|
|
51
52
|
mode: 'development' | 'production';
|
|
52
53
|
packType: 'debug' | 'release';
|
|
53
54
|
compilerVersion: string;
|
|
@@ -55,10 +56,15 @@ export declare function checkEncryptUniModules(inputDir: string, params: {
|
|
|
55
56
|
appname: string;
|
|
56
57
|
platform: typeof process.env.UNI_UTS_PLATFORM;
|
|
57
58
|
'uni-app-x': boolean;
|
|
58
|
-
|
|
59
|
+
env: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
export declare function checkEncryptUniModules(inputDir: string, params: CloudCompileParams, sdkType?: CloudCompileSdkType): Promise<{} | undefined>;
|
|
62
|
+
export declare function getUniModulesEncryptType(pluginId: string): "" | "utssdk" | "easycom" | undefined;
|
|
59
63
|
export declare function parseUniModulesArtifacts(): {
|
|
60
64
|
name: string;
|
|
61
65
|
package: string;
|
|
62
66
|
scopedSlots: string[];
|
|
63
67
|
declaration: string;
|
|
64
68
|
}[];
|
|
69
|
+
export declare function virtualComponentPath(filepath: string): string;
|
|
70
|
+
export {};
|
|
@@ -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.parseUniModulesArtifacts = exports.checkEncryptUniModules = exports.resolveEncryptUniModule = exports.initCheckEnv = exports.packUploadEncryptUniModules = exports.findUploadEncryptUniModulesFiles = exports.findCloudEncryptUniModules = exports.parseEasyComComponents = exports.parseUniModulesWithComponents = exports.genEncryptUTSModuleCode = exports.genEncryptEasyComModuleCode = void 0;
|
|
6
|
+
exports.virtualComponentPath = exports.parseUniModulesArtifacts = exports.getUniModulesEncryptType = exports.checkEncryptUniModules = exports.resolveEncryptUniModule = exports.initCheckEnv = exports.packUploadEncryptUniModules = exports.findUploadEncryptUniModulesFiles = exports.findCloudEncryptUniModules = exports.parseEasyComComponents = exports.parseUniModulesWithComponents = exports.genEncryptUTSModuleCode = exports.genEncryptEasyComModuleCode = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const fast_glob_1 = require("fast-glob");
|
|
@@ -11,32 +11,49 @@ const utils_1 = require("./utils");
|
|
|
11
11
|
const easycom_1 = require("./easycom");
|
|
12
12
|
const messages_1 = require("./messages");
|
|
13
13
|
const constants_1 = require("./constants");
|
|
14
|
-
|
|
14
|
+
const url_1 = require("./url");
|
|
15
|
+
function genEncryptEasyComModuleIndex(pluginId, platform, components) {
|
|
16
|
+
const isMp = platform.startsWith('mp-');
|
|
15
17
|
const imports = [];
|
|
18
|
+
const code = [];
|
|
16
19
|
const ids = [];
|
|
17
20
|
Object.keys(components).forEach((component) => {
|
|
18
21
|
const id = (0, utils_1.capitalize)((0, utils_1.camelize)(component));
|
|
19
|
-
|
|
22
|
+
if (!isMp) {
|
|
23
|
+
ids.push(id);
|
|
24
|
+
}
|
|
20
25
|
let instance = '';
|
|
21
26
|
if (platform === 'app-android') {
|
|
22
27
|
instance = (0, easycom_1.genUTSComponentPublicInstanceIdent)(component);
|
|
23
28
|
// 类型
|
|
24
29
|
ids.push(instance);
|
|
25
30
|
}
|
|
26
|
-
|
|
31
|
+
if (isMp) {
|
|
32
|
+
const filename = `uni_modules/${pluginId}/components/${component}/${component}${components[component]}`;
|
|
33
|
+
// 为了触发json、wxss的生成
|
|
34
|
+
imports.push(`import ${id} from '${virtualComponentPath(filename)}'`);
|
|
35
|
+
code.push(`function defineComponent${id}(){
|
|
36
|
+
${process.env.UNI_MP_GLOBAL || 'uni'}.createComponent(${id})
|
|
37
|
+
}`);
|
|
38
|
+
ids.push(`defineComponent${id}`);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
imports.push(`import ${id}${instance ? `, { ${instance} }` : ''} from './components/${component}/${component}${components[component]}'`);
|
|
42
|
+
}
|
|
27
43
|
});
|
|
28
44
|
return `
|
|
29
45
|
${imports.join('\n')}
|
|
46
|
+
${code.join('\n')}
|
|
30
47
|
export {
|
|
31
48
|
${ids.join(',\n ')}
|
|
32
49
|
}
|
|
33
50
|
`;
|
|
34
51
|
}
|
|
35
52
|
// easyCom
|
|
36
|
-
function genEncryptEasyComModuleCode(platform, components) {
|
|
53
|
+
function genEncryptEasyComModuleCode(pluginId, platform, components) {
|
|
37
54
|
// easyCom
|
|
38
55
|
if (components && Object.keys(components).length) {
|
|
39
|
-
return genEncryptEasyComModuleIndex(platform, components);
|
|
56
|
+
return genEncryptEasyComModuleIndex(pluginId, platform, components);
|
|
40
57
|
}
|
|
41
58
|
return '';
|
|
42
59
|
}
|
|
@@ -83,7 +100,7 @@ function parseUniModulesWithComponents(inputDir, platform) {
|
|
|
83
100
|
// 解析加密的 easyCom 插件列表
|
|
84
101
|
const components = parseEasyComComponents(uniModuleDir, inputDir, false);
|
|
85
102
|
if (Object.keys(components).length) {
|
|
86
|
-
codes.push(genEncryptEasyComModuleCode(platform, components));
|
|
103
|
+
codes.push(genEncryptEasyComModuleCode(uniModuleDir, platform, components));
|
|
87
104
|
}
|
|
88
105
|
if (codes.length) {
|
|
89
106
|
uniModules[uniModuleDir] = codes.join(`\n`);
|
|
@@ -145,7 +162,7 @@ const uniModulesEncryptTypes = new Map();
|
|
|
145
162
|
* @param cacheDir
|
|
146
163
|
* @returns
|
|
147
164
|
*/
|
|
148
|
-
function findCloudEncryptUniModules(platform, inputDir, cacheDir = '') {
|
|
165
|
+
function findCloudEncryptUniModules(platform, inputDir, cacheDir = '', sdkType = 'all') {
|
|
149
166
|
uniModulesEncryptTypes.clear();
|
|
150
167
|
const uniModules = {};
|
|
151
168
|
const modulesDir = path_1.default.resolve(inputDir, 'uni_modules');
|
|
@@ -159,10 +176,7 @@ function findCloudEncryptUniModules(platform, inputDir, cacheDir = '') {
|
|
|
159
176
|
let type = '';
|
|
160
177
|
if (fs_extra_1.default.existsSync(utssdkDir)) {
|
|
161
178
|
// app-android 和 app-ios 不能云编译 utssdk 插件,而是需要自定义基座
|
|
162
|
-
|
|
163
|
-
if (platform === 'app-android' ||
|
|
164
|
-
platform === 'app-ios' ||
|
|
165
|
-
platform === 'app-harmony') {
|
|
179
|
+
if (platform === 'app-android' || platform === 'app-ios') {
|
|
166
180
|
return;
|
|
167
181
|
}
|
|
168
182
|
// 其他平台必须有平台index.uts或根目录index.uts
|
|
@@ -181,6 +195,12 @@ function findCloudEncryptUniModules(platform, inputDir, cacheDir = '') {
|
|
|
181
195
|
}
|
|
182
196
|
type = 'easycom';
|
|
183
197
|
}
|
|
198
|
+
if (sdkType === 'utssdk' && type === 'easycom') {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (sdkType === 'easycom' && type === 'utssdk') {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
184
204
|
const pkg = require(path_1.default.resolve(uniModuleRootDir, 'package.json'));
|
|
185
205
|
uniModules[uniModuleDir] = findEncryptUniModuleCache(uniModuleDir, cacheDir, {
|
|
186
206
|
version: pkg.version,
|
|
@@ -331,12 +351,21 @@ function resolveEncryptUniModule(id, platform, isX = true) {
|
|
|
331
351
|
// 为了避免兼容性问题,
|
|
332
352
|
// 目前排除 app-android 和 app-ios 平台,其他平台需要判断是否uvue文件,比如web端。加密utssdk插件,但同时easycom使用了非加密组件
|
|
333
353
|
if (platform !== 'app-android' && platform !== 'app-ios') {
|
|
334
|
-
|
|
354
|
+
const encryptType = getUniModulesEncryptType(uniModuleId);
|
|
355
|
+
if (encryptType === 'utssdk') {
|
|
335
356
|
// 如果是utssdk加密插件,且是vue文件,则不走uts-proxy
|
|
336
357
|
if (constants_1.EXTNAME_VUE_RE.test(id)) {
|
|
337
358
|
return;
|
|
338
359
|
}
|
|
339
360
|
}
|
|
361
|
+
// 小程序平台不使用uni_helpers来处理easycom组件,而是用uniEntryPlugin处理
|
|
362
|
+
if (platform.startsWith('mp-')) {
|
|
363
|
+
if (encryptType === 'easycom') {
|
|
364
|
+
if (constants_1.EXTNAME_VUE_RE.test(id)) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
340
369
|
}
|
|
341
370
|
// 原生平台走旧的uts-proxy
|
|
342
371
|
return (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, `uni_modules/${uniModuleId}?${isX && platform === 'app-android' ? 'uts-proxy' : 'uni_helpers'}`));
|
|
@@ -344,17 +373,17 @@ function resolveEncryptUniModule(id, platform, isX = true) {
|
|
|
344
373
|
}
|
|
345
374
|
}
|
|
346
375
|
exports.resolveEncryptUniModule = resolveEncryptUniModule;
|
|
347
|
-
async function checkEncryptUniModules(inputDir, params) {
|
|
348
|
-
//
|
|
349
|
-
|
|
350
|
-
if (!Object.keys(
|
|
376
|
+
async function checkEncryptUniModules(inputDir, params, sdkType = 'all') {
|
|
377
|
+
// 初始化指定 sdk 类型的加密插件
|
|
378
|
+
const curEncryptUniModules = findCloudEncryptUniModules(params.platform, inputDir, process.env.UNI_MODULES_ENCRYPT_CACHE_DIR, sdkType);
|
|
379
|
+
if (!Object.keys(curEncryptUniModules).length) {
|
|
351
380
|
return {};
|
|
352
381
|
}
|
|
353
382
|
if (!process.env.UNI_HBUILDERX_PLUGINS) {
|
|
354
383
|
return {};
|
|
355
384
|
}
|
|
356
385
|
const cacheDir = process.env.UNI_MODULES_ENCRYPT_CACHE_DIR;
|
|
357
|
-
const { zipFile, modules } = packUploadEncryptUniModules(
|
|
386
|
+
const { zipFile, modules } = packUploadEncryptUniModules(curEncryptUniModules, process.env.UNI_UTS_PLATFORM, inputDir, cacheDir);
|
|
358
387
|
if (zipFile) {
|
|
359
388
|
const downloadFile = path_1.default.resolve(cacheDir, 'uni_modules.download.zip');
|
|
360
389
|
const { C, D, R, U } = (0, utils_1.requireUniHelpers)();
|
|
@@ -411,9 +440,14 @@ async function checkEncryptUniModules(inputDir, params) {
|
|
|
411
440
|
});
|
|
412
441
|
}
|
|
413
442
|
}
|
|
414
|
-
|
|
443
|
+
// 初始化所有
|
|
444
|
+
encryptUniModules = findCloudEncryptUniModules(params.platform, inputDir, process.env.UNI_MODULES_ENCRYPT_CACHE_DIR, 'all');
|
|
415
445
|
}
|
|
416
446
|
exports.checkEncryptUniModules = checkEncryptUniModules;
|
|
447
|
+
function getUniModulesEncryptType(pluginId) {
|
|
448
|
+
return uniModulesEncryptTypes.get(pluginId);
|
|
449
|
+
}
|
|
450
|
+
exports.getUniModulesEncryptType = getUniModulesEncryptType;
|
|
417
451
|
function parseUniModulesArtifacts() {
|
|
418
452
|
const res = [];
|
|
419
453
|
Object.keys(encryptUniModules).forEach((uniModuleId) => {
|
|
@@ -430,3 +464,8 @@ function parseUniModulesArtifacts() {
|
|
|
430
464
|
return res;
|
|
431
465
|
}
|
|
432
466
|
exports.parseUniModulesArtifacts = parseUniModulesArtifacts;
|
|
467
|
+
const uniComponentPrefix = 'uniComponent://';
|
|
468
|
+
function virtualComponentPath(filepath) {
|
|
469
|
+
return uniComponentPrefix + (0, url_1.encodeBase64Url)(filepath);
|
|
470
|
+
}
|
|
471
|
+
exports.virtualComponentPath = virtualComponentPath;
|
package/dist/uni_modules.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export type Defines = {
|
|
|
17
17
|
export interface Exports {
|
|
18
18
|
[name: string]: Define | Defines | false;
|
|
19
19
|
}
|
|
20
|
+
export declare function getNonTreeShakingPlugins(): string[];
|
|
21
|
+
export declare function isNonTreeShakingPlugin(platform: typeof process.env.UNI_UTS_PLATFORM, uni_modules: Record<string, any>): boolean;
|
|
20
22
|
export declare function getUniExtApiProviders(): {
|
|
21
23
|
plugin: string;
|
|
22
24
|
service: string;
|