@dcloudio/uni-cli-shared 3.0.0-alpha-4030120241009001 → 3.0.0-alpha-4030120241024001

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.
@@ -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
+ }`;
@@ -25,6 +25,17 @@ function initLaunchwebview(manifestJson, pagesJson) {
25
25
  manifestJson.plus.useragent.value = 'uni-app';
26
26
  }
27
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
+ }
28
39
  (0, shared_1.extend)(manifestJson.plus.launchwebview, {
29
40
  id: '1',
30
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
- }, { plus: userManifestJson['app-plus'] });
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) {
@@ -37,7 +37,7 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
37
37
  darkmode: platformConfig.darkmode || false,
38
38
  themeConfig: (0, theme_1.normalizeThemeConfigOnce)(platformConfig),
39
39
  // @ts-expect-error
40
- qqMapKey: platformConfig?.distribute?.sdkConfigs?.maps?.qqmap?.key,
40
+ qqMapKey: platformConfig?.distribute?.sdkConfigs?.maps?.tencent?.key,
41
41
  };
42
42
  // TODO 待支持分包
43
43
  return JSON.stringify(config);
package/dist/utils.js CHANGED
@@ -199,10 +199,14 @@ function normalizeEmitAssetFileName(fileName) {
199
199
  return fileName;
200
200
  }
201
201
  exports.normalizeEmitAssetFileName = normalizeEmitAssetFileName;
202
- function createIdent() {
202
+ function createIdent(platform) {
203
203
  if (process.env.UNI_INPUT_DIR) {
204
204
  const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
205
- const id = (manifestJson.appid || '').replace('__UNI__', '');
205
+ let id = (manifestJson.appid || '').replace('__UNI__', '');
206
+ const platformAppId = manifestJson[platform]?.appid;
207
+ if (platformAppId) {
208
+ id += '%%' + platformAppId;
209
+ }
206
210
  if (id) {
207
211
  return Buffer.from(Buffer.from(id).toString('base64')).toString('hex');
208
212
  }
@@ -212,7 +216,7 @@ function createIdent() {
212
216
  function createShadowImageUrl(cdn, type = 'grey') {
213
217
  let identStr = '';
214
218
  if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'web') {
215
- const ident = createIdent();
219
+ const ident = createIdent(process.env.UNI_PLATFORM);
216
220
  identStr = ident ? `${ident}/` : '';
217
221
  }
218
222
  return `https://cdn${(cdn || 0) + (process.env.UNI_APP_X === 'true' ? 1000 : 0) || ''}.dcloud.net.cn/${identStr}img/shadow-${type}.png`;
@@ -85,7 +85,7 @@ const uniH5Preset = {
85
85
  ],
86
86
  };
87
87
  const cloudPreset = {
88
- '@dcloudio/uni-cloud': [['default', 'uniCloud'], 'UniCloudError'],
88
+ '@dcloudio/uni-cloud': ['uniCloud', 'UniCloudError'],
89
89
  };
90
90
  const vuePreset = {
91
91
  from: 'vue',
@@ -8,13 +8,14 @@ const uni_shared_1 = require("@dcloudio/uni-shared");
8
8
  function uniViteCopyPlugin({ targets, }) {
9
9
  let resolvedConfig;
10
10
  let initialized = false;
11
+ let isFirstBuild = true;
11
12
  return {
12
13
  name: 'uni:copy',
13
14
  apply: 'build',
14
15
  configResolved(config) {
15
16
  resolvedConfig = config;
16
17
  },
17
- writeBundle() {
18
+ async writeBundle() {
18
19
  if (initialized) {
19
20
  return;
20
21
  }
@@ -27,6 +28,9 @@ function uniViteCopyPlugin({ targets, }) {
27
28
  const onChange = is_prod
28
29
  ? undefined
29
30
  : (0, uni_shared_1.debounce)(() => {
31
+ if (isFirstBuild) {
32
+ return;
33
+ }
30
34
  (0, logs_1.resetOutput)('log');
31
35
  (0, logs_1.output)('log', messages_1.M['dev.watching.end']);
32
36
  }, 100, { setTimeout, clearTimeout });
@@ -46,6 +50,9 @@ function uniViteCopyPlugin({ targets, }) {
46
50
  })).then(() => resolve());
47
51
  });
48
52
  },
53
+ closeBundle() {
54
+ isFirstBuild = false;
55
+ },
49
56
  };
50
57
  }
51
58
  exports.uniViteCopyPlugin = uniViteCopyPlugin;
@@ -1,5 +1,6 @@
1
1
  import type { Plugin } from 'vite';
2
2
  import type { SyncUniModulesFilePreprocessor } from '@dcloudio/uni-uts-v1';
3
+ export declare function rewriteUniModulesConsoleExpr(fileName: string, content: string): string;
3
4
  export declare function createAppAndroidUniModulesSyncFilePreprocessorOnce(isX: boolean): SyncUniModulesFilePreprocessor;
4
5
  export declare function createAppIosUniModulesSyncFilePreprocessorOnce(isX: boolean): SyncUniModulesFilePreprocessor;
5
6
  export declare function createAppHarmonyUniModulesSyncFilePreprocessorOnce(isX: boolean): SyncUniModulesFilePreprocessor;
@@ -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.uniDecryptUniModulesPlugin = exports.resolveExtApiProvider = exports.buildUniExtApis = exports.uniUTSAppUniModulesPlugin = exports.getCurrentCompiledUTSPlugins = exports.createAppHarmonyUniModulesSyncFilePreprocessorOnce = exports.createAppIosUniModulesSyncFilePreprocessorOnce = exports.createAppAndroidUniModulesSyncFilePreprocessorOnce = void 0;
6
+ exports.uniDecryptUniModulesPlugin = exports.resolveExtApiProvider = exports.buildUniExtApis = exports.uniUTSAppUniModulesPlugin = exports.getCurrentCompiledUTSPlugins = exports.createAppHarmonyUniModulesSyncFilePreprocessorOnce = exports.createAppIosUniModulesSyncFilePreprocessorOnce = exports.createAppAndroidUniModulesSyncFilePreprocessorOnce = exports.rewriteUniModulesConsoleExpr = void 0;
7
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const uni_shared_1 = require("@dcloudio/uni-shared");
@@ -17,8 +17,20 @@ const json_1 = require("../../../json");
17
17
  const fs_1 = require("../../../fs");
18
18
  const context_1 = require("../../../preprocess/context");
19
19
  const hbx_1 = require("../../../hbx");
20
+ const console_1 = require("../../../logs/console");
20
21
  /* eslint-disable no-restricted-globals */
21
22
  const { preprocess } = require('../../../../lib/preprocess');
23
+ function rewriteUniModulesConsoleExpr(fileName, content) {
24
+ // 仅开发模式补充console.log的at信息
25
+ if (process.env.NODE_ENV !== 'development') {
26
+ return content;
27
+ }
28
+ if (content.includes('console.')) {
29
+ return (0, console_1.rewriteConsoleExpr)('__f__', '', (0, utils_2.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, fileName.split('?')[0])), content, false).code;
30
+ }
31
+ return content;
32
+ }
33
+ exports.rewriteUniModulesConsoleExpr = rewriteUniModulesConsoleExpr;
22
34
  function createUniModulesSyncFilePreprocessor(platform, utsPlatform, isX) {
23
35
  const { preVueContext, preUVueContext } = (0, context_1.initScopedPreContext)(platform, undefined, utsPlatform, isX);
24
36
  const preContext = isX ? preUVueContext : preVueContext;
@@ -48,10 +60,10 @@ function createUniModulesSyncFilePreprocessor(platform, utsPlatform, isX) {
48
60
  });
49
61
  }
50
62
  else if (extname === '.uts' || extname === '.ts') {
51
- return preJs(content);
63
+ return rewriteUniModulesConsoleExpr(fileName, preJs(content));
52
64
  }
53
65
  else if (extname === '.uvue' || extname === '.vue') {
54
- return preJs(preHtml(content));
66
+ return rewriteUniModulesConsoleExpr(fileName, preJs(preHtml(content)));
55
67
  }
56
68
  return content;
57
69
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-4030120241009001",
3
+ "version": "3.0.0-alpha-4030120241024001",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,8 +26,8 @@
26
26
  "@babel/core": "^7.23.3",
27
27
  "@babel/parser": "^7.23.9",
28
28
  "@babel/types": "^7.20.7",
29
- "@dcloudio/uni-i18n": "3.0.0-alpha-4030120241009001",
30
- "@dcloudio/uni-shared": "3.0.0-alpha-4030120241009001",
29
+ "@dcloudio/uni-i18n": "3.0.0-alpha-4030120241024001",
30
+ "@dcloudio/uni-shared": "3.0.0-alpha-4030120241024001",
31
31
  "@intlify/core-base": "9.1.9",
32
32
  "@intlify/shared": "9.1.9",
33
33
  "@intlify/vue-devtools": "9.1.9",
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
73
73
  "devDependencies": {
74
- "@dcloudio/uni-uts-v1": "3.0.0-alpha-4030120241009001",
74
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-4030120241024001",
75
75
  "@types/adm-zip": "^0.5.5",
76
76
  "@types/babel__code-frame": "^7.0.6",
77
77
  "@types/babel__core": "^7.1.19",