@dcloudio/uni-cli-shared 3.0.0-alpha-4070120250530001 → 3.0.0-alpha-4070220250613001

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.
@@ -34,7 +34,7 @@ function defineNVuePageCode(pagesJson) {
34
34
  }
35
35
  const pagePathWithExtname = (0, utils_1.normalizePagePath)(page.path, 'app');
36
36
  if (pagePathWithExtname) {
37
- importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>{res.length})`);
37
+ importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>{res()})`);
38
38
  }
39
39
  });
40
40
  return importNVuePagesCode.join('\n');
@@ -10,6 +10,7 @@ const fast_glob_1 = require("fast-glob");
10
10
  const utils_1 = require("./utils");
11
11
  const easycom_1 = require("./easycom");
12
12
  const messages_1 = require("./messages");
13
+ const constants_1 = require("./constants");
13
14
  function genEncryptEasyComModuleIndex(platform, components) {
14
15
  const imports = [];
15
16
  const ids = [];
@@ -132,6 +133,7 @@ function parseEasyComComponents(pluginId, inputDir, detectBinary = true) {
132
133
  return components;
133
134
  }
134
135
  exports.parseEasyComComponents = parseEasyComComponents;
136
+ const uniModulesEncryptTypes = new Map();
135
137
  /**
136
138
  * 查找所有需要云编译的加密插件 uni_modules
137
139
  * 支持云编译的插件类型
@@ -144,6 +146,7 @@ exports.parseEasyComComponents = parseEasyComComponents;
144
146
  * @returns
145
147
  */
146
148
  function findCloudEncryptUniModules(platform, inputDir, cacheDir = '') {
149
+ uniModulesEncryptTypes.clear();
147
150
  const uniModules = {};
148
151
  const modulesDir = path_1.default.resolve(inputDir, 'uni_modules');
149
152
  if (fs_extra_1.default.existsSync(modulesDir)) {
@@ -153,6 +156,7 @@ function findCloudEncryptUniModules(platform, inputDir, cacheDir = '') {
153
156
  return;
154
157
  }
155
158
  const utssdkDir = path_1.default.resolve(uniModuleRootDir, 'utssdk');
159
+ let type = '';
156
160
  if (fs_extra_1.default.existsSync(utssdkDir)) {
157
161
  // app-android 和 app-ios 不能云编译 utssdk 插件,而是需要自定义基座
158
162
  // app-harmony 平台目前不支持云编译
@@ -167,6 +171,7 @@ function findCloudEncryptUniModules(platform, inputDir, cacheDir = '') {
167
171
  if (!hasIndexUTSFile) {
168
172
  return;
169
173
  }
174
+ type = 'utssdk';
170
175
  }
171
176
  else {
172
177
  // 前端加密组件components
@@ -174,9 +179,14 @@ function findCloudEncryptUniModules(platform, inputDir, cacheDir = '') {
174
179
  if (!fs_extra_1.default.existsSync(componentsDir)) {
175
180
  return;
176
181
  }
182
+ type = 'easycom';
177
183
  }
178
184
  const pkg = require(path_1.default.resolve(uniModuleRootDir, 'package.json'));
179
- uniModules[uniModuleDir] = findEncryptUniModuleCache(uniModuleDir, cacheDir, { version: pkg.version, env: initCheckEnv() });
185
+ uniModules[uniModuleDir] = findEncryptUniModuleCache(uniModuleDir, cacheDir, {
186
+ version: pkg.version,
187
+ env: initCheckEnv(),
188
+ });
189
+ uniModulesEncryptTypes.set(uniModuleDir, type);
180
190
  });
181
191
  }
182
192
  return uniModules;
@@ -305,7 +315,8 @@ function findLastIndex(array, predicate) {
305
315
  }
306
316
  let encryptUniModules = {};
307
317
  function resolveEncryptUniModule(id, platform, isX = true) {
308
- const parts = id.split('?', 2)[0].split('/');
318
+ id = id.split('?', 2)[0];
319
+ const parts = id.split('/');
309
320
  const index = findLastIndex(parts, (part) => part === 'uni_modules');
310
321
  if (index !== -1) {
311
322
  const uniModuleId = parts[index + 1];
@@ -317,6 +328,16 @@ function resolveEncryptUniModule(id, platform, isX = true) {
317
328
  .replace('{1}', uniModuleId)
318
329
  .replace('{2}', parts.slice(index + 2).join('/')));
319
330
  }
331
+ // 为了避免兼容性问题,
332
+ // 目前排除 app-android 和 app-ios 平台,其他平台需要判断是否uvue文件,比如web端。加密utssdk插件,但同时easycom使用了非加密组件
333
+ if (platform !== 'app-android' && platform !== 'app-ios') {
334
+ if (uniModulesEncryptTypes.get(uniModuleId) === 'utssdk') {
335
+ // 如果是utssdk加密插件,且是vue文件,则不走uts-proxy
336
+ if (constants_1.EXTNAME_VUE_RE.test(id)) {
337
+ return;
338
+ }
339
+ }
340
+ }
320
341
  // 原生平台走旧的uts-proxy
321
342
  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'}`));
322
343
  }
@@ -230,6 +230,7 @@ function createExternal(config) {
230
230
  'pinia',
231
231
  'vuex',
232
232
  'vue-i18n',
233
+ 'tslib',
233
234
  ].includes(source)) {
234
235
  return true;
235
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-4070120250530001",
3
+ "version": "3.0.0-alpha-4070220250613001",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -68,8 +68,8 @@
68
68
  "unimport": "4.1.1",
69
69
  "unplugin-auto-import": "19.1.0",
70
70
  "xregexp": "3.1.0",
71
- "@dcloudio/uni-i18n": "3.0.0-alpha-4070120250530001",
72
- "@dcloudio/uni-shared": "3.0.0-alpha-4070120250530001"
71
+ "@dcloudio/uni-i18n": "3.0.0-alpha-4070220250613001",
72
+ "@dcloudio/uni-shared": "3.0.0-alpha-4070220250613001"
73
73
  },
74
74
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
75
75
  "devDependencies": {
@@ -89,6 +89,6 @@
89
89
  "code-frame": "link:@types/@babel/code-frame",
90
90
  "postcss": "^8.4.21",
91
91
  "vue": "3.4.21",
92
- "@dcloudio/uni-uts-v1": "3.0.0-alpha-4070120250530001"
92
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-4070220250613001"
93
93
  }
94
94
  }