@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
package/README.md
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
# `aiotpack`
|
|
2
|
-
|
|
3
|
-
最终打包工具,包含各类语言、各类平台的打包配置
|
|
4
|
-
|
|
5
|
-
## 目录结构
|
|
6
|
-
|
|
7
|
-
| 目录 | 描述 |
|
|
8
|
-
| -------- | ------------------------------------------------------------------------------- |
|
|
9
|
-
| config | FileLane 配置,基于此配置,可完成“源码项目-->目标代码项目-->应用程序”的完整流程 |
|
|
10
|
-
| compiler | 目标语言-->应用程序编译器 |
|
|
11
|
-
| loader | 源码语言-->目标代码语言 |
|
|
12
|
-
| utils | 语言、项目无关的辅助工具 |
|
|
13
|
-
|
|
14
|
-
## config
|
|
15
|
-
|
|
16
|
-
通过在 FileLane 中配置各项参数,可完成“**源码项目-->目标代码项目-->应用程序**”的完整流程
|
|
17
|
-
|
|
18
|
-
## compiler
|
|
19
|
-
|
|
20
|
-
#### 概述
|
|
21
|
-
|
|
22
|
-
源码已生成目标代码项目,此时需要生成**最终产物--应用程序**。compiler 目录中的代码即为完成此项工作而生。
|
|
23
|
-
|
|
24
|
-
#### 子目录
|
|
25
|
-
|
|
26
|
-
compiler 下的每个子目录,对应一种目标语言;每种目标语言在不同平台又可能有不同的生成方式。
|
|
27
|
-
|
|
28
|
-
因此结构为:`compiler/目标语言/目标平台`,例如:
|
|
29
|
-
|
|
30
|
-
- `compiler/javascript/vela`--javascript 语言在 vela 平台的生成
|
|
31
|
-
|
|
32
|
-
#### 添加编译器
|
|
33
|
-
|
|
34
|
-
1. 按上述目录结构,添加目录
|
|
35
|
-
2. 创建编译器`class XCompiler`, 建议实现实现`ICompiler` 接口,以便以后实现统一的用户端接口
|
|
36
|
-
3. 在需要的位置调用
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
new XCompiler().compile({
|
|
40
|
-
projectPath: '',
|
|
41
|
-
mode: 'development',
|
|
42
|
-
platform: 'native'
|
|
43
|
-
})
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## loader--各类语言的转换器
|
|
1
|
+
# `aiotpack`
|
|
2
|
+
|
|
3
|
+
最终打包工具,包含各类语言、各类平台的打包配置
|
|
4
|
+
|
|
5
|
+
## 目录结构
|
|
6
|
+
|
|
7
|
+
| 目录 | 描述 |
|
|
8
|
+
| -------- | ------------------------------------------------------------------------------- |
|
|
9
|
+
| config | FileLane 配置,基于此配置,可完成“源码项目-->目标代码项目-->应用程序”的完整流程 |
|
|
10
|
+
| compiler | 目标语言-->应用程序编译器 |
|
|
11
|
+
| loader | 源码语言-->目标代码语言 |
|
|
12
|
+
| utils | 语言、项目无关的辅助工具 |
|
|
13
|
+
|
|
14
|
+
## config
|
|
15
|
+
|
|
16
|
+
通过在 FileLane 中配置各项参数,可完成“**源码项目-->目标代码项目-->应用程序**”的完整流程
|
|
17
|
+
|
|
18
|
+
## compiler
|
|
19
|
+
|
|
20
|
+
#### 概述
|
|
21
|
+
|
|
22
|
+
源码已生成目标代码项目,此时需要生成**最终产物--应用程序**。compiler 目录中的代码即为完成此项工作而生。
|
|
23
|
+
|
|
24
|
+
#### 子目录
|
|
25
|
+
|
|
26
|
+
compiler 下的每个子目录,对应一种目标语言;每种目标语言在不同平台又可能有不同的生成方式。
|
|
27
|
+
|
|
28
|
+
因此结构为:`compiler/目标语言/目标平台`,例如:
|
|
29
|
+
|
|
30
|
+
- `compiler/javascript/vela`--javascript 语言在 vela 平台的生成
|
|
31
|
+
|
|
32
|
+
#### 添加编译器
|
|
33
|
+
|
|
34
|
+
1. 按上述目录结构,添加目录
|
|
35
|
+
2. 创建编译器`class XCompiler`, 建议实现实现`ICompiler` 接口,以便以后实现统一的用户端接口
|
|
36
|
+
3. 在需要的位置调用
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
new XCompiler().compile({
|
|
40
|
+
projectPath: '',
|
|
41
|
+
mode: 'development',
|
|
42
|
+
platform: 'native'
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## loader--各类语言的转换器
|
|
@@ -16,14 +16,13 @@ var _ZipUtil = _interopRequireDefault(require("../../compiler/javascript/vela/ut
|
|
|
16
16
|
var _UxFileUtils = _interopRequireDefault(require("../../utils/ux/UxFileUtils"));
|
|
17
17
|
var _FileLaneTriggerType = _interopRequireDefault(require("file-lane/lib/enum/FileLaneTriggerType"));
|
|
18
18
|
var _ZipFileUtil = _interopRequireDefault(require("@aiot-toolkit/shared-utils/lib/utils/ZipFileUtil"));
|
|
19
|
-
var _process = require("process");
|
|
20
19
|
var _ImageIcu = _interopRequireDefault(require("../../compiler/tools/icu/ImageIcu"));
|
|
20
|
+
var _LiteCard = _interopRequireDefault(require("../../compiler/javascript/vela/utils/LiteCard"));
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
|
|
23
|
-
const HapToolkit = require('hap-toolkit');
|
|
24
23
|
|
|
25
|
-
/**
|
|
26
|
-
* UxAfterCompile
|
|
24
|
+
/**
|
|
25
|
+
* UxAfterCompile
|
|
27
26
|
*/
|
|
28
27
|
class UxAfterCompile {
|
|
29
28
|
static compileJavascript = async params => {
|
|
@@ -104,11 +103,11 @@ class UxAfterCompile {
|
|
|
104
103
|
}
|
|
105
104
|
};
|
|
106
105
|
|
|
107
|
-
/**
|
|
108
|
-
* 复制各类资源文件,例如图片、视频等
|
|
109
|
-
* @param context
|
|
110
|
-
* @param config
|
|
111
|
-
* @param compilerOption
|
|
106
|
+
/**
|
|
107
|
+
* 复制各类资源文件,例如图片、视频等
|
|
108
|
+
* @param context
|
|
109
|
+
* @param config
|
|
110
|
+
* @param compilerOption
|
|
112
111
|
*/
|
|
113
112
|
static copyResource = async params => {
|
|
114
113
|
const {
|
|
@@ -155,18 +154,19 @@ class UxAfterCompile {
|
|
|
155
154
|
_sharedUtils.FileUtil.copyFiles(_path.default.join(projectPath, sourceRoot), _path.default.join(projectPath, outputPath), undefined, includeList);
|
|
156
155
|
};
|
|
157
156
|
|
|
158
|
-
/**
|
|
159
|
-
* 写入 manifest.json 文件
|
|
160
|
-
*
|
|
161
|
-
* 需要在源码manifest.json基础加一些额外的内容
|
|
162
|
-
* @param compilerOption
|
|
157
|
+
/**
|
|
158
|
+
* 写入 manifest.json 文件
|
|
159
|
+
*
|
|
160
|
+
* 需要在源码manifest.json基础加一些额外的内容
|
|
161
|
+
* @param compilerOption
|
|
163
162
|
*/
|
|
164
163
|
const updateManifest = compilerOption => {
|
|
165
164
|
const {
|
|
166
165
|
projectPath,
|
|
167
166
|
sourceRoot,
|
|
168
167
|
outputPath,
|
|
169
|
-
completeFeature
|
|
168
|
+
completeFeature,
|
|
169
|
+
startPage
|
|
170
170
|
} = compilerOption;
|
|
171
171
|
const content = _UxFileUtils.default.getManifestInfo(projectPath, sourceRoot);
|
|
172
172
|
const translateCache = context.translateCache;
|
|
@@ -177,6 +177,15 @@ class UxAfterCompile {
|
|
|
177
177
|
content.packageInfo = _ZipUtil.default.createComment(compilerOption);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
// 如果有startPage,且feature中没有router,则添加router
|
|
181
|
+
const routerFeature = 'system.router';
|
|
182
|
+
if (startPage && !content.features?.find(item => item.name === routerFeature)) {
|
|
183
|
+
content.features = content.features || [];
|
|
184
|
+
content.features.push({
|
|
185
|
+
name: routerFeature
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
180
189
|
// feature
|
|
181
190
|
if (translateCache?.featureCache.size) {
|
|
182
191
|
// 消息提示
|
|
@@ -249,18 +258,18 @@ class UxAfterCompile {
|
|
|
249
258
|
_fsExtra.default.outputFileSync(_path.default.join(outputAbsPath, _ZipUtil.default.CERT_PATH), buffer);
|
|
250
259
|
};
|
|
251
260
|
if (compilerOption) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
261
|
+
copyResourceFiles(compilerOption);
|
|
262
|
+
updateManifest(compilerOption);
|
|
263
|
+
genDeviceManifests(compilerOption);
|
|
255
264
|
await genMetaFiles(compilerOption);
|
|
256
265
|
}
|
|
257
266
|
};
|
|
258
267
|
|
|
259
|
-
/**
|
|
260
|
-
* 压缩资源文件
|
|
261
|
-
* 1. png8
|
|
262
|
-
* 2. bin
|
|
263
|
-
* @param params
|
|
268
|
+
/**
|
|
269
|
+
* 压缩资源文件
|
|
270
|
+
* 1. png8
|
|
271
|
+
* 2. bin
|
|
272
|
+
* @param params
|
|
264
273
|
*/
|
|
265
274
|
static compressResource = async params => {
|
|
266
275
|
const {
|
|
@@ -286,11 +295,11 @@ class UxAfterCompile {
|
|
|
286
295
|
}
|
|
287
296
|
};
|
|
288
297
|
|
|
289
|
-
/**
|
|
290
|
-
* 如果是更新触发,则对比临时项目build文件夹 和 项目build文件夹,生成diff.json
|
|
291
|
-
* @param context
|
|
292
|
-
* @param config
|
|
293
|
-
* @param compilerOption
|
|
298
|
+
/**
|
|
299
|
+
* 如果是更新触发,则对比临时项目build文件夹 和 项目build文件夹,生成diff.json
|
|
300
|
+
* @param context
|
|
301
|
+
* @param config
|
|
302
|
+
* @param compilerOption
|
|
294
303
|
*/
|
|
295
304
|
static generateDiff = async params => {
|
|
296
305
|
const {
|
|
@@ -304,19 +313,16 @@ class UxAfterCompile {
|
|
|
304
313
|
if (compalition.trigger === _FileLaneTriggerType.default.START) {
|
|
305
314
|
return;
|
|
306
315
|
}
|
|
307
|
-
const {
|
|
308
|
-
outputPath,
|
|
309
|
-
projectPath
|
|
310
|
-
} = compilerOption;
|
|
311
316
|
// 读取临时项目build文件夹中所有文件路径
|
|
312
|
-
const
|
|
317
|
+
const tempBuildDir = _path.default.join(compilerOption.projectPath, compilerOption.outputPath);
|
|
313
318
|
// 待优化,map文件跟随源文件变化,与时间戳有关文件无需对比
|
|
314
|
-
const tempFileList = _sharedUtils.FileUtil.readAlldirSync(
|
|
315
|
-
const
|
|
319
|
+
const tempFileList = _sharedUtils.FileUtil.readAlldirSync(tempBuildDir);
|
|
320
|
+
const buildDir = _path.default.join(context.projectPath, compilerOption.outputPath);
|
|
321
|
+
const diffList = _UxFileUtils.default.getDiffJSON(compalition.buildFileList, tempFileList, buildDir, tempBuildDir);
|
|
316
322
|
|
|
317
323
|
// 所有差异文件,压缩到 .diff.rpk 中
|
|
318
324
|
if (diffList?.length) {
|
|
319
|
-
const buildFold =
|
|
325
|
+
const buildFold = tempBuildDir;
|
|
320
326
|
const distFold = _path.default.join(compilerOption.projectPath, compilerOption.releasePath);
|
|
321
327
|
const diffFileName = `.diff.rpk`;
|
|
322
328
|
const diffPath = _path.default.join(distFold, diffFileName);
|
|
@@ -329,14 +335,14 @@ class UxAfterCompile {
|
|
|
329
335
|
}
|
|
330
336
|
};
|
|
331
337
|
|
|
332
|
-
/**
|
|
333
|
-
* 打包结果移回源码项目,并删除中间项目
|
|
334
|
-
*
|
|
335
|
-
* 1. 把 build和rpk 目录从**中间项目**移回**源码项目**
|
|
336
|
-
* 2. 删除中间项目
|
|
337
|
-
* @param context
|
|
338
|
-
* @param config
|
|
339
|
-
* @param compilerOption
|
|
338
|
+
/**
|
|
339
|
+
* 打包结果移回源码项目,并删除中间项目
|
|
340
|
+
*
|
|
341
|
+
* 1. 把 build和rpk 目录从**中间项目**移回**源码项目**
|
|
342
|
+
* 2. 删除中间项目
|
|
343
|
+
* @param context
|
|
344
|
+
* @param config
|
|
345
|
+
* @param compilerOption
|
|
340
346
|
*/
|
|
341
347
|
static moveBackResult = async params => {
|
|
342
348
|
const {
|
|
@@ -369,11 +375,11 @@ class UxAfterCompile {
|
|
|
369
375
|
});
|
|
370
376
|
};
|
|
371
377
|
|
|
372
|
-
/**
|
|
373
|
-
* 创建 node_module 软链
|
|
374
|
-
* @param context
|
|
375
|
-
* @param config
|
|
376
|
-
* @param compilerOption
|
|
378
|
+
/**
|
|
379
|
+
* 创建 node_module 软链
|
|
380
|
+
* @param context
|
|
381
|
+
* @param config
|
|
382
|
+
* @param compilerOption
|
|
377
383
|
*/
|
|
378
384
|
static symlinkNodeModule = async params => {
|
|
379
385
|
const {
|
|
@@ -396,14 +402,11 @@ class UxAfterCompile {
|
|
|
396
402
|
throw new Error(`${error?.toString() || 'unknown error'}. Please check whether the file system of the current disk supports the creation of soft links.`);
|
|
397
403
|
}
|
|
398
404
|
};
|
|
399
|
-
/**
|
|
400
|
-
* 编译轻卡ux
|
|
401
|
-
* 1. 使用hap-toolkit编译项目,编译结果存储在build文件夹
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* 1.3 还原stdout
|
|
405
|
-
* 2. 取widgets中配置的轻卡内容,将build文件夹中对应的产物复制到临时文件夹
|
|
406
|
-
* @param params
|
|
405
|
+
/**
|
|
406
|
+
* 编译轻卡ux
|
|
407
|
+
* 1. 使用hap-toolkit编译项目,编译结果存储在build文件夹
|
|
408
|
+
* 2. 取widgets中配置的轻卡内容,将build文件夹中对应的产物复制到临时文件夹
|
|
409
|
+
* @param params
|
|
407
410
|
*/
|
|
408
411
|
static compileLiteCard = async params => {
|
|
409
412
|
const {
|
|
@@ -413,29 +416,20 @@ class UxAfterCompile {
|
|
|
413
416
|
try {
|
|
414
417
|
if (context?.liteCards?.length > 0 && compilerOption) {
|
|
415
418
|
const {
|
|
416
|
-
projectPath,
|
|
417
|
-
outputPath
|
|
419
|
+
projectPath: tempProjectPath,
|
|
420
|
+
outputPath: LITE_OUTPUT_PATH
|
|
418
421
|
} = compilerOption;
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
};
|
|
425
|
-
// 1.2
|
|
426
|
-
await HapToolkit.compile('native', 'dev', false, {
|
|
427
|
-
cwd: context.projectPath,
|
|
428
|
-
signMode: 'BUILD',
|
|
429
|
-
enableCustomComponent: true
|
|
430
|
-
});
|
|
431
|
-
// 1.3
|
|
432
|
-
_process.stdout.write = originalStdout;
|
|
422
|
+
const {
|
|
423
|
+
projectPath
|
|
424
|
+
} = context;
|
|
425
|
+
// 1.
|
|
426
|
+
await new _LiteCard.default(projectPath).compileLiteCard();
|
|
433
427
|
// 2.
|
|
434
428
|
context.liteCards.forEach(card => {
|
|
435
429
|
// hap-toolkit的产物在项目的build文件夹下
|
|
436
|
-
const fromPath = _path.default.join(
|
|
430
|
+
const fromPath = _path.default.join(projectPath, LITE_OUTPUT_PATH, card);
|
|
437
431
|
// aiot-toolkit的产物在临时项目的build文件夹下
|
|
438
|
-
const toPath = _path.default.join(
|
|
432
|
+
const toPath = _path.default.join(tempProjectPath, LITE_OUTPUT_PATH, card);
|
|
439
433
|
//确定目标目录存在,若不存在则创建到父目录
|
|
440
434
|
_fsExtra.default.ensureDirSync(_path.default.dirname(toPath));
|
|
441
435
|
// 复制文件
|
|
@@ -451,10 +445,10 @@ class UxAfterCompile {
|
|
|
451
445
|
throw new Error(`compile lite card error, ${error?.toString() || 'unknown error'}.`);
|
|
452
446
|
}
|
|
453
447
|
};
|
|
454
|
-
/**
|
|
455
|
-
* 检查资源文件
|
|
456
|
-
* 1. 检查文件体积是否过大, 如果超出,则提示到真机验证
|
|
457
|
-
* @param params
|
|
448
|
+
/**
|
|
449
|
+
* 检查资源文件
|
|
450
|
+
* 1. 检查文件体积是否过大, 如果超出,则提示到真机验证
|
|
451
|
+
* @param params
|
|
458
452
|
*/
|
|
459
453
|
static resourceCheck = async params => {
|
|
460
454
|
const {
|
|
@@ -495,8 +489,8 @@ class UxAfterCompile {
|
|
|
495
489
|
}
|
|
496
490
|
};
|
|
497
491
|
|
|
498
|
-
/**
|
|
499
|
-
* 写入.gitignore文件, 忽略临时目录
|
|
492
|
+
/**
|
|
493
|
+
* 写入.gitignore文件, 忽略临时目录
|
|
500
494
|
*/
|
|
501
495
|
static writeGitIgnore = async params => {
|
|
502
496
|
const {
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _UxFileUtils = _interopRequireDefault(require("../../utils/ux/UxFileUtils"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
/**
|
|
10
|
-
* UxBeforeCompile
|
|
9
|
+
/**
|
|
10
|
+
* UxBeforeCompile
|
|
11
11
|
*/
|
|
12
12
|
class UxBeforeCompile {
|
|
13
13
|
static validateManifest = async _ref => {
|
|
@@ -55,13 +55,13 @@ class JavascriptCompiler {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
/**
|
|
59
|
-
* 压缩插件
|
|
60
|
-
*
|
|
61
|
-
* dev模式,只处理console,其它禁用
|
|
62
|
-
* prod模式,其它使用默认值
|
|
63
|
-
* @param mode
|
|
64
|
-
* @returns
|
|
58
|
+
/**
|
|
59
|
+
* 压缩插件
|
|
60
|
+
*
|
|
61
|
+
* dev模式,只处理console,其它禁用
|
|
62
|
+
* prod模式,其它使用默认值
|
|
63
|
+
* @param mode
|
|
64
|
+
* @returns
|
|
65
65
|
*/
|
|
66
66
|
createMinimizerRspackPlugin(compileOption) {
|
|
67
67
|
const {
|
|
@@ -7,8 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _VelaWebpackConfigurator = _interopRequireDefault(require("../vela/VelaWebpackConfigurator"));
|
|
8
8
|
var _WrapPlugin = _interopRequireDefault(require("./plugin/WrapPlugin"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
* AndroidWebpackConfigurator
|
|
10
|
+
/**
|
|
11
|
+
* AndroidWebpackConfigurator
|
|
12
12
|
*/
|
|
13
13
|
class AndroidWebpackConfigurator extends _VelaWebpackConfigurator.default {
|
|
14
14
|
createWrapPlugin() {
|
|
@@ -8,8 +8,8 @@ var _core = require("@rspack/core");
|
|
|
8
8
|
var _webpackSources = require("webpack-sources");
|
|
9
9
|
var _UxFileUtils = _interopRequireDefault(require("../../../../utils/ux/UxFileUtils"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
/**
|
|
12
|
-
* WrapPlugin
|
|
11
|
+
/**
|
|
12
|
+
* WrapPlugin
|
|
13
13
|
*/
|
|
14
14
|
class WrapPlugin {
|
|
15
15
|
constructor(param) {
|
|
@@ -26,11 +26,11 @@ class WrapPlugin {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* 添加包含代码
|
|
31
|
-
*
|
|
32
|
-
* 1. 仅 page 文件添加
|
|
33
|
-
* @param compilation
|
|
29
|
+
/**
|
|
30
|
+
* 添加包含代码
|
|
31
|
+
*
|
|
32
|
+
* 1. 仅 page 文件添加
|
|
33
|
+
* @param compilation
|
|
34
34
|
*/
|
|
35
35
|
wrap(compilation) {
|
|
36
36
|
// 获取入口文件
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* 构建名格式类型枚举
|
|
7
|
+
/**
|
|
8
|
+
* 构建名格式类型枚举
|
|
9
9
|
*/
|
|
10
10
|
var BuildNameFormatType = /*#__PURE__*/function (BuildNameFormatType) {
|
|
11
11
|
BuildNameFormatType[BuildNameFormatType["DEFAULT"] = 1] = "DEFAULT";
|
|
@@ -8,10 +8,6 @@ interface IWidget {
|
|
|
8
8
|
sizes: string[];
|
|
9
9
|
type?: string;
|
|
10
10
|
}
|
|
11
|
-
interface IWidgetProvider {
|
|
12
|
-
name: string;
|
|
13
|
-
path: string;
|
|
14
|
-
}
|
|
15
11
|
/**
|
|
16
12
|
* vela manifest文件对应的数据结构
|
|
17
13
|
*/
|
|
@@ -37,7 +33,6 @@ export default interface IManifest {
|
|
|
37
33
|
};
|
|
38
34
|
minAPILevel?: number;
|
|
39
35
|
packageInfo?: Dictionary<string | number>;
|
|
40
|
-
widgetProvider?: IWidgetProvider[];
|
|
41
36
|
icon: string;
|
|
42
37
|
}
|
|
43
38
|
export interface IFeatures {
|
|
@@ -5,58 +5,58 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
|
-
/**
|
|
9
|
-
* 文件资源
|
|
8
|
+
/**
|
|
9
|
+
* 文件资源
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* 定义文件包
|
|
14
|
-
*
|
|
15
|
-
* 相当于虚拟的 rpk 包
|
|
12
|
+
/**
|
|
13
|
+
* 定义文件包
|
|
14
|
+
*
|
|
15
|
+
* 相当于虚拟的 rpk 包
|
|
16
16
|
*/
|
|
17
17
|
class Package {
|
|
18
|
-
/**
|
|
19
|
-
* 包前缀
|
|
18
|
+
/**
|
|
19
|
+
* 包前缀
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* 子包名称;整包没有
|
|
22
|
+
/**
|
|
23
|
+
* 子包名称;整包没有
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* 是否为独立包
|
|
26
|
+
/**
|
|
27
|
+
* 是否为独立包
|
|
28
28
|
*/
|
|
29
29
|
standalone = false;
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* 后缀名
|
|
31
|
+
/**
|
|
32
|
+
* 后缀名
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* 资源路径匹配
|
|
35
|
+
/**
|
|
36
|
+
* 资源路径匹配
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
_resourceList = [];
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
* 资源文件列表
|
|
41
|
+
/**
|
|
42
|
+
* 资源文件列表
|
|
43
43
|
*/
|
|
44
44
|
get resourceList() {
|
|
45
45
|
return this._resourceList;
|
|
46
46
|
}
|
|
47
47
|
_resourceDic = {};
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* 资源文件字典,以高效检查资源是否存在
|
|
49
|
+
/**
|
|
50
|
+
* 资源文件字典,以高效检查资源是否存在
|
|
51
51
|
*/
|
|
52
52
|
get resourceDic() {
|
|
53
53
|
return this._resourceDic;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* 是否已包含指定文件
|
|
58
|
-
* @param filePath 文件路径
|
|
59
|
-
* @returns
|
|
56
|
+
/**
|
|
57
|
+
* 是否已包含指定文件
|
|
58
|
+
* @param filePath 文件路径
|
|
59
|
+
* @returns
|
|
60
60
|
*/
|
|
61
61
|
include(filePath) {
|
|
62
62
|
return this.resourceDic[filePath];
|
|
@@ -65,10 +65,10 @@ class Package {
|
|
|
65
65
|
return this.resourceList.find(item => item.fileBuildPath === filePath);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* 添加资源
|
|
70
|
-
* @param data
|
|
71
|
-
* @returns
|
|
68
|
+
/**
|
|
69
|
+
* 添加资源
|
|
70
|
+
* @param data
|
|
71
|
+
* @returns
|
|
72
72
|
*/
|
|
73
73
|
addResource(data) {
|
|
74
74
|
const {
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
|
-
/**
|
|
9
|
-
* Jsc
|
|
8
|
+
/**
|
|
9
|
+
* Jsc
|
|
10
10
|
*/
|
|
11
11
|
class Jsc {
|
|
12
12
|
constructor(projectPath, buildPath) {
|
|
@@ -14,6 +14,7 @@ class Jsc {
|
|
|
14
14
|
this.buildPath = buildPath;
|
|
15
15
|
}
|
|
16
16
|
jsc() {
|
|
17
|
+
let deleteJs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
17
18
|
const {
|
|
18
19
|
projectPath,
|
|
19
20
|
buildPath
|
|
@@ -26,7 +27,10 @@ class Jsc {
|
|
|
26
27
|
}, msg);
|
|
27
28
|
}
|
|
28
29
|
}).then(() => {
|
|
29
|
-
|
|
30
|
+
if (deleteJs) {
|
|
31
|
+
return _sharedUtils.FileUtil.del(`${buildPath}/**/*.js`);
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
30
34
|
}).catch(error => {
|
|
31
35
|
_sharedUtils.ColorConsole.throw(error.message);
|
|
32
36
|
return Promise.reject(error);
|