@aiot-toolkit/aiotpack 2.0.5-widget-provider-beta.2 → 2.0.6-beta.1
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/README.md +46 -46
- package/lib/afterCompile/ux/UxAfterCompile.d.ts +0 -3
- package/lib/afterCompile/ux/UxAfterCompile.js +75 -81
- package/lib/beforeCompile/ux/UxBeforeCompile.js +2 -2
- package/lib/compiler/enum/CompileMode.js +2 -2
- package/lib/compiler/javascript/JavascriptCompiler.js +7 -7
- package/lib/compiler/javascript/android/AndroidWebpackConfigurator.js +2 -2
- package/lib/compiler/javascript/android/plugin/WrapPlugin.js +7 -7
- package/lib/compiler/javascript/interface/IJavascriptCompileOption.d.ts +4 -0
- package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js +3 -3
- package/lib/compiler/javascript/vela/enum/BuildNameFormatType.js +2 -2
- package/lib/compiler/javascript/vela/enum/EntryType.js +2 -2
- package/lib/compiler/javascript/vela/interface/IManifest.d.ts +0 -5
- package/lib/compiler/javascript/vela/interface/IManifest.js +2 -2
- package/lib/compiler/javascript/vela/model/Package.js +28 -28
- package/lib/compiler/javascript/vela/utils/Jsc.d.ts +1 -1
- package/lib/compiler/javascript/vela/utils/Jsc.js +7 -3
- package/lib/compiler/javascript/vela/utils/LiteCard.d.ts +13 -0
- package/lib/compiler/javascript/vela/utils/LiteCard.js +41 -0
- package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +17 -26
- package/lib/compiler/javascript/vela/utils/ZipUtil.js +62 -62
- package/lib/compiler/javascript/vela/utils/signature/Base64.js +2 -2
- package/lib/compiler/javascript/vela/utils/signature/CRC32.js +2 -2
- package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +68 -68
- package/lib/compiler/javascript/vela/utils/signature/Signer.js +6 -6
- package/lib/compiler/javascript/vela/utils/signature/pem/certificate.pem +26 -26
- package/lib/compiler/javascript/vela/utils/signature/pem/private.pem +50 -50
- package/lib/compiler/tools/icu/ImageIcu.js +25 -25
- package/lib/compiler/tools/icu/icu_darwin_arm64 +0 -0
- package/lib/compiler/tools/icu/icu_darwin_x64 +0 -0
- package/lib/compiler/tools/icu/icu_linux_arm64 +0 -0
- package/lib/compiler/tools/icu/icu_linux_x64 +0 -0
- package/lib/compiler/tools/icu/icu_win32_x64.exe +0 -0
- package/lib/config/UxConfig.d.ts +3 -5
- package/lib/config/UxConfig.js +16 -17
- package/lib/loader/ux/JsLoader.d.ts +0 -5
- package/lib/loader/ux/JsLoader.js +7 -33
- package/lib/loader/ux/PngLoader.js +2 -2
- package/lib/loader/ux/android/UxLoader.js +2 -2
- package/lib/loader/ux/vela/AppUxLoader.js +3 -3
- package/lib/loader/ux/vela/HmlLoader.js +14 -14
- package/lib/utils/BeforeCompileUtils.js +14 -40
- package/lib/utils/PngUtils.js +11 -11
- package/lib/utils/ux/FileCompare.d.ts +12 -0
- package/lib/utils/ux/FileCompare.js +47 -0
- package/lib/utils/ux/UxFileUtils.d.ts +10 -8
- package/lib/utils/ux/UxFileUtils.js +63 -53
- package/lib/utils/ux/UxLoaderUtils.js +35 -35
- package/lib/utils/ux/android/AndroidUx.js +10 -10
- package/package.json +6 -7
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
|
2
|
-
MIIJKQIBAAKCAgEA0XxCtXvDsTwJrQXP25M/lctU9BHEYB4wPlM2DY9ZMwRW+wlv
|
|
3
|
-
VewyHrFyeZgMEdRzpg99iI6LtqEg2hyrp5zOe+j4EgnqEVCZMnFEl0tJitvqKbql
|
|
4
|
-
08sGsk1ZnDaKlLhPk/141CWfjF7JdM8Quab9B8jBtrCJ6SLmoY9kK0Ypu7vCBCbo
|
|
5
|
-
EkCwncOdxFawEOdbPQLEsi/yL3arWCuZDQM/nCFXZ+FcfPGDrXqm3jEiINSAqg3N
|
|
6
|
-
yIA9LAo0HrKiKbCQVSyWX1kLETBbdLVMmUAqo2DknctLW6yDi9kI7cElz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90DW6MopIw7gHSDtg
|
|
43
|
+
hdYme1piGDGqDuHVKP2GsV2JdY4697QqUOBxo6F2C7ocgD5HAB77AKYnh1dp4Dng
|
|
44
|
+
Vngj3VpzlDZqnUW8/hLBG3T4P6rwzRabtUQqUU8TX+vimRgO9O1OP/THYfBydE8G
|
|
45
|
+
2u0EfOZtT5FZ2yjDdEIxBGvyRLtdbtpHVwKCAQAMY2gSyiTWlAQnB3s0IRZlEjzJ
|
|
46
|
+
QnQ1TuLsxmuTUR6ziNvknFYRgBRVGZy4MyQvIaWZRUqv/g31xp+CtWY4TW5/wbvx
|
|
47
|
+
Xn6zR83WAN7ZTygBnRo2xDUu/xuTZJyfVTq7SoqzYkk3HMOEUKOWZ07fmRRP0mie
|
|
48
|
+
PzU/gbG+Da46qkXLA30asIrfwrYtSP+LR5R7nsDYaSuVeoiKkXtj8pFwaUVGBi5s
|
|
49
|
+
9CwpeWnMQbB2RanopRdOKLoL7l7t2j8dPqppv7Ws41SjWAVWcVKo5uMg/RXJoCbm
|
|
50
|
+
BvtqeP42uGeGyBAeEAywp3T9Agu/ZuffPJjJu3IRPYnfvmAfYBa4VTWO3ZwP
|
|
51
51
|
-----END RSA PRIVATE KEY-----
|
|
@@ -12,9 +12,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
12
12
|
class ImageIcu {
|
|
13
13
|
static EXT = '.bin';
|
|
14
14
|
static INCLUDE_LIST = ['.png', '.jpg', '.jpeg', '.webp', '.bmp'];
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
* @returns
|
|
15
|
+
/**
|
|
16
|
+
* @private
|
|
17
|
+
* @returns
|
|
18
18
|
*/
|
|
19
19
|
getBinPath() {
|
|
20
20
|
const platform = _os.default.platform();
|
|
@@ -26,12 +26,12 @@ class ImageIcu {
|
|
|
26
26
|
return result;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* 文件转换为 bin 格式
|
|
31
|
-
* @param {*} resourcePath 源文件
|
|
32
|
-
* @param {*} folder 产物目录
|
|
33
|
-
* @param {'lvgl'|'png'} format
|
|
34
|
-
* @returns
|
|
29
|
+
/**
|
|
30
|
+
* 文件转换为 bin 格式
|
|
31
|
+
* @param {*} resourcePath 源文件
|
|
32
|
+
* @param {*} folder 产物目录
|
|
33
|
+
* @param {'lvgl'|'png'} format
|
|
34
|
+
* @returns
|
|
35
35
|
*/
|
|
36
36
|
translate(resourcePath, folder) {
|
|
37
37
|
let format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'lvgl';
|
|
@@ -53,7 +53,7 @@ class ImageIcu {
|
|
|
53
53
|
recursive: true
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
const command =
|
|
56
|
+
const command = `"${binPath}" convert "${resourcePath}" -O "${folder}" -F ${format} -C i8 -r`;
|
|
57
57
|
const message = (0, _child_process.execSync)(command).toString('utf-8');
|
|
58
58
|
if (message) {
|
|
59
59
|
console.log(`convert error: path=${resourcePath} message=${message}`);
|
|
@@ -66,16 +66,16 @@ class ImageIcu {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* 资源转换为 bin 文件路径
|
|
71
|
-
*
|
|
72
|
-
* 如果是 png, jpg,jpeg, webp, bmp,则转换为 .bin 后缀;其它类型不处理
|
|
73
|
-
*
|
|
74
|
-
* **此方法仅返回转换后的路径, 不会实际转换文件**
|
|
75
|
-
* @param {string} path
|
|
76
|
-
* @example assetsToBinPath('images/test.png') // images/test.bin
|
|
77
|
-
*
|
|
78
|
-
* @return {string} 可转则返回对应的 bin 路径;否则返回''
|
|
69
|
+
/**
|
|
70
|
+
* 资源转换为 bin 文件路径
|
|
71
|
+
*
|
|
72
|
+
* 如果是 png, jpg,jpeg, webp, bmp,则转换为 .bin 后缀;其它类型不处理
|
|
73
|
+
*
|
|
74
|
+
* **此方法仅返回转换后的路径, 不会实际转换文件**
|
|
75
|
+
* @param {string} path
|
|
76
|
+
* @example assetsToBinPath('images/test.png') // images/test.bin
|
|
77
|
+
*
|
|
78
|
+
* @return {string} 可转则返回对应的 bin 路径;否则返回''
|
|
79
79
|
*/
|
|
80
80
|
static assetsToBinPath(assetsPath) {
|
|
81
81
|
if (!assetsPath) {
|
|
@@ -88,11 +88,11 @@ class ImageIcu {
|
|
|
88
88
|
return '';
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/**
|
|
92
|
-
* 是否可转换
|
|
93
|
-
* @param {string} assetsPath
|
|
94
|
-
* @param {'lvgl'|'png'} format
|
|
95
|
-
* @returns
|
|
91
|
+
/**
|
|
92
|
+
* 是否可转换
|
|
93
|
+
* @param {string} assetsPath
|
|
94
|
+
* @param {'lvgl'|'png'} format
|
|
95
|
+
* @returns
|
|
96
96
|
*/
|
|
97
97
|
static canTranslate(assetsPath) {
|
|
98
98
|
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'lvgl';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/config/UxConfig.d.ts
CHANGED
|
@@ -25,15 +25,13 @@ declare class UxConfig implements IFileLaneConfig<IJavascriptCompileOption> {
|
|
|
25
25
|
exclude: (string | ((filePath: string) => boolean))[];
|
|
26
26
|
get output(): string;
|
|
27
27
|
beforeWorks: (typeof UxBeforeWorks.cleanOutput)[];
|
|
28
|
-
beforeCompile: import("
|
|
28
|
+
beforeCompile: import("file-lane").PreWork<IJavascriptCompileOption>[];
|
|
29
29
|
afterCompile: ({
|
|
30
|
-
worker: import("
|
|
31
|
-
workDescribe: string;
|
|
30
|
+
worker: import("file-lane").FollowWork<IJavascriptCompileOption>;
|
|
32
31
|
workerDescribe?: undefined;
|
|
33
32
|
} | {
|
|
34
|
-
worker: import("
|
|
33
|
+
worker: import("file-lane").FollowWork<IJavascriptCompileOption>;
|
|
35
34
|
workerDescribe: string;
|
|
36
|
-
workDescribe?: undefined;
|
|
37
35
|
})[];
|
|
38
36
|
afterWorks: (typeof UxAfterWorks.cleanOutput)[];
|
|
39
37
|
watchIgnores: RegExp[];
|
package/lib/config/UxConfig.js
CHANGED
|
@@ -25,15 +25,15 @@ class UxConfig {
|
|
|
25
25
|
constructor(projectPath) {
|
|
26
26
|
this.projectPath = projectPath;
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
29
|
-
* 1. 取项目中所有的真实文件
|
|
30
|
-
* 1.1 无entryFileList时
|
|
31
|
-
* 1.2 有entryFileList且文件列表中有 与其他文件相关 的文件时
|
|
32
|
-
* 1.3 有entryFileList且文件列表中有文件为 删除 操作时
|
|
33
|
-
* 2. 返回符合条件的文件列表
|
|
34
|
-
* 2.1 有entryFileList且文件列表中 只有 不影响其他文件 的文件时
|
|
35
|
-
* @param entryFileList
|
|
36
|
-
* @returns
|
|
28
|
+
/**
|
|
29
|
+
* 1. 取项目中所有的真实文件
|
|
30
|
+
* 1.1 无entryFileList时
|
|
31
|
+
* 1.2 有entryFileList且文件列表中有 与其他文件相关 的文件时
|
|
32
|
+
* 1.3 有entryFileList且文件列表中有文件为 删除 操作时
|
|
33
|
+
* 2. 返回符合条件的文件列表
|
|
34
|
+
* 2.1 有entryFileList且文件列表中 只有 不影响其他文件 的文件时
|
|
35
|
+
* @param entryFileList
|
|
36
|
+
* @returns
|
|
37
37
|
*/
|
|
38
38
|
collectFile = entryFileList => {
|
|
39
39
|
// 取项目中所有的真实文件
|
|
@@ -75,8 +75,7 @@ class UxConfig {
|
|
|
75
75
|
beforeWorks = (() => [_UxBeforeWorks.default.cleanOutput])();
|
|
76
76
|
beforeCompile = (() => [_UxBeforeCompile.default.validateManifest, _UxBeforeCompile.default.validateSitemap, _BeforeCompileUtils.default.clean, _BeforeCompileUtils.default.getEntries, _BeforeCompileUtils.default.getGlobalVar])();
|
|
77
77
|
afterCompile = (() => [{
|
|
78
|
-
worker: _UxAfterCompile.default.writeGitIgnore
|
|
79
|
-
workDescribe: 'Write .gitignore'
|
|
78
|
+
worker: _UxAfterCompile.default.writeGitIgnore
|
|
80
79
|
}, {
|
|
81
80
|
worker: _UxAfterCompile.default.symlinkNodeModule,
|
|
82
81
|
workerDescribe: 'Create a soft link to the node_modules folder'
|
|
@@ -114,8 +113,8 @@ class UxConfig {
|
|
|
114
113
|
afterWorks = (() => [_UxAfterWorks.default.cleanOutput])();
|
|
115
114
|
watchIgnores = [/node_modules/, /build/, /dist/];
|
|
116
115
|
|
|
117
|
-
/**
|
|
118
|
-
* 通过项目类型,返回模块配置
|
|
116
|
+
/**
|
|
117
|
+
* 通过项目类型,返回模块配置
|
|
119
118
|
*/
|
|
120
119
|
get module() {
|
|
121
120
|
const isVela = this.getProjectType() === _sharedUtils.ProjectType.VELA_UX;
|
|
@@ -151,10 +150,10 @@ class UxConfig {
|
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
/**
|
|
155
|
-
* 判断项目类型
|
|
156
|
-
*
|
|
157
|
-
* 目前的办法是通过 manifest.json 的 deviceTypeList 是否有 watch 判断
|
|
153
|
+
/**
|
|
154
|
+
* 判断项目类型
|
|
155
|
+
*
|
|
156
|
+
* 目前的办法是通过 manifest.json 的 deviceTypeList 是否有 watch 判断
|
|
158
157
|
*/
|
|
159
158
|
getProjectType() {
|
|
160
159
|
return _sharedUtils.ProjectType.getProjectType(this.projectPath);
|
|
@@ -6,11 +6,6 @@ import IJavascriptCompileOption from '../../compiler/javascript/interface/IJavas
|
|
|
6
6
|
declare class JsLoader implements ILoader {
|
|
7
7
|
context: IFileLaneContext;
|
|
8
8
|
compilerOption: IJavascriptCompileOption;
|
|
9
|
-
/**
|
|
10
|
-
* 解析文件内容
|
|
11
|
-
* @param files files 待处理的文件数组
|
|
12
|
-
* @returns 处理后的文件数组
|
|
13
|
-
*/
|
|
14
9
|
parser(files: IFileParam<any>[]): Promise<IFileParam<any>[]>;
|
|
15
10
|
}
|
|
16
11
|
export default JsLoader;
|
|
@@ -6,27 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _parser = require("@aiot-toolkit/parser");
|
|
8
8
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* JsLoader
|
|
9
|
+
/**
|
|
10
|
+
* JsLoader
|
|
13
11
|
*/
|
|
14
12
|
class JsLoader {
|
|
15
|
-
/**
|
|
16
|
-
* 解析文件内容
|
|
17
|
-
* @param files files 待处理的文件数组
|
|
18
|
-
* @returns 处理后的文件数组
|
|
19
|
-
*/
|
|
20
13
|
async parser(files) {
|
|
21
14
|
const onLog = () => {};
|
|
22
15
|
const result = [];
|
|
23
|
-
const {
|
|
24
|
-
projectPath,
|
|
25
|
-
widgetProvider
|
|
26
|
-
} = this.context;
|
|
27
|
-
const {
|
|
28
|
-
sourceRoot
|
|
29
|
-
} = this.compilerOption;
|
|
30
16
|
for (const item of files) {
|
|
31
17
|
if (!item.content) {
|
|
32
18
|
result.push({
|
|
@@ -36,28 +22,16 @@ class JsLoader {
|
|
|
36
22
|
} else {
|
|
37
23
|
const options = {
|
|
38
24
|
filePath: item.path,
|
|
39
|
-
projectPath,
|
|
25
|
+
projectPath: this.context.projectPath,
|
|
40
26
|
content: item.content.toString(),
|
|
41
|
-
projectType: _sharedUtils.ProjectType.getProjectType(projectPath),
|
|
27
|
+
projectType: _sharedUtils.ProjectType.getProjectType(this.context.projectPath),
|
|
42
28
|
onLog
|
|
43
29
|
};
|
|
44
|
-
const JSTree = (await new _parser.ScriptToTypescript(options, this.compilerOption, this.context).translate({
|
|
45
|
-
content: new _parser.ScriptParser(options).parser(item.content.toString()).ast.content
|
|
46
|
-
}, [])).targetTree;
|
|
47
|
-
// 切割script中的转换结果和source map
|
|
48
|
-
const spliteResult = _parser.SourceMapUtil.splitSourceMap(JSTree);
|
|
49
|
-
let JSContent = spliteResult.newScriptTree.getFullText();
|
|
50
|
-
// 若为widgetProvider.js文件,则给内容添加包裹
|
|
51
|
-
if (widgetProvider) {
|
|
52
|
-
const a = _path.default.relative(_path.default.join(projectPath, sourceRoot), item.path).replace(/\\/g, '/');
|
|
53
|
-
const isWidgetProvider = widgetProvider.includes(a);
|
|
54
|
-
if (isWidgetProvider) {
|
|
55
|
-
JSContent += `$app_exports$.default = exports["default"]`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
30
|
result.push({
|
|
59
31
|
path: item.path,
|
|
60
|
-
content: _parser.
|
|
32
|
+
content: (await new _parser.ScriptToTypescript(options, this.compilerOption, this.context).translate({
|
|
33
|
+
content: new _parser.ScriptParser(options).parser(item.content.toString()).ast.content
|
|
34
|
+
}, [])).targetTree.getFullText()
|
|
61
35
|
});
|
|
62
36
|
}
|
|
63
37
|
}
|
|
@@ -10,8 +10,8 @@ var _PngUtils = _interopRequireDefault(require("../../utils/PngUtils"));
|
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const aaptjs = require('@hap-toolkit/aaptjs');
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* PngLoader
|
|
13
|
+
/**
|
|
14
|
+
* PngLoader
|
|
15
15
|
*/
|
|
16
16
|
class PngLoader {
|
|
17
17
|
async parser(files) {
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _AndroidUx = _interopRequireDefault(require("../../../utils/ux/android/AndroidUx"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
* UxLoader
|
|
9
|
+
/**
|
|
10
|
+
* UxLoader
|
|
11
11
|
*/
|
|
12
12
|
class UxLoader {
|
|
13
13
|
async parser(files) {
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _UxLoaderUtils = _interopRequireDefault(require("../../../utils/ux/UxLoaderUtils"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
* 处理app.ux的Loader
|
|
11
|
-
* AppUxLoader
|
|
9
|
+
/**
|
|
10
|
+
* 处理app.ux的Loader
|
|
11
|
+
* AppUxLoader
|
|
12
12
|
*/
|
|
13
13
|
class AppUxLoader {
|
|
14
14
|
async parser(files) {
|
|
@@ -8,8 +8,8 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
9
|
var _parser = require("@aiot-toolkit/parser");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
/**
|
|
12
|
-
* HmlLoader
|
|
11
|
+
/**
|
|
12
|
+
* HmlLoader
|
|
13
13
|
*/
|
|
14
14
|
class HmlLoader {
|
|
15
15
|
parser(files) {
|
|
@@ -18,18 +18,18 @@ class HmlLoader {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* 包裹 hml 文件
|
|
23
|
-
*
|
|
24
|
-
* # 路径
|
|
25
|
-
* 如果存在同路径的 ux 后缀,报错;否则转换为同路径的 ux 后缀
|
|
26
|
-
*
|
|
27
|
-
* # 内容
|
|
28
|
-
* 1. 给hml的内容加上<template></template>
|
|
29
|
-
* 2. 如果存在同路径同名的 script文件,则加到<script></script>中
|
|
30
|
-
* 3. 如果存在同路径同名的 style文件,则加到<style></style>中
|
|
31
|
-
*
|
|
32
|
-
* @param file
|
|
21
|
+
/**
|
|
22
|
+
* 包裹 hml 文件
|
|
23
|
+
*
|
|
24
|
+
* # 路径
|
|
25
|
+
* 如果存在同路径的 ux 后缀,报错;否则转换为同路径的 ux 后缀
|
|
26
|
+
*
|
|
27
|
+
* # 内容
|
|
28
|
+
* 1. 给hml的内容加上<template></template>
|
|
29
|
+
* 2. 如果存在同路径同名的 script文件,则加到<script></script>中
|
|
30
|
+
* 3. 如果存在同路径同名的 style文件,则加到<style></style>中
|
|
31
|
+
*
|
|
32
|
+
* @param file
|
|
33
33
|
*/
|
|
34
34
|
wrapHml(file) {
|
|
35
35
|
const {
|
|
@@ -14,17 +14,17 @@ var _IManifest = require("../compiler/javascript/vela/interface/IManifest");
|
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* BeforeCompileUtils
|
|
17
|
+
/**
|
|
18
|
+
* BeforeCompileUtils
|
|
19
19
|
*/
|
|
20
20
|
class BeforeCompileUtils {
|
|
21
|
-
/**
|
|
22
|
-
* 获取ux项目的路由入口
|
|
23
|
-
* context.entries中存放ux页面路由
|
|
24
|
-
* context.liteCards中存放轻卡路由
|
|
25
|
-
* @param context
|
|
26
|
-
* @param fileList
|
|
27
|
-
* @returns
|
|
21
|
+
/**
|
|
22
|
+
* 获取ux项目的路由入口
|
|
23
|
+
* context.entries中存放ux页面路由
|
|
24
|
+
* context.liteCards中存放轻卡路由
|
|
25
|
+
* @param context
|
|
26
|
+
* @param fileList
|
|
27
|
+
* @returns
|
|
28
28
|
*/
|
|
29
29
|
static getEntries = params => {
|
|
30
30
|
const {
|
|
@@ -41,11 +41,8 @@ class BeforeCompileUtils {
|
|
|
41
41
|
let entryList = [];
|
|
42
42
|
// 存储轻卡路由
|
|
43
43
|
let liteCardList = [];
|
|
44
|
-
// 存储widgetProvider
|
|
45
|
-
let widgetProviderList = [];
|
|
46
44
|
const {
|
|
47
|
-
router
|
|
48
|
-
widgetProvider
|
|
45
|
+
router
|
|
49
46
|
} = manifestContent;
|
|
50
47
|
if (router) {
|
|
51
48
|
const {
|
|
@@ -88,24 +85,8 @@ class BeforeCompileUtils {
|
|
|
88
85
|
// 没有router配置
|
|
89
86
|
_sharedUtils.ColorConsole.throw(`### manifest ### No router configuration`);
|
|
90
87
|
}
|
|
91
|
-
if (widgetProvider) {
|
|
92
|
-
const EXTENSION_JS = '.js';
|
|
93
|
-
for (const providerItem of widgetProvider) {
|
|
94
|
-
const {
|
|
95
|
-
path
|
|
96
|
-
} = providerItem;
|
|
97
|
-
const itemPath = _path.default.join(srcPath, path + EXTENSION_JS);
|
|
98
|
-
if (_fsExtra.default.existsSync(itemPath)) {
|
|
99
|
-
widgetProviderList.push(path + EXTENSION_JS);
|
|
100
|
-
} else {
|
|
101
|
-
// 报错
|
|
102
|
-
_sharedUtils.ColorConsole.throw(`### manifest ### widgetProvider path '${itemPath}' does not exist`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
88
|
context['entries'] = entryList;
|
|
107
89
|
context['liteCards'] = liteCardList;
|
|
108
|
-
context['widgetProvider'] = widgetProviderList;
|
|
109
90
|
return Promise.resolve();
|
|
110
91
|
};
|
|
111
92
|
static clean = async params => {
|
|
@@ -117,14 +98,7 @@ class BeforeCompileUtils {
|
|
|
117
98
|
if (compilerOption) {
|
|
118
99
|
// 存储build中的文件列表
|
|
119
100
|
const buildPath = _path.default.join(context.projectPath, compilerOption.outputPath);
|
|
120
|
-
const buildFileList = _fsExtra.default.existsSync(buildPath) ? _sharedUtils.FileUtil.readAlldirSync(buildPath).map(filePath =>
|
|
121
|
-
const relativePath = _path.default.relative(buildPath, filePath);
|
|
122
|
-
const fileContent = _fsExtra.default.readFileSync(filePath);
|
|
123
|
-
return {
|
|
124
|
-
path: relativePath,
|
|
125
|
-
content: fileContent
|
|
126
|
-
};
|
|
127
|
-
}) : [];
|
|
101
|
+
const buildFileList = _fsExtra.default.existsSync(buildPath) ? _sharedUtils.FileUtil.readAlldirSync(buildPath).map(filePath => _path.default.relative(buildPath, filePath)) : [];
|
|
128
102
|
if (compalition) {
|
|
129
103
|
compalition.buildFileList = buildFileList;
|
|
130
104
|
}
|
|
@@ -138,9 +112,9 @@ class BeforeCompileUtils {
|
|
|
138
112
|
output: compilerOption?.outputPath
|
|
139
113
|
};
|
|
140
114
|
};
|
|
141
|
-
/**
|
|
142
|
-
* 获取项目的全局样式变量配置
|
|
143
|
-
* @param context
|
|
115
|
+
/**
|
|
116
|
+
* 获取项目的全局样式变量配置
|
|
117
|
+
* @param context
|
|
144
118
|
*/
|
|
145
119
|
static getGlobalVar = params => {
|
|
146
120
|
const {
|
package/lib/utils/PngUtils.js
CHANGED
|
@@ -7,14 +7,14 @@ exports.default = void 0;
|
|
|
7
7
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
* PngUtils
|
|
10
|
+
/**
|
|
11
|
+
* PngUtils
|
|
12
12
|
*/
|
|
13
13
|
class PngUtils {
|
|
14
|
-
/**
|
|
15
|
-
* 检测.9.png是否编码
|
|
16
|
-
* @param filePath
|
|
17
|
-
* @returns
|
|
14
|
+
/**
|
|
15
|
+
* 检测.9.png是否编码
|
|
16
|
+
* @param filePath
|
|
17
|
+
* @returns
|
|
18
18
|
*/
|
|
19
19
|
static isEncode9Png(filePath) {
|
|
20
20
|
const buff = _fsExtra.default.readFileSync(filePath);
|
|
@@ -23,11 +23,11 @@ class PngUtils {
|
|
|
23
23
|
const encode = buff.subarray(start, end).toString() === 'npTc' || buff.subarray(start, end).toString() === 'npOl';
|
|
24
24
|
return encode;
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* 计算文件转换后的目标路径
|
|
28
|
-
* @param filePath
|
|
29
|
-
* @param context
|
|
30
|
-
* @returns
|
|
26
|
+
/**
|
|
27
|
+
* 计算文件转换后的目标路径
|
|
28
|
+
* @param filePath
|
|
29
|
+
* @param context
|
|
30
|
+
* @returns
|
|
31
31
|
*/
|
|
32
32
|
static convertOutputPath(filePath, context) {
|
|
33
33
|
const {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface FileComparisonResult {
|
|
2
|
+
isEqual: boolean;
|
|
3
|
+
details: {
|
|
4
|
+
hash1: string;
|
|
5
|
+
hash2: string;
|
|
6
|
+
fileSize1: number;
|
|
7
|
+
fileSize2: number;
|
|
8
|
+
comparisonTime: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function compareFiles(filePath1: string, filePath2: string): FileComparisonResult;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.compareFiles = compareFiles;
|
|
7
|
+
var _crypto = require("crypto");
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function compareFiles(filePath1, filePath2) {
|
|
11
|
+
const startTime = Date.now();
|
|
12
|
+
|
|
13
|
+
// 快速检查:文件大小不同则内容必然不同
|
|
14
|
+
const size1 = _fs.default.statSync(filePath1).size;
|
|
15
|
+
const size2 = _fs.default.statSync(filePath2).size;
|
|
16
|
+
if (size1 !== size2) {
|
|
17
|
+
return {
|
|
18
|
+
isEqual: false,
|
|
19
|
+
details: {
|
|
20
|
+
hash1: '',
|
|
21
|
+
hash2: '',
|
|
22
|
+
fileSize1: size1,
|
|
23
|
+
fileSize2: size2,
|
|
24
|
+
comparisonTime: Date.now() - startTime
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 计算两个文件的哈希
|
|
30
|
+
const hash1 = computeFileHash(filePath1);
|
|
31
|
+
const hash2 = computeFileHash(filePath2);
|
|
32
|
+
return {
|
|
33
|
+
isEqual: hash1 === hash2,
|
|
34
|
+
details: {
|
|
35
|
+
hash1,
|
|
36
|
+
hash2,
|
|
37
|
+
fileSize1: size1,
|
|
38
|
+
fileSize2: size2,
|
|
39
|
+
comparisonTime: Date.now() - startTime
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function computeFileHash(filePath) {
|
|
44
|
+
const fileData = _fs.default.readFileSync(filePath);
|
|
45
|
+
const hash = (0, _crypto.createHash)('SHA256').update(fileData);
|
|
46
|
+
return hash.digest('hex');
|
|
47
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import FileLaneCompilation from 'file-lane/lib/FileLaneCompilation';
|
|
2
1
|
import IManifest from '../../compiler/javascript/vela/interface/IManifest';
|
|
3
2
|
export declare class UxFileUtils {
|
|
4
3
|
static readonly CONFIG_FILE_NAME = "manifest.json";
|
|
@@ -39,15 +38,18 @@ export declare class UxFileUtils {
|
|
|
39
38
|
*/
|
|
40
39
|
static validateSitemap(projectPath: string, sourceRoot?: string): void;
|
|
41
40
|
/**
|
|
41
|
+
* 比较新旧文件列表差异
|
|
42
42
|
* 1. 遍历旧文件列表
|
|
43
|
-
* 1.1 若文件路径在新文件列表
|
|
44
|
-
* 1.2 若文件路径在新文件列表
|
|
43
|
+
* 1.1 若文件路径在新文件列表remainingNewFilest中,且内容一致时,从remainingNewFiles中移除该项
|
|
44
|
+
* 1.2 若文件路径在新文件列表remainingNewFiles中,且内容不一致时,添加到diffList中表示待更新,从remainingNewFiles中移除该项
|
|
45
45
|
* 1.3 若文件路径不在新文件列表中,表示该文件待删除(热更新时,可以不做删除,删除耗费性能)
|
|
46
|
-
* 2. 若遍历完旧文件列表后,
|
|
47
|
-
* @param oldFileList
|
|
48
|
-
* @param newFileList
|
|
49
|
-
* @
|
|
46
|
+
* 2. 若遍历完旧文件列表后,remainingNewFiles长度不为0,表示有文件待新增
|
|
47
|
+
* @param oldFileList 旧文件路径列表(相对路径)
|
|
48
|
+
* @param newFileList 新文件路径列表(绝对路径)
|
|
49
|
+
* @param oldDir 旧文件所在目录(绝对路径)
|
|
50
|
+
* @param newDir 新文件所在目录(绝对路径)
|
|
51
|
+
* @returns 返回差异文件路径列表(相对路径)
|
|
50
52
|
*/
|
|
51
|
-
static getDiffJSON(
|
|
53
|
+
static getDiffJSON(oldFileList: string[], newFileList: string[], oldDir: string, newDir: string): string[];
|
|
52
54
|
}
|
|
53
55
|
export default UxFileUtils;
|