@aiot-toolkit/aiotpack 2.0.6-beta.10 → 2.0.6-beta.12
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 +11 -9
- package/lib/compiler/javascript/vela/VelaWebpackConfigurator.d.ts +3 -1
- package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js +16 -1
- package/lib/compiler/javascript/vela/interface/IManifest.d.ts +7 -1
- package/lib/compiler/javascript/vela/utils/UxCompileUtil.d.ts +3 -2
- package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +1 -1
- package/lib/utils/BeforeCompileUtils.d.ts +1 -1
- package/lib/utils/BeforeCompileUtils.js +10 -0
- package/package.json +6 -6
|
@@ -242,23 +242,25 @@ class UxAfterCompile {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
// e2e
|
|
245
|
-
//
|
|
246
|
-
|
|
247
|
-
if (compilerOption.enableE2e) {
|
|
245
|
+
//
|
|
246
|
+
if (compilerOption.e2eConfigPath && compilerOption.enableE2e) {
|
|
248
247
|
const testConfig = _UxUtil.default.getE2eConfig({
|
|
249
248
|
projectPath: compilerOption.projectPath,
|
|
250
249
|
e2eConfigPath: compilerOption.e2eConfigPath
|
|
251
250
|
});
|
|
252
|
-
const
|
|
251
|
+
const testPagePath = _path.default.parse(_path.default.relative(_path.default.join(compilerOption.projectPath, sourceRoot), _path.default.join(testConfig.dir, testConfig.entry.path)));
|
|
252
|
+
// 1. 修改entry
|
|
253
|
+
const entryName = testPagePath.dir;
|
|
253
254
|
const launchMode = testConfig.entry?.launchMode;
|
|
254
255
|
if (entryName) {
|
|
255
256
|
content.router.entry = entryName;
|
|
256
257
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
// 2. 添加测试页到router.pages
|
|
259
|
+
if (content.router.pages) {
|
|
260
|
+
content.router.pages[entryName] = {
|
|
261
|
+
component: testPagePath.name,
|
|
262
|
+
launchMode
|
|
263
|
+
};
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
_fsExtra.default.writeJSONSync(_path.default.join(projectPath, outputPath, _UxFileUtils.default.CONFIG_FILE_NAME), content, {
|
|
@@ -8,7 +8,9 @@ declare class VelaWebpackConfigurator implements IWebpackConfigurator {
|
|
|
8
8
|
protected createWrapPlugin(): RspackPluginInstance;
|
|
9
9
|
protected createBundleAnalyzerPlugin(): any;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* 生成entry
|
|
12
|
+
* 1. 通过读取 manifest.json 生成 entry
|
|
13
|
+
* 2. 通过自动化测试的entry配置生成entry
|
|
12
14
|
* @returns
|
|
13
15
|
*/
|
|
14
16
|
createEntry(): string | EntryObject | string[];
|
|
@@ -9,6 +9,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
var _UxFileUtils = _interopRequireDefault(require("../../../utils/ux/UxFileUtils"));
|
|
10
10
|
var _WrapPlugin = _interopRequireDefault(require("./plugin/WrapPlugin"));
|
|
11
11
|
var _UxCompileUtil = _interopRequireDefault(require("./utils/UxCompileUtil"));
|
|
12
|
+
var _UxUtil = _interopRequireDefault(require("@aiot-toolkit/parser/lib/ux/utils/UxUtil"));
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
class VelaWebpackConfigurator {
|
|
14
15
|
createPlugins() {
|
|
@@ -34,7 +35,9 @@ class VelaWebpackConfigurator {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
+
* 生成entry
|
|
39
|
+
* 1. 通过读取 manifest.json 生成 entry
|
|
40
|
+
* 2. 通过自动化测试的entry配置生成entry
|
|
38
41
|
* @returns
|
|
39
42
|
*/
|
|
40
43
|
createEntry() {
|
|
@@ -44,7 +47,19 @@ class VelaWebpackConfigurator {
|
|
|
44
47
|
} = this.param;
|
|
45
48
|
const configFilePath = _UxFileUtils.default.getManifestFilePath(this.param.projectPath, this.param.sourceRoot);
|
|
46
49
|
if (_fsExtra.default.existsSync(configFilePath)) {
|
|
50
|
+
// 1
|
|
47
51
|
const config = _fsExtra.default.readJSONSync(configFilePath);
|
|
52
|
+
// 2
|
|
53
|
+
if (this.param.e2eConfigPath && this.param.enableE2e) {
|
|
54
|
+
const e2eConfig = _UxUtil.default.getE2eConfig({
|
|
55
|
+
projectPath: this.param.projectPath,
|
|
56
|
+
e2eConfigPath: this.param.e2eConfigPath
|
|
57
|
+
});
|
|
58
|
+
const testPagePath = _path.default.parse(_path.default.relative(_path.default.join(this.param.projectPath, sourceRoot), _path.default.join(e2eConfig.dir, e2eConfig.entry.path)));
|
|
59
|
+
config.router.pages[testPagePath.dir] = {
|
|
60
|
+
component: testPagePath.name
|
|
61
|
+
};
|
|
62
|
+
}
|
|
48
63
|
return _UxCompileUtil.default.resolveEntries(config, _path.default.resolve(projectPath, sourceRoot), projectPath);
|
|
49
64
|
} else {
|
|
50
65
|
throw new Error(`Configuration file does not exist: ${configFilePath}`);
|
|
@@ -29,13 +29,19 @@ export default interface IManifest {
|
|
|
29
29
|
entry: string;
|
|
30
30
|
pages: Dictionary<{
|
|
31
31
|
component?: string;
|
|
32
|
-
launchMode
|
|
32
|
+
launchMode?: string;
|
|
33
33
|
}>;
|
|
34
|
+
floatingWindows?: any;
|
|
34
35
|
};
|
|
35
36
|
services: IService[] | Record<string, IService>;
|
|
36
37
|
minAPILevel?: number;
|
|
37
38
|
packageInfo?: Dictionary<string | number>;
|
|
38
39
|
icon: string;
|
|
40
|
+
workers?: {
|
|
41
|
+
entries: {
|
|
42
|
+
file: string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
39
45
|
}
|
|
40
46
|
export interface IFeatures {
|
|
41
47
|
name: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Dictionary } from '@aiot-toolkit/shared-utils';
|
|
2
|
+
import IManifest from '../interface/IManifest';
|
|
2
3
|
declare class UxCompileUtil {
|
|
3
4
|
static readonly DIGEST_ZIP_DIR = "META-INF";
|
|
4
5
|
static clean(dirList: string[]): void;
|
|
@@ -7,9 +8,9 @@ declare class UxCompileUtil {
|
|
|
7
8
|
* @param config 项目配置文件的内容,应为json对象
|
|
8
9
|
* @param codeDir 源码目录
|
|
9
10
|
* @param projectPath 项目目录
|
|
10
|
-
* @returns {[
|
|
11
|
+
* @returns `{[entryName]:entryPath}`
|
|
11
12
|
*/
|
|
12
|
-
static resolveEntries(config:
|
|
13
|
+
static resolveEntries(config: IManifest, codeDir: string, projectPath: string): Dictionary<string>;
|
|
13
14
|
/**
|
|
14
15
|
* 通过无后缀的文件名路径获取存在的文件路径
|
|
15
16
|
*
|
|
@@ -11,6 +11,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
11
11
|
var _TranslateCache = _interopRequireDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/TranslateCache"));
|
|
12
12
|
var _UxFileUtils = _interopRequireDefault(require("./ux/UxFileUtils"));
|
|
13
13
|
var _IManifest = require("../compiler/javascript/vela/interface/IManifest");
|
|
14
|
+
var _UxUtil = _interopRequireDefault(require("@aiot-toolkit/parser/lib/ux/utils/UxUtil"));
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
|
|
16
17
|
|
|
@@ -88,6 +89,15 @@ class BeforeCompileUtils {
|
|
|
88
89
|
// 没有router配置
|
|
89
90
|
_sharedUtils.ColorConsole.throw(`### manifest ### No router configuration`);
|
|
90
91
|
}
|
|
92
|
+
|
|
93
|
+
// e2e测试入口
|
|
94
|
+
if (compilerOption?.enableE2e && compilerOption?.e2eConfigPath) {
|
|
95
|
+
const e2eConfig = _UxUtil.default.getE2eConfig({
|
|
96
|
+
projectPath: context.projectPath,
|
|
97
|
+
e2eConfigPath: compilerOption.e2eConfigPath
|
|
98
|
+
});
|
|
99
|
+
entryList.push(_path.default.join(e2eConfig.dir, e2eConfig.entry.path));
|
|
100
|
+
}
|
|
91
101
|
if (services) {
|
|
92
102
|
serviceList = Array.isArray(services) ? services : Object.values(services);
|
|
93
103
|
}
|
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.12",
|
|
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.12",
|
|
23
|
+
"@aiot-toolkit/parser": "2.0.6-beta.12",
|
|
24
|
+
"@aiot-toolkit/shared-utils": "2.0.6-beta.12",
|
|
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.12",
|
|
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": "cada1b3423f7842ea243bb1535592ed7f7e5d4a2"
|
|
46
46
|
}
|