@aiot-toolkit/aiotpack 2.0.6-beta.13 → 2.0.6-beta.15
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/lib/afterCompile/ux/UxAfterCompile.js +37 -23
- package/lib/beforeCompile/ux/UxBeforeCompile.js +6 -8
- package/lib/compiler/javascript/JavascriptCompiler.js +5 -4
- package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js +2 -0
- package/lib/compiler/javascript/vela/model/Package.js +1 -0
- package/lib/compiler/javascript/vela/utils/Jsc.js +1 -2
- package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +2 -2
- package/lib/compiler/javascript/vela/utils/signature/Base64.js +1 -1
- package/lib/compiler/javascript/vela/utils/signature/CRC32.js +1 -2
- package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +9 -9
- package/lib/compiler/javascript/vela/utils/webpackLoader/WebpackJsLoader.js +1 -1
- package/lib/compiler/javascript/vela/utils/webpackLoader/WebpackUxLoader.js +1 -1
- package/lib/compiler/tools/icu/ImageIcu.js +2 -4
- package/lib/config/UxConfig.js +5 -5
- package/lib/loader/ux/JsLoader.js +1 -0
- package/lib/loader/ux/PngLoader.js +1 -0
- package/lib/loader/ux/android/UxLoader.js +1 -0
- package/lib/loader/ux/vela/HmlLoader.js +1 -0
- package/lib/loader/ux/vela/UxLoader.js +5 -2
- package/lib/utils/BeforeCompileUtils.js +5 -4
- package/lib/utils/ux/UxFileUtils.js +7 -9
- package/lib/utils/ux/UxLoaderUtils.js +6 -5
- package/lib/utils/ux/android/AndroidUx.js +1 -0
- package/package.json +6 -6
|
@@ -4,6 +4,15 @@ 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");
|
|
7
16
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
17
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
18
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
@@ -40,18 +49,17 @@ class UxAfterCompile {
|
|
|
40
49
|
..._JavascriptDefaultCompileOption.default,
|
|
41
50
|
...compilerOption
|
|
42
51
|
}).then(() => {
|
|
43
|
-
onLog
|
|
52
|
+
onLog === null || onLog === void 0 || onLog([{
|
|
44
53
|
level: _sharedUtils.Loglevel.SUCCESS,
|
|
45
54
|
message: ['javascript compile success']
|
|
46
55
|
}]);
|
|
47
|
-
}).catch(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const errorLength = errors?.length || 0;
|
|
56
|
+
}).catch(({
|
|
57
|
+
errors,
|
|
58
|
+
warnings
|
|
59
|
+
}) => {
|
|
60
|
+
const errorLength = (errors === null || errors === void 0 ? void 0 : errors.length) || 0;
|
|
53
61
|
const messages = [`webpack error:\r\n`];
|
|
54
|
-
if (errors
|
|
62
|
+
if (errors !== null && errors !== void 0 && errors.length) {
|
|
55
63
|
messages.push({
|
|
56
64
|
word: errors.map((item, index) => {
|
|
57
65
|
return `${index + 1}. ${item.message}`;
|
|
@@ -59,7 +67,7 @@ class UxAfterCompile {
|
|
|
59
67
|
style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.THROW)
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
|
-
if (warnings
|
|
70
|
+
if (warnings !== null && warnings !== void 0 && warnings.length) {
|
|
63
71
|
messages.push({
|
|
64
72
|
word: warnings.map((item, index) => {
|
|
65
73
|
return `${errorLength + index + 1}. ${item.message}`;
|
|
@@ -67,14 +75,14 @@ class UxAfterCompile {
|
|
|
67
75
|
style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.WARN)
|
|
68
76
|
});
|
|
69
77
|
}
|
|
70
|
-
if (errors
|
|
71
|
-
onLog
|
|
78
|
+
if (errors !== null && errors !== void 0 && errors.length) {
|
|
79
|
+
onLog === null || onLog === void 0 || onLog([{
|
|
72
80
|
level: _sharedUtils.Loglevel.THROW,
|
|
73
81
|
message: messages
|
|
74
82
|
}]);
|
|
75
83
|
throw new Error();
|
|
76
84
|
} else {
|
|
77
|
-
onLog
|
|
85
|
+
onLog === null || onLog === void 0 || onLog([{
|
|
78
86
|
level: _sharedUtils.Loglevel.WARN,
|
|
79
87
|
message: messages
|
|
80
88
|
}]);
|
|
@@ -85,7 +93,7 @@ class UxAfterCompile {
|
|
|
85
93
|
const {
|
|
86
94
|
compilerOption
|
|
87
95
|
} = params;
|
|
88
|
-
if (compilerOption
|
|
96
|
+
if (compilerOption !== null && compilerOption !== void 0 && compilerOption.enableProtobuf) {
|
|
89
97
|
BinaryPlugin.createBinFiles();
|
|
90
98
|
}
|
|
91
99
|
};
|
|
@@ -171,6 +179,7 @@ class UxAfterCompile {
|
|
|
171
179
|
* @param compilerOption
|
|
172
180
|
*/
|
|
173
181
|
const updateManifest = compilerOption => {
|
|
182
|
+
var _content$features;
|
|
174
183
|
const {
|
|
175
184
|
projectPath,
|
|
176
185
|
sourceRoot,
|
|
@@ -189,7 +198,7 @@ class UxAfterCompile {
|
|
|
189
198
|
|
|
190
199
|
// 如果有startPage,且feature中没有router,则添加router
|
|
191
200
|
const routerFeature = 'system.router';
|
|
192
|
-
if (startPage && !content.features
|
|
201
|
+
if (startPage && !((_content$features = content.features) !== null && _content$features !== void 0 && _content$features.find(item => item.name === routerFeature))) {
|
|
193
202
|
content.features = content.features || [];
|
|
194
203
|
content.features.push({
|
|
195
204
|
name: routerFeature
|
|
@@ -199,14 +208,17 @@ class UxAfterCompile {
|
|
|
199
208
|
// feature
|
|
200
209
|
// 无需检查的feature
|
|
201
210
|
const ignoreFeatureList = ['system.router', 'system.configuration', 'system.app'];
|
|
202
|
-
if (translateCache
|
|
211
|
+
if (translateCache !== null && translateCache !== void 0 && translateCache.featureCache.size) {
|
|
203
212
|
// 消息提示
|
|
204
213
|
// 1. 获取未手动配置的 feature
|
|
205
214
|
// 2. 如果开启自动填充,则 info;否则 warn
|
|
206
215
|
const featureSet = new Set([...Array.from(translateCache.featureCache), ...(content.features || []).map(item => item.name)]);
|
|
207
216
|
const usedList = Array.from(featureSet).filter(Boolean);
|
|
208
|
-
const unSetList = usedList.filter(featureItem =>
|
|
209
|
-
|
|
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) {
|
|
210
222
|
const featureMessage = {
|
|
211
223
|
word: `\n${JSON.stringify(unSetList.map(item => ({
|
|
212
224
|
name: item
|
|
@@ -243,6 +255,7 @@ class UxAfterCompile {
|
|
|
243
255
|
|
|
244
256
|
// e2e
|
|
245
257
|
if (compilerOption.e2eConfigPath && compilerOption.enableE2e) {
|
|
258
|
+
var _testConfig$entry;
|
|
246
259
|
const testConfig = _UxUtil.default.getE2eConfig({
|
|
247
260
|
projectPath: compilerOption.projectPath,
|
|
248
261
|
e2eConfigPath: compilerOption.e2eConfigPath
|
|
@@ -250,7 +263,7 @@ class UxAfterCompile {
|
|
|
250
263
|
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));
|
|
251
264
|
// 1. 修改entry
|
|
252
265
|
const entryName = testPagePath.dir;
|
|
253
|
-
const launchMode = testConfig.entry
|
|
266
|
+
const launchMode = (_testConfig$entry = testConfig.entry) === null || _testConfig$entry === void 0 ? void 0 : _testConfig$entry.launchMode;
|
|
254
267
|
if (entryName) {
|
|
255
268
|
content.router.entry = entryName;
|
|
256
269
|
}
|
|
@@ -355,7 +368,7 @@ class UxAfterCompile {
|
|
|
355
368
|
const diffList = _UxFileUtils.default.getDiffJSON(compilation.buildFileList, tempFileList, buildDir, tempBuildDir);
|
|
356
369
|
|
|
357
370
|
// 所有差异文件,压缩到 .diff.rpk 中
|
|
358
|
-
if (diffList
|
|
371
|
+
if (diffList !== null && diffList !== void 0 && diffList.length) {
|
|
359
372
|
const buildFold = tempBuildDir;
|
|
360
373
|
const distFold = _path.default.join(compilerOption.projectPath, compilerOption.releasePath);
|
|
361
374
|
const diffFileName = `.diff.rpk`;
|
|
@@ -433,7 +446,7 @@ class UxAfterCompile {
|
|
|
433
446
|
}
|
|
434
447
|
});
|
|
435
448
|
} catch (error) {
|
|
436
|
-
throw new Error(`${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.`);
|
|
437
450
|
}
|
|
438
451
|
};
|
|
439
452
|
/**
|
|
@@ -449,7 +462,8 @@ class UxAfterCompile {
|
|
|
449
462
|
compilation
|
|
450
463
|
} = params;
|
|
451
464
|
try {
|
|
452
|
-
|
|
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) {
|
|
453
467
|
const {
|
|
454
468
|
projectPath: tempProjectPath,
|
|
455
469
|
outputPath: LITE_OUTPUT_PATH
|
|
@@ -477,7 +491,7 @@ class UxAfterCompile {
|
|
|
477
491
|
});
|
|
478
492
|
}
|
|
479
493
|
} catch (error) {
|
|
480
|
-
throw new Error(`compile lite card error, ${error
|
|
494
|
+
throw new Error(`compile lite card error, ${(error === null || error === void 0 ? void 0 : error.toString()) || 'unknown error'}.`);
|
|
481
495
|
}
|
|
482
496
|
};
|
|
483
497
|
/**
|
|
@@ -520,7 +534,7 @@ class UxAfterCompile {
|
|
|
520
534
|
word: largeFileList.map((item, index) => `${index + 1}. ${item}`).join('\r\n ')
|
|
521
535
|
}]
|
|
522
536
|
});
|
|
523
|
-
onLog
|
|
537
|
+
onLog === null || onLog === void 0 || onLog(logs);
|
|
524
538
|
}
|
|
525
539
|
};
|
|
526
540
|
|
|
@@ -10,19 +10,17 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
10
10
|
* UxBeforeCompile
|
|
11
11
|
*/
|
|
12
12
|
class UxBeforeCompile {
|
|
13
|
-
static validateManifest = async
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
13
|
+
static validateManifest = async ({
|
|
14
|
+
context
|
|
15
|
+
}) => {
|
|
17
16
|
const {
|
|
18
17
|
projectPath
|
|
19
18
|
} = context;
|
|
20
19
|
await _UxFileUtils.default.validateManifest(projectPath);
|
|
21
20
|
};
|
|
22
|
-
static validateSitemap = async
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref2;
|
|
21
|
+
static validateSitemap = async ({
|
|
22
|
+
context
|
|
23
|
+
}) => {
|
|
26
24
|
const {
|
|
27
25
|
projectPath
|
|
28
26
|
} = context;
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
9
|
var _core = require("@rspack/core");
|
|
9
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
@@ -30,13 +31,13 @@ class JavascriptCompiler {
|
|
|
30
31
|
errors: [error]
|
|
31
32
|
});
|
|
32
33
|
} else {
|
|
33
|
-
const statsObj = stats
|
|
34
|
+
const statsObj = stats === null || stats === void 0 ? void 0 : stats.toJson({});
|
|
34
35
|
if (statsObj) {
|
|
35
36
|
const {
|
|
36
37
|
errors,
|
|
37
38
|
warnings
|
|
38
39
|
} = statsObj;
|
|
39
|
-
if (errors
|
|
40
|
+
if (errors !== null && errors !== void 0 && errors.length || warnings !== null && warnings !== void 0 && warnings.length) {
|
|
40
41
|
reject({
|
|
41
42
|
errors,
|
|
42
43
|
warnings
|
|
@@ -222,14 +223,14 @@ class JavascriptCompiler {
|
|
|
222
223
|
|
|
223
224
|
// 合并用户自定义的webpack配置
|
|
224
225
|
// 数组,则合并数组(默认合并数组中相同序号的项)
|
|
225
|
-
result = _lodash.default.mergeWith({}, result, quickAppConfig
|
|
226
|
+
result = _lodash.default.mergeWith({}, result, quickAppConfig === null || quickAppConfig === void 0 ? void 0 : quickAppConfig.webpack, (source, target) => {
|
|
226
227
|
if (Array.isArray(target) && Array.isArray(source)) {
|
|
227
228
|
return [...target, ...source];
|
|
228
229
|
}
|
|
229
230
|
});
|
|
230
231
|
|
|
231
232
|
// 触发用户配置的posthook
|
|
232
|
-
if (quickAppConfig
|
|
233
|
+
if (quickAppConfig !== null && quickAppConfig !== void 0 && quickAppConfig.postHook) {
|
|
233
234
|
quickAppConfig.postHook(result);
|
|
234
235
|
}
|
|
235
236
|
return result;
|
|
@@ -4,6 +4,8 @@ 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");
|
|
7
9
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
8
10
|
var _path = _interopRequireDefault(require("path"));
|
|
9
11
|
var _UxFileUtils = _interopRequireDefault(require("../../../utils/ux/UxFileUtils"));
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
9
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
10
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -157,8 +158,7 @@ class UxCompileUtil {
|
|
|
157
158
|
* @param withDot
|
|
158
159
|
* @returns
|
|
159
160
|
*/
|
|
160
|
-
static getExtensionList() {
|
|
161
|
-
let withDot = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
161
|
+
static getExtensionList(withDot = 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 =
|
|
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,8 +9,7 @@ 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) {
|
|
13
|
-
let crc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
12
|
+
static digest(str, crc = undefined) {
|
|
14
13
|
str = CRC32.Utf8Encode(str);
|
|
15
14
|
if (crc == undefined) crc = 0;
|
|
16
15
|
let n = 0; //a number between 0 and 255
|
|
@@ -4,6 +4,8 @@ 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");
|
|
7
9
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
10
|
var _crypto = _interopRequireDefault(require("crypto"));
|
|
9
11
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
@@ -72,13 +74,10 @@ class SignUtil {
|
|
|
72
74
|
break;
|
|
73
75
|
}
|
|
74
76
|
// 寻找有效的证书路径
|
|
75
|
-
const findPath = modeSignConfig.find(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} = _ref;
|
|
80
|
-
return _sharedUtils.FileUtil.checkFilePath([privatekey, certificate]);
|
|
81
|
-
});
|
|
77
|
+
const findPath = modeSignConfig.find(({
|
|
78
|
+
privatekey,
|
|
79
|
+
certificate
|
|
80
|
+
}) => _sharedUtils.FileUtil.checkFilePath([privatekey, certificate]));
|
|
82
81
|
if (findPath) {
|
|
83
82
|
let {
|
|
84
83
|
privatekey: privatekeyPath,
|
|
@@ -112,6 +111,7 @@ class SignUtil {
|
|
|
112
111
|
* @returns
|
|
113
112
|
*/
|
|
114
113
|
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(_ZipUtil.default.CERT_PATH)
|
|
124
|
+
const metaBuffer = (_getFileBuffer = getFileBuffer(_ZipUtil.default.CERT_PATH)) === null || _getFileBuffer === void 0 ? void 0 : _getFileBuffer.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
|
|
194
|
+
return buffer === null || buffer === void 0 ? void 0 : 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
|
|
21
|
+
onLog: log => onLog === null || onLog === void 0 ? void 0 : 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
|
|
25
|
+
onLog === null || onLog === void 0 || onLog(logs);
|
|
26
26
|
callback(null, compiledFiles[0].content, compiledFiles[1].content);
|
|
27
27
|
}
|
|
@@ -33,8 +33,7 @@ class ImageIcu {
|
|
|
33
33
|
* @param {'lvgl'|'png'} format
|
|
34
34
|
* @returns
|
|
35
35
|
*/
|
|
36
|
-
translate(resourcePath, folder) {
|
|
37
|
-
let format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'lvgl';
|
|
36
|
+
translate(resourcePath, folder, format = 'lvgl') {
|
|
38
37
|
if (!_fs.default.existsSync(resourcePath) || !ImageIcu.canTranslate(resourcePath)) {
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
@@ -94,8 +93,7 @@ class ImageIcu {
|
|
|
94
93
|
* @param {'lvgl'|'png'} format
|
|
95
94
|
* @returns
|
|
96
95
|
*/
|
|
97
|
-
static canTranslate(assetsPath) {
|
|
98
|
-
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'lvgl';
|
|
96
|
+
static canTranslate(assetsPath, format = 'lvgl') {
|
|
99
97
|
if (!assetsPath) {
|
|
100
98
|
return false;
|
|
101
99
|
}
|
package/lib/config/UxConfig.js
CHANGED
|
@@ -72,9 +72,9 @@ class UxConfig {
|
|
|
72
72
|
const result = `../.temp_${name}`;
|
|
73
73
|
return result;
|
|
74
74
|
}
|
|
75
|
-
beforeWorks =
|
|
76
|
-
beforeCompile =
|
|
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 =
|
|
112
|
+
}];
|
|
113
|
+
afterWorks = [_UxAfterWorks.default.cleanOutput];
|
|
114
114
|
watchIgnores = ['**/node_modules/**', '**/build/**', '**/dist/**'];
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _parser = require("@aiot-toolkit/parser");
|
|
8
9
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
9
10
|
var _UxLoaderUtils = _interopRequireDefault(require("../../utils/ux/UxLoaderUtils"));
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
9
|
var _path = _interopRequireDefault(require("path"));
|
|
9
10
|
var _PngUtils = _interopRequireDefault(require("../../utils/PngUtils"));
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _AndroidUx = _interopRequireDefault(require("../../../utils/ux/android/AndroidUx"));
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
/**
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
|
8
9
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
10
|
var _parser = require("@aiot-toolkit/parser");
|
|
@@ -4,14 +4,16 @@ 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");
|
|
7
8
|
var _UxLoaderUtils = _interopRequireDefault(require("../../../utils/ux/UxLoaderUtils"));
|
|
8
9
|
var _path = _interopRequireDefault(require("path"));
|
|
9
10
|
var _parser = require("@aiot-toolkit/parser");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
class UxLoader {
|
|
12
13
|
async parser(files) {
|
|
14
|
+
var _this$compilation$lit;
|
|
13
15
|
const resultFiles = [];
|
|
14
|
-
const liteCardList = this.compilation.liteCards
|
|
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}`))) || [];
|
|
15
17
|
for (const file of files) {
|
|
16
18
|
// 轻卡ux不转换
|
|
17
19
|
if (liteCardList.includes(file.path)) {
|
|
@@ -23,9 +25,10 @@ class UxLoader {
|
|
|
23
25
|
logs
|
|
24
26
|
} = await _UxLoaderUtils.default.compileUxToJavascript(file, this.context, false, this.compilerOption, this.compilation);
|
|
25
27
|
this.logs = logs.map(item => {
|
|
28
|
+
var _item$position;
|
|
26
29
|
return {
|
|
27
30
|
...item,
|
|
28
|
-
filePath: item.position
|
|
31
|
+
filePath: ((_item$position = item.position) === null || _item$position === void 0 ? void 0 : _item$position.source) || item.filePath
|
|
29
32
|
};
|
|
30
33
|
});
|
|
31
34
|
resultFiles.push(...compiledFiles);
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _parser = require("@aiot-toolkit/parser");
|
|
8
9
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
9
10
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
@@ -91,7 +92,7 @@ class BeforeCompileUtils {
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
// e2e测试入口
|
|
94
|
-
if (compilerOption
|
|
95
|
+
if (compilerOption !== null && compilerOption !== void 0 && compilerOption.enableE2e && compilerOption !== null && compilerOption !== void 0 && compilerOption.e2eConfigPath) {
|
|
95
96
|
const e2eConfig = _UxUtil.default.getE2eConfig({
|
|
96
97
|
projectPath: context.projectPath,
|
|
97
98
|
e2eConfigPath: compilerOption.e2eConfigPath
|
|
@@ -127,8 +128,8 @@ class BeforeCompileUtils {
|
|
|
127
128
|
BinaryPlugin.config = {
|
|
128
129
|
projectPath: context.projectPath,
|
|
129
130
|
outputProjectPath: _path.default.join(context.projectPath, context.output),
|
|
130
|
-
source: compilerOption
|
|
131
|
-
output: compilerOption
|
|
131
|
+
source: compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.sourceRoot,
|
|
132
|
+
output: compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.outputPath
|
|
132
133
|
};
|
|
133
134
|
};
|
|
134
135
|
/**
|
|
@@ -143,7 +144,7 @@ class BeforeCompileUtils {
|
|
|
143
144
|
const {
|
|
144
145
|
projectPath
|
|
145
146
|
} = context;
|
|
146
|
-
const filePath = _path.default.join(projectPath, compilerOption
|
|
147
|
+
const filePath = _path.default.join(projectPath, (compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.sourceRoot) || '', 'globalVar.json');
|
|
147
148
|
let globalVar = {};
|
|
148
149
|
// 判断文件是否存在
|
|
149
150
|
if (_fsExtra.default.existsSync(filePath)) {
|
|
@@ -4,6 +4,8 @@ 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");
|
|
7
9
|
var _CommonUtil = _interopRequireDefault(require("@aiot-toolkit/shared-utils/lib/utils/CommonUtil"));
|
|
8
10
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
11
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -21,8 +23,7 @@ class UxFileUtils {
|
|
|
21
23
|
* @param sourceRoot
|
|
22
24
|
* @returns
|
|
23
25
|
*/
|
|
24
|
-
static getManifestFilePath(projectPath) {
|
|
25
|
-
let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
|
|
26
|
+
static getManifestFilePath(projectPath, sourceRoot = 'src') {
|
|
26
27
|
return _path.default.resolve(projectPath, sourceRoot, UxFileUtils.CONFIG_FILE_NAME);
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
@@ -31,8 +32,7 @@ class UxFileUtils {
|
|
|
31
32
|
* @param sourceRoot
|
|
32
33
|
* @returns
|
|
33
34
|
*/
|
|
34
|
-
static getManifestInfo(projectPath) {
|
|
35
|
-
let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
|
|
35
|
+
static getManifestInfo(projectPath, sourceRoot = 'src') {
|
|
36
36
|
return _fsExtra.default.readJSONSync(UxFileUtils.getManifestFilePath(projectPath, sourceRoot));
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -49,8 +49,7 @@ class UxFileUtils {
|
|
|
49
49
|
* @param sourceRoot 源码路径--相对项目根目录
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
|
-
static validateManifest(projectPath) {
|
|
53
|
-
let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
|
|
52
|
+
static validateManifest(projectPath, sourceRoot = 'src') {
|
|
54
53
|
const path = UxFileUtils.getManifestFilePath(projectPath, sourceRoot);
|
|
55
54
|
if (!_fsExtra.default.existsSync(path)) {
|
|
56
55
|
throw new Error(`no such file: '${path}'`);
|
|
@@ -79,7 +78,7 @@ class UxFileUtils {
|
|
|
79
78
|
errors.push(new Error(`icon: "${jsonData.icon}" is missing in project`));
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
|
-
if (errors
|
|
81
|
+
if (errors !== null && errors !== void 0 && errors.length) {
|
|
83
82
|
const message = `error in ${path}: ${errors.map((item, index) => {
|
|
84
83
|
return `\r\n${index + 1}. ${item.message}`;
|
|
85
84
|
})}`;
|
|
@@ -94,8 +93,7 @@ class UxFileUtils {
|
|
|
94
93
|
* @param projectPath
|
|
95
94
|
* @param sourceRoot
|
|
96
95
|
*/
|
|
97
|
-
static validateSitemap(projectPath) {
|
|
98
|
-
let sourceRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'src';
|
|
96
|
+
static validateSitemap(projectPath, sourceRoot = 'src') {
|
|
99
97
|
const sitemapPath = _path.default.join(projectPath, sourceRoot, 'sitemap.json');
|
|
100
98
|
if (_fsExtra.default.existsSync(sitemapPath)) {
|
|
101
99
|
const rules = _fsExtra.default.readJSONSync(sitemapPath).rules;
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _generator = require("@aiot-toolkit/generator");
|
|
8
9
|
var _parser = require("@aiot-toolkit/parser");
|
|
9
10
|
var _UxToTypescript = _interopRequireDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/UxToTypescript"));
|
|
@@ -233,7 +234,8 @@ class UxLoaderUtils {
|
|
|
233
234
|
* @returns
|
|
234
235
|
*/
|
|
235
236
|
static isPageUx(compilation, filePath) {
|
|
236
|
-
|
|
237
|
+
var _compilation$entries;
|
|
238
|
+
return Boolean((_compilation$entries = compilation.entries) === null || _compilation$entries === void 0 ? void 0 : _compilation$entries.includes(filePath));
|
|
237
239
|
}
|
|
238
240
|
/**
|
|
239
241
|
* 获取app.ux的内容,且只返回script和style内容
|
|
@@ -300,8 +302,7 @@ class UxLoaderUtils {
|
|
|
300
302
|
return JSON.stringify(value, undefined, 2);
|
|
301
303
|
}
|
|
302
304
|
};
|
|
303
|
-
const entries = Object.entries(obj).map(
|
|
304
|
-
let [key, value] = _ref;
|
|
305
|
+
const entries = Object.entries(obj).map(([key, value]) => {
|
|
305
306
|
return `"${key}": ${processValue(value)}`;
|
|
306
307
|
});
|
|
307
308
|
return `{
|
|
@@ -367,7 +368,7 @@ class UxLoaderUtils {
|
|
|
367
368
|
});
|
|
368
369
|
const code = JSON.stringify(sortedNodes);
|
|
369
370
|
if (compilerOption.enableProtobuf) {
|
|
370
|
-
if (styleNodes
|
|
371
|
+
if (styleNodes !== null && styleNodes !== void 0 && styleNodes.length) {
|
|
371
372
|
const result = BinaryPlugin.addStyle(file.path, file.path, code);
|
|
372
373
|
return `['${result.name}', ${result.index}]`;
|
|
373
374
|
}
|
|
@@ -397,7 +398,7 @@ class UxLoaderUtils {
|
|
|
397
398
|
static isServiceFile(filePath, option) {
|
|
398
399
|
const services = option.compilation['services'];
|
|
399
400
|
const relativeFilePath = _path.default.relative(_path.default.join(option.context.projectPath, option.compilerOption.sourceRoot), filePath).replace(/\\/g, _path.default.posix.sep);
|
|
400
|
-
return services
|
|
401
|
+
return services === null || services === void 0 ? void 0 : services.some(service => relativeFilePath.startsWith(service.path));
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
404
|
var _default = exports.default = UxLoaderUtils;
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
var _parser = require("@aiot-toolkit/parser");
|
|
8
9
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
9
10
|
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.
|
|
3
|
+
"version": "2.0.6-beta.15",
|
|
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.
|
|
23
|
-
"@aiot-toolkit/parser": "2.0.6-beta.
|
|
24
|
-
"@aiot-toolkit/shared-utils": "2.0.6-beta.
|
|
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",
|
|
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.
|
|
29
|
+
"file-lane": "2.0.6-beta.15",
|
|
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": "
|
|
45
|
+
"gitHead": "8a927aec513af6d004f88e21d85bba0ef2dcac90"
|
|
46
46
|
}
|