@aiot-toolkit/aiotpack 2.0.6-beta.15 → 2.0.6-beta.16

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.
@@ -4,15 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.error.cause.js");
8
- require("core-js/modules/es.array.push.js");
9
- require("core-js/modules/es.set.difference.v2.js");
10
- require("core-js/modules/es.set.intersection.v2.js");
11
- require("core-js/modules/es.set.is-disjoint-from.v2.js");
12
- require("core-js/modules/es.set.is-subset-of.v2.js");
13
- require("core-js/modules/es.set.is-superset-of.v2.js");
14
- require("core-js/modules/es.set.symmetric-difference.v2.js");
15
- require("core-js/modules/es.set.union.v2.js");
16
7
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
17
8
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
18
9
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -49,17 +40,18 @@ class UxAfterCompile {
49
40
  ..._JavascriptDefaultCompileOption.default,
50
41
  ...compilerOption
51
42
  }).then(() => {
52
- onLog === null || onLog === void 0 || onLog([{
43
+ onLog?.([{
53
44
  level: _sharedUtils.Loglevel.SUCCESS,
54
45
  message: ['javascript compile success']
55
46
  }]);
56
- }).catch(({
57
- errors,
58
- warnings
59
- }) => {
60
- const errorLength = (errors === null || errors === void 0 ? void 0 : errors.length) || 0;
47
+ }).catch(_ref => {
48
+ let {
49
+ errors,
50
+ warnings
51
+ } = _ref;
52
+ const errorLength = errors?.length || 0;
61
53
  const messages = [`webpack error:\r\n`];
62
- if (errors !== null && errors !== void 0 && errors.length) {
54
+ if (errors?.length) {
63
55
  messages.push({
64
56
  word: errors.map((item, index) => {
65
57
  return `${index + 1}. ${item.message}`;
@@ -67,7 +59,7 @@ class UxAfterCompile {
67
59
  style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.THROW)
68
60
  });
69
61
  }
70
- if (warnings !== null && warnings !== void 0 && warnings.length) {
62
+ if (warnings?.length) {
71
63
  messages.push({
72
64
  word: warnings.map((item, index) => {
73
65
  return `${errorLength + index + 1}. ${item.message}`;
@@ -75,14 +67,14 @@ class UxAfterCompile {
75
67
  style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.WARN)
76
68
  });
77
69
  }
78
- if (errors !== null && errors !== void 0 && errors.length) {
79
- onLog === null || onLog === void 0 || onLog([{
70
+ if (errors?.length) {
71
+ onLog?.([{
80
72
  level: _sharedUtils.Loglevel.THROW,
81
73
  message: messages
82
74
  }]);
83
75
  throw new Error();
84
76
  } else {
85
- onLog === null || onLog === void 0 || onLog([{
77
+ onLog?.([{
86
78
  level: _sharedUtils.Loglevel.WARN,
87
79
  message: messages
88
80
  }]);
@@ -93,7 +85,7 @@ class UxAfterCompile {
93
85
  const {
94
86
  compilerOption
95
87
  } = params;
96
- if (compilerOption !== null && compilerOption !== void 0 && compilerOption.enableProtobuf) {
88
+ if (compilerOption?.enableProtobuf) {
97
89
  BinaryPlugin.createBinFiles();
98
90
  }
99
91
  };
@@ -179,7 +171,6 @@ class UxAfterCompile {
179
171
  * @param compilerOption
180
172
  */
181
173
  const updateManifest = compilerOption => {
182
- var _content$features;
183
174
  const {
184
175
  projectPath,
185
176
  sourceRoot,
@@ -198,7 +189,7 @@ class UxAfterCompile {
198
189
 
199
190
  // 如果有startPage,且feature中没有router,则添加router
200
191
  const routerFeature = 'system.router';
201
- if (startPage && !((_content$features = content.features) !== null && _content$features !== void 0 && _content$features.find(item => item.name === routerFeature))) {
192
+ if (startPage && !content.features?.find(item => item.name === routerFeature)) {
202
193
  content.features = content.features || [];
203
194
  content.features.push({
204
195
  name: routerFeature
@@ -208,17 +199,14 @@ class UxAfterCompile {
208
199
  // feature
209
200
  // 无需检查的feature
210
201
  const ignoreFeatureList = ['system.router', 'system.configuration', 'system.app'];
211
- if (translateCache !== null && translateCache !== void 0 && translateCache.featureCache.size) {
202
+ if (translateCache?.featureCache.size) {
212
203
  // 消息提示
213
204
  // 1. 获取未手动配置的 feature
214
205
  // 2. 如果开启自动填充,则 info;否则 warn
215
206
  const featureSet = new Set([...Array.from(translateCache.featureCache), ...(content.features || []).map(item => item.name)]);
216
207
  const usedList = Array.from(featureSet).filter(Boolean);
217
- const unSetList = usedList.filter(featureItem => {
218
- var _content$features2;
219
- return !ignoreFeatureList.includes(featureItem) && !((_content$features2 = content.features) !== null && _content$features2 !== void 0 && _content$features2.find(item => item.name === featureItem));
220
- });
221
- if (unSetList !== null && unSetList !== void 0 && unSetList.length) {
208
+ const unSetList = usedList.filter(featureItem => !ignoreFeatureList.includes(featureItem) && !content.features?.find(item => item.name === featureItem));
209
+ if (unSetList?.length) {
222
210
  const featureMessage = {
223
211
  word: `\n${JSON.stringify(unSetList.map(item => ({
224
212
  name: item
@@ -255,7 +243,6 @@ class UxAfterCompile {
255
243
 
256
244
  // e2e
257
245
  if (compilerOption.e2eConfigPath && compilerOption.enableE2e) {
258
- var _testConfig$entry;
259
246
  const testConfig = _UxUtil.default.getE2eConfig({
260
247
  projectPath: compilerOption.projectPath,
261
248
  e2eConfigPath: compilerOption.e2eConfigPath
@@ -263,7 +250,7 @@ class UxAfterCompile {
263
250
  const testPagePath = _path.default.parse(_path.default.relative(_path.default.join(compilerOption.projectPath, sourceRoot), _path.default.join(testConfig.dir, testConfig.entry.path)).replaceAll(_path.default.sep, _path.default.posix.sep));
264
251
  // 1. 修改entry
265
252
  const entryName = testPagePath.dir;
266
- const launchMode = (_testConfig$entry = testConfig.entry) === null || _testConfig$entry === void 0 ? void 0 : _testConfig$entry.launchMode;
253
+ const launchMode = testConfig.entry?.launchMode;
267
254
  if (entryName) {
268
255
  content.router.entry = entryName;
269
256
  }
@@ -368,7 +355,7 @@ class UxAfterCompile {
368
355
  const diffList = _UxFileUtils.default.getDiffJSON(compilation.buildFileList, tempFileList, buildDir, tempBuildDir);
369
356
 
370
357
  // 所有差异文件,压缩到 .diff.rpk 中
371
- if (diffList !== null && diffList !== void 0 && diffList.length) {
358
+ if (diffList?.length) {
372
359
  const buildFold = tempBuildDir;
373
360
  const distFold = _path.default.join(compilerOption.projectPath, compilerOption.releasePath);
374
361
  const diffFileName = `.diff.rpk`;
@@ -446,7 +433,7 @@ class UxAfterCompile {
446
433
  }
447
434
  });
448
435
  } catch (error) {
449
- throw new Error(`${(error === null || error === void 0 ? void 0 : error.toString()) || 'unknown error'}. Please check whether the file system of the current disk supports the creation of soft links.`);
436
+ throw new Error(`${error?.toString() || 'unknown error'}. Please check whether the file system of the current disk supports the creation of soft links.`);
450
437
  }
451
438
  };
452
439
  /**
@@ -462,8 +449,7 @@ class UxAfterCompile {
462
449
  compilation
463
450
  } = params;
464
451
  try {
465
- var _compilation$liteCard;
466
- if (compilation && (compilation === null || compilation === void 0 || (_compilation$liteCard = compilation.liteCards) === null || _compilation$liteCard === void 0 ? void 0 : _compilation$liteCard.length) > 0 && compilerOption) {
452
+ if (compilation && compilation?.liteCards?.length > 0 && compilerOption) {
467
453
  const {
468
454
  projectPath: tempProjectPath,
469
455
  outputPath: LITE_OUTPUT_PATH
@@ -491,7 +477,7 @@ class UxAfterCompile {
491
477
  });
492
478
  }
493
479
  } catch (error) {
494
- throw new Error(`compile lite card error, ${(error === null || error === void 0 ? void 0 : error.toString()) || 'unknown error'}.`);
480
+ throw new Error(`compile lite card error, ${error?.toString() || 'unknown error'}.`);
495
481
  }
496
482
  };
497
483
  /**
@@ -534,7 +520,7 @@ class UxAfterCompile {
534
520
  word: largeFileList.map((item, index) => `${index + 1}. ${item}`).join('\r\n ')
535
521
  }]
536
522
  });
537
- onLog === null || onLog === void 0 || onLog(logs);
523
+ onLog?.(logs);
538
524
  }
539
525
  };
540
526
 
@@ -10,17 +10,19 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
10
10
  * UxBeforeCompile
11
11
  */
12
12
  class UxBeforeCompile {
13
- static validateManifest = async ({
14
- context
15
- }) => {
13
+ static validateManifest = async _ref => {
14
+ let {
15
+ context
16
+ } = _ref;
16
17
  const {
17
18
  projectPath
18
19
  } = context;
19
20
  await _UxFileUtils.default.validateManifest(projectPath);
20
21
  };
21
- static validateSitemap = async ({
22
- context
23
- }) => {
22
+ static validateSitemap = async _ref2 => {
23
+ let {
24
+ context
25
+ } = _ref2;
24
26
  const {
25
27
  projectPath
26
28
  } = context;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.error.cause.js");
8
7
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
9
8
  var _core = require("@rspack/core");
10
9
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -31,13 +30,13 @@ class JavascriptCompiler {
31
30
  errors: [error]
32
31
  });
33
32
  } else {
34
- const statsObj = stats === null || stats === void 0 ? void 0 : stats.toJson({});
33
+ const statsObj = stats?.toJson({});
35
34
  if (statsObj) {
36
35
  const {
37
36
  errors,
38
37
  warnings
39
38
  } = statsObj;
40
- if (errors !== null && errors !== void 0 && errors.length || warnings !== null && warnings !== void 0 && warnings.length) {
39
+ if (errors?.length || warnings?.length) {
41
40
  reject({
42
41
  errors,
43
42
  warnings
@@ -223,14 +222,14 @@ class JavascriptCompiler {
223
222
 
224
223
  // 合并用户自定义的webpack配置
225
224
  // 数组,则合并数组(默认合并数组中相同序号的项)
226
- result = _lodash.default.mergeWith({}, result, quickAppConfig === null || quickAppConfig === void 0 ? void 0 : quickAppConfig.webpack, (source, target) => {
225
+ result = _lodash.default.mergeWith({}, result, quickAppConfig?.webpack, (source, target) => {
227
226
  if (Array.isArray(target) && Array.isArray(source)) {
228
227
  return [...target, ...source];
229
228
  }
230
229
  });
231
230
 
232
231
  // 触发用户配置的posthook
233
- if (quickAppConfig !== null && quickAppConfig !== void 0 && quickAppConfig.postHook) {
232
+ if (quickAppConfig?.postHook) {
234
233
  quickAppConfig.postHook(result);
235
234
  }
236
235
  return result;
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.error.cause.js");
8
- require("core-js/modules/es.array.push.js");
9
7
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
10
8
  var _path = _interopRequireDefault(require("path"));
11
9
  var _UxFileUtils = _interopRequireDefault(require("../../../utils/ux/UxFileUtils"));
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
9
8
  /**
10
9
  * 文件资源
@@ -13,7 +13,8 @@ class Jsc {
13
13
  this.projectPath = projectPath;
14
14
  this.buildPath = buildPath;
15
15
  }
16
- jsc(deleteJs = true) {
16
+ jsc() {
17
+ let deleteJs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
17
18
  const {
18
19
  projectPath,
19
20
  buildPath
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.error.cause.js");
8
7
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
9
8
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
10
9
  var _path = _interopRequireDefault(require("path"));
@@ -158,7 +157,8 @@ class UxCompileUtil {
158
157
  * @param withDot
159
158
  * @returns
160
159
  */
161
- static getExtensionList(withDot = true) {
160
+ static getExtensionList() {
161
+ let withDot = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
162
162
  const result = ['ux', 'hml'];
163
163
  if (withDot) {
164
164
  return result.map(item => `.${item}`);
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  * Base64
9
9
  */
10
10
  class Base64 {
11
- static re = new RegExp(/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/);
11
+ static re = (() => new RegExp(/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/))();
12
12
  static decode(a) {
13
13
  let i = 0;
14
14
  if (Base64.decoder === undefined) {
@@ -9,7 +9,8 @@ exports.default = void 0;
9
9
  */
10
10
  class CRC32 {
11
11
  static table = '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D';
12
- static digest(str, crc = undefined) {
12
+ static digest(str) {
13
+ let crc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
13
14
  str = CRC32.Utf8Encode(str);
14
15
  if (crc == undefined) crc = 0;
15
16
  let n = 0; //a number between 0 and 255
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.error.cause.js");
8
- require("core-js/modules/es.array.push.js");
9
7
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
10
8
  var _crypto = _interopRequireDefault(require("crypto"));
11
9
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
@@ -74,10 +72,13 @@ class SignUtil {
74
72
  break;
75
73
  }
76
74
  // 寻找有效的证书路径
77
- const findPath = modeSignConfig.find(({
78
- privatekey,
79
- certificate
80
- }) => _sharedUtils.FileUtil.checkFilePath([privatekey, certificate]));
75
+ const findPath = modeSignConfig.find(_ref => {
76
+ let {
77
+ privatekey,
78
+ certificate
79
+ } = _ref;
80
+ return _sharedUtils.FileUtil.checkFilePath([privatekey, certificate]);
81
+ });
81
82
  if (findPath) {
82
83
  let {
83
84
  privatekey: privatekeyPath,
@@ -111,7 +112,6 @@ class SignUtil {
111
112
  * @returns
112
113
  */
113
114
  static async signPackage(target, privatekey, certificate) {
114
- var _getFileBuffer;
115
115
  const getFileBuffer = path => {
116
116
  return target.getResource(path);
117
117
  };
@@ -121,7 +121,7 @@ class SignUtil {
121
121
  const fileList = [];
122
122
 
123
123
  // 1
124
- const metaBuffer = (_getFileBuffer = getFileBuffer(_ZipUtil.default.CERT_PATH)) === null || _getFileBuffer === void 0 ? void 0 : _getFileBuffer.fileContentBuffer;
124
+ const metaBuffer = getFileBuffer(_ZipUtil.default.CERT_PATH)?.fileContentBuffer;
125
125
  if (metaBuffer) {
126
126
  const metaHash = {
127
127
  name: _ZipUtil.default.DIGEST_HASH_JSON,
@@ -191,7 +191,7 @@ class SignUtil {
191
191
  comment: zipInst.comment,
192
192
  getFileBuffer(path) {
193
193
  const buffer = fileList.find(item => item.path === path);
194
- return buffer === null || buffer === void 0 ? void 0 : buffer.content;
194
+ return buffer?.content;
195
195
  }
196
196
  };
197
197
  }
@@ -18,7 +18,7 @@ async function _default(source) {
18
18
  filePath: this.resourcePath,
19
19
  content: source,
20
20
  projectPath: this.rootContext,
21
- onLog: log => onLog === null || onLog === void 0 ? void 0 : onLog([log]),
21
+ onLog: log => onLog?.([log]),
22
22
  projectType: _sharedUtils.ProjectType.VELA_UX
23
23
  }, compileParam, context, true).translate({
24
24
  content: source
@@ -22,6 +22,6 @@ async function _default(source) {
22
22
  path: this.resourcePath,
23
23
  content: source
24
24
  }, context, false, compileParam, compilation);
25
- onLog === null || onLog === void 0 || onLog(logs);
25
+ onLog?.(logs);
26
26
  callback(null, compiledFiles[0].content, compiledFiles[1].content);
27
27
  }
@@ -33,7 +33,8 @@ class ImageIcu {
33
33
  * @param {'lvgl'|'png'} format
34
34
  * @returns
35
35
  */
36
- translate(resourcePath, folder, format = 'lvgl') {
36
+ translate(resourcePath, folder) {
37
+ let format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'lvgl';
37
38
  if (!_fs.default.existsSync(resourcePath) || !ImageIcu.canTranslate(resourcePath)) {
38
39
  return;
39
40
  }
@@ -93,7 +94,8 @@ class ImageIcu {
93
94
  * @param {'lvgl'|'png'} format
94
95
  * @returns
95
96
  */
96
- static canTranslate(assetsPath, format = 'lvgl') {
97
+ static canTranslate(assetsPath) {
98
+ let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'lvgl';
97
99
  if (!assetsPath) {
98
100
  return false;
99
101
  }
@@ -72,9 +72,9 @@ class UxConfig {
72
72
  const result = `../.temp_${name}`;
73
73
  return result;
74
74
  }
75
- beforeWorks = [_UxBeforeWorks.default.cleanOutput];
76
- beforeCompile = [_UxBeforeCompile.default.validateManifest, _UxBeforeCompile.default.validateSitemap, _BeforeCompileUtils.default.clean, _BeforeCompileUtils.default.getEntries, _BeforeCompileUtils.default.getGlobalVar];
77
- afterCompile = [{
75
+ beforeWorks = (() => [_UxBeforeWorks.default.cleanOutput])();
76
+ beforeCompile = (() => [_UxBeforeCompile.default.validateManifest, _UxBeforeCompile.default.validateSitemap, _BeforeCompileUtils.default.clean, _BeforeCompileUtils.default.getEntries, _BeforeCompileUtils.default.getGlobalVar])();
77
+ afterCompile = (() => [{
78
78
  worker: _UxAfterCompile.default.writeGitIgnore
79
79
  }, {
80
80
  worker: _UxAfterCompile.default.symlinkNodeModule,
@@ -109,8 +109,8 @@ class UxConfig {
109
109
  }, {
110
110
  worker: _UxAfterCompile.default.resourceCheck,
111
111
  workerDescribe: 'Check resource'
112
- }];
113
- afterWorks = [_UxAfterWorks.default.cleanOutput];
112
+ }])();
113
+ afterWorks = (() => [_UxAfterWorks.default.cleanOutput])();
114
114
  watchIgnores = ['**/node_modules/**', '**/build/**', '**/dist/**'];
115
115
 
116
116
  /**
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _parser = require("@aiot-toolkit/parser");
9
8
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
10
9
  var _UxLoaderUtils = _interopRequireDefault(require("../../utils/ux/UxLoaderUtils"));
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
9
8
  var _path = _interopRequireDefault(require("path"));
10
9
  var _PngUtils = _interopRequireDefault(require("../../utils/PngUtils"));
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _AndroidUx = _interopRequireDefault(require("../../../utils/ux/android/AndroidUx"));
9
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
9
  /**
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.error.cause.js");
8
7
  var _path = _interopRequireDefault(require("path"));
9
8
  var _fs = _interopRequireDefault(require("fs"));
10
9
  var _parser = require("@aiot-toolkit/parser");
@@ -4,16 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _UxLoaderUtils = _interopRequireDefault(require("../../../utils/ux/UxLoaderUtils"));
9
8
  var _path = _interopRequireDefault(require("path"));
10
9
  var _parser = require("@aiot-toolkit/parser");
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  class UxLoader {
13
12
  async parser(files) {
14
- var _this$compilation$lit;
15
13
  const resultFiles = [];
16
- const liteCardList = ((_this$compilation$lit = this.compilation.liteCards) === null || _this$compilation$lit === void 0 ? void 0 : _this$compilation$lit.map(item => _path.default.join(this.context.projectPath, this.compilerOption.sourceRoot, `${item}${_parser.ExtensionConfig.UX}`))) || [];
14
+ const liteCardList = this.compilation.liteCards?.map(item => _path.default.join(this.context.projectPath, this.compilerOption.sourceRoot, `${item}${_parser.ExtensionConfig.UX}`)) || [];
17
15
  for (const file of files) {
18
16
  // 轻卡ux不转换
19
17
  if (liteCardList.includes(file.path)) {
@@ -25,10 +23,9 @@ class UxLoader {
25
23
  logs
26
24
  } = await _UxLoaderUtils.default.compileUxToJavascript(file, this.context, false, this.compilerOption, this.compilation);
27
25
  this.logs = logs.map(item => {
28
- var _item$position;
29
26
  return {
30
27
  ...item,
31
- filePath: ((_item$position = item.position) === null || _item$position === void 0 ? void 0 : _item$position.source) || item.filePath
28
+ filePath: item.position?.source || item.filePath
32
29
  };
33
30
  });
34
31
  resultFiles.push(...compiledFiles);
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _parser = require("@aiot-toolkit/parser");
9
8
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
10
9
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
@@ -92,7 +91,7 @@ class BeforeCompileUtils {
92
91
  }
93
92
 
94
93
  // e2e测试入口
95
- if (compilerOption !== null && compilerOption !== void 0 && compilerOption.enableE2e && compilerOption !== null && compilerOption !== void 0 && compilerOption.e2eConfigPath) {
94
+ if (compilerOption?.enableE2e && compilerOption?.e2eConfigPath) {
96
95
  const e2eConfig = _UxUtil.default.getE2eConfig({
97
96
  projectPath: context.projectPath,
98
97
  e2eConfigPath: compilerOption.e2eConfigPath
@@ -128,8 +127,8 @@ class BeforeCompileUtils {
128
127
  BinaryPlugin.config = {
129
128
  projectPath: context.projectPath,
130
129
  outputProjectPath: _path.default.join(context.projectPath, context.output),
131
- source: compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.sourceRoot,
132
- output: compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.outputPath
130
+ source: compilerOption?.sourceRoot,
131
+ output: compilerOption?.outputPath
133
132
  };
134
133
  };
135
134
  /**
@@ -144,7 +143,7 @@ class BeforeCompileUtils {
144
143
  const {
145
144
  projectPath
146
145
  } = context;
147
- const filePath = _path.default.join(projectPath, (compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.sourceRoot) || '', 'globalVar.json');
146
+ const filePath = _path.default.join(projectPath, compilerOption?.sourceRoot || '', 'globalVar.json');
148
147
  let globalVar = {};
149
148
  // 判断文件是否存在
150
149
  if (_fsExtra.default.existsSync(filePath)) {
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.UxFileUtils = void 0;
7
- require("core-js/modules/es.error.cause.js");
8
- require("core-js/modules/es.array.push.js");
9
7
  var _CommonUtil = _interopRequireDefault(require("@aiot-toolkit/shared-utils/lib/utils/CommonUtil"));
10
8
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
11
9
  var _path = _interopRequireDefault(require("path"));
@@ -23,7 +21,8 @@ class UxFileUtils {
23
21
  * @param sourceRoot
24
22
  * @returns
25
23
  */
26
- static getManifestFilePath(projectPath, sourceRoot = 'src') {
24
+ static getManifestFilePath(projectPath) {
25
+ let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
27
26
  return _path.default.resolve(projectPath, sourceRoot, UxFileUtils.CONFIG_FILE_NAME);
28
27
  }
29
28
  /**
@@ -32,7 +31,8 @@ class UxFileUtils {
32
31
  * @param sourceRoot
33
32
  * @returns
34
33
  */
35
- static getManifestInfo(projectPath, sourceRoot = 'src') {
34
+ static getManifestInfo(projectPath) {
35
+ let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
36
36
  return _fsExtra.default.readJSONSync(UxFileUtils.getManifestFilePath(projectPath, sourceRoot));
37
37
  }
38
38
 
@@ -49,7 +49,8 @@ class UxFileUtils {
49
49
  * @param sourceRoot 源码路径--相对项目根目录
50
50
  * @returns
51
51
  */
52
- static validateManifest(projectPath, sourceRoot = 'src') {
52
+ static validateManifest(projectPath) {
53
+ let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
53
54
  const path = UxFileUtils.getManifestFilePath(projectPath, sourceRoot);
54
55
  if (!_fsExtra.default.existsSync(path)) {
55
56
  throw new Error(`no such file: '${path}'`);
@@ -78,7 +79,7 @@ class UxFileUtils {
78
79
  errors.push(new Error(`icon: "${jsonData.icon}" is missing in project`));
79
80
  }
80
81
  }
81
- if (errors !== null && errors !== void 0 && errors.length) {
82
+ if (errors?.length) {
82
83
  const message = `error in ${path}: ${errors.map((item, index) => {
83
84
  return `\r\n${index + 1}. ${item.message}`;
84
85
  })}`;
@@ -93,7 +94,8 @@ class UxFileUtils {
93
94
  * @param projectPath
94
95
  * @param sourceRoot
95
96
  */
96
- static validateSitemap(projectPath, sourceRoot = 'src') {
97
+ static validateSitemap(projectPath) {
98
+ let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
97
99
  const sitemapPath = _path.default.join(projectPath, sourceRoot, 'sitemap.json');
98
100
  if (_fsExtra.default.existsSync(sitemapPath)) {
99
101
  const rules = _fsExtra.default.readJSONSync(sitemapPath).rules;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _generator = require("@aiot-toolkit/generator");
9
8
  var _parser = require("@aiot-toolkit/parser");
10
9
  var _UxToTypescript = _interopRequireDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/UxToTypescript"));
@@ -234,8 +233,7 @@ class UxLoaderUtils {
234
233
  * @returns
235
234
  */
236
235
  static isPageUx(compilation, filePath) {
237
- var _compilation$entries;
238
- return Boolean((_compilation$entries = compilation.entries) === null || _compilation$entries === void 0 ? void 0 : _compilation$entries.includes(filePath));
236
+ return Boolean(compilation.entries?.includes(filePath));
239
237
  }
240
238
  /**
241
239
  * 获取app.ux的内容,且只返回script和style内容
@@ -302,7 +300,8 @@ class UxLoaderUtils {
302
300
  return JSON.stringify(value, undefined, 2);
303
301
  }
304
302
  };
305
- const entries = Object.entries(obj).map(([key, value]) => {
303
+ const entries = Object.entries(obj).map(_ref => {
304
+ let [key, value] = _ref;
306
305
  return `"${key}": ${processValue(value)}`;
307
306
  });
308
307
  return `{
@@ -368,7 +367,7 @@ class UxLoaderUtils {
368
367
  });
369
368
  const code = JSON.stringify(sortedNodes);
370
369
  if (compilerOption.enableProtobuf) {
371
- if (styleNodes !== null && styleNodes !== void 0 && styleNodes.length) {
370
+ if (styleNodes?.length) {
372
371
  const result = BinaryPlugin.addStyle(file.path, file.path, code);
373
372
  return `['${result.name}', ${result.index}]`;
374
373
  }
@@ -398,7 +397,7 @@ class UxLoaderUtils {
398
397
  static isServiceFile(filePath, option) {
399
398
  const services = option.compilation['services'];
400
399
  const relativeFilePath = _path.default.relative(_path.default.join(option.context.projectPath, option.compilerOption.sourceRoot), filePath).replace(/\\/g, _path.default.posix.sep);
401
- return services === null || services === void 0 ? void 0 : services.some(service => relativeFilePath.startsWith(service.path));
400
+ return services?.some(service => relativeFilePath.startsWith(service.path));
402
401
  }
403
402
  }
404
403
  var _default = exports.default = UxLoaderUtils;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- require("core-js/modules/es.array.push.js");
8
7
  var _parser = require("@aiot-toolkit/parser");
9
8
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
10
9
  var _UxToTypescript = _interopRequireDefault(require("@aiot-toolkit/parser/lib/ux/translate/android/UxToTypescript"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.6-beta.15",
3
+ "version": "2.0.6-beta.16",
4
4
  "description": "The process tool for packaging aiot projects.",
5
5
  "keywords": [
6
6
  "aiotpack"
@@ -19,14 +19,14 @@
19
19
  "test": "node ./__tests__/aiotpack.test.js"
20
20
  },
21
21
  "dependencies": {
22
- "@aiot-toolkit/generator": "2.0.6-beta.15",
23
- "@aiot-toolkit/parser": "2.0.6-beta.15",
24
- "@aiot-toolkit/shared-utils": "2.0.6-beta.15",
22
+ "@aiot-toolkit/generator": "2.0.6-beta.16",
23
+ "@aiot-toolkit/parser": "2.0.6-beta.16",
24
+ "@aiot-toolkit/shared-utils": "2.0.6-beta.16",
25
25
  "@hap-toolkit/aaptjs": "^2.0.0",
26
26
  "@rspack/core": "^1.3.9",
27
27
  "aiot-parse5": "^1.0.2",
28
28
  "babel-loader": "^9.1.3",
29
- "file-lane": "2.0.6-beta.15",
29
+ "file-lane": "2.0.6-beta.16",
30
30
  "file-loader": "^6.2.0",
31
31
  "fs-extra": "^11.2.0",
32
32
  "jsrsasign": "^11.1.0",
@@ -42,5 +42,5 @@
42
42
  "@types/jsrsasign": "^10.5.12",
43
43
  "@types/webpack-sources": "^3.2.3"
44
44
  },
45
- "gitHead": "8a927aec513af6d004f88e21d85bba0ef2dcac90"
45
+ "gitHead": "6886b19268203a68f1bc232ef79248dffe3d9487"
46
46
  }