@aiot-toolkit/aiotpack 2.0.6-beta.10 → 2.0.6-beta.11

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.
@@ -242,23 +242,25 @@ class UxAfterCompile {
242
242
  }
243
243
 
244
244
  // e2e
245
- // 1. 修改entry
246
- // 2. 设置launchMode
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 entryName = testConfig.entry?.name;
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
- if (launchMode) {
258
- const entryPage = content.router.pages?.[content.router.entry];
259
- if (entryPage) {
260
- entryPage.launchMode = launchMode;
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
- * 通过读取 manifest.json 生成 entry
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
- * 通过读取 manifest.json 生成 entry
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: string;
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: any, codeDir: string, projectPath: string): Dictionary<string>;
13
+ static resolveEntries(config: IManifest, codeDir: string, projectPath: string): Dictionary<string>;
13
14
  /**
14
15
  * 通过无后缀的文件名路径获取存在的文件路径
15
16
  *
@@ -36,7 +36,7 @@ class UxCompileUtil {
36
36
  * @param config 项目配置文件的内容,应为json对象
37
37
  * @param codeDir 源码目录
38
38
  * @param projectPath 项目目录
39
- * @returns {[入口名]:源文件路径}
39
+ * @returns `{[entryName]:entryPath}`
40
40
  */
41
41
  static resolveEntries(config, codeDir, projectPath) {
42
42
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.6-beta.10",
3
+ "version": "2.0.6-beta.11",
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.10",
23
- "@aiot-toolkit/parser": "2.0.6-beta.10",
24
- "@aiot-toolkit/shared-utils": "2.0.6-beta.10",
22
+ "@aiot-toolkit/generator": "2.0.6-beta.11",
23
+ "@aiot-toolkit/parser": "2.0.6-beta.11",
24
+ "@aiot-toolkit/shared-utils": "2.0.6-beta.11",
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.10",
29
+ "file-lane": "2.0.6-beta.11",
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": "b6a63385af95a6ba445e65225a92014026ce3144"
45
+ "gitHead": "acecf0ae5d6991619051dbbeda770a602f215dd6"
46
46
  }