@aiot-toolkit/aiotpack 2.0.2-dev.7 → 2.0.2

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.
Files changed (83) hide show
  1. package/lib/{utils/ux/UxFollowWorks.d.ts → afterCompile/ux/UxAfterCompile.d.ts} +11 -4
  2. package/lib/{utils/ux/UxFollowWorks.js → afterCompile/ux/UxAfterCompile.js} +68 -43
  3. package/lib/{followWorks → afterCompile}/xts/entryTemplate.d.ts +1 -1
  4. package/lib/{followWorks → afterCompile}/xts/entryTemplate.js +14 -13
  5. package/lib/{followWorks → afterCompile}/xts/generateRpk.d.ts +1 -1
  6. package/lib/{followWorks → afterCompile}/xts/generateRpk.js +5 -4
  7. package/lib/{followWorks → afterCompile}/xts/ts2wasm.d.ts +1 -1
  8. package/lib/{followWorks → afterCompile}/xts/ts2wasm.js +7 -6
  9. package/lib/afterWorks/ux/UxAfterWorks.d.ts +5 -0
  10. package/lib/afterWorks/ux/UxAfterWorks.js +22 -0
  11. package/lib/{utils/ux/UxPreWorks.d.ts → beforeCompile/ux/UxBeforeCompile.d.ts} +4 -4
  12. package/lib/{utils/ux/UxPreWorks.js → beforeCompile/ux/UxBeforeCompile.js} +11 -8
  13. package/lib/{preWorks → beforeCompile}/xts/preInstall.d.ts +1 -1
  14. package/lib/{preWorks → beforeCompile}/xts/preInstall.js +6 -5
  15. package/lib/beforeWorks/ux/UxBeforeWorks.d.ts +5 -0
  16. package/lib/beforeWorks/ux/UxBeforeWorks.js +22 -0
  17. package/lib/compiler/interface/ICompileParam.d.ts +1 -1
  18. package/lib/compiler/interface/ISignConfig.d.ts +6 -1
  19. package/lib/compiler/javascript/JavascriptCompiler.js +45 -12
  20. package/lib/compiler/javascript/JavascriptDefaultCompileOption.js +1 -2
  21. package/lib/compiler/javascript/android/AndroidWebpackConfigurator.d.ts +9 -0
  22. package/lib/compiler/javascript/android/AndroidWebpackConfigurator.js +16 -0
  23. package/lib/compiler/javascript/android/plugin/WrapPlugin.d.ts +20 -0
  24. package/lib/compiler/javascript/android/plugin/WrapPlugin.js +91 -0
  25. package/lib/compiler/javascript/interface/IJavascriptCompileOption.d.ts +16 -1
  26. package/lib/compiler/javascript/interface/IWebpackConfigurator.d.ts +4 -4
  27. package/lib/compiler/javascript/vela/VelaWebpackConfigurator.d.ts +4 -2
  28. package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js +18 -5
  29. package/lib/compiler/javascript/vela/interface/IChunk.d.ts +6 -1
  30. package/lib/compiler/javascript/vela/interface/IManifest.d.ts +1 -1
  31. package/lib/compiler/javascript/vela/interface/IQuickAppConfig.d.ts +1 -1
  32. package/lib/compiler/javascript/vela/model/Package.d.ts +2 -2
  33. package/lib/compiler/javascript/vela/model/Package.js +5 -5
  34. package/lib/compiler/javascript/vela/plugin/WrapPlugin.d.ts +1 -1
  35. package/lib/compiler/javascript/vela/plugin/WrapPlugin.js +16 -2
  36. package/lib/compiler/javascript/vela/utils/Jsc.d.ts +1 -1
  37. package/lib/compiler/javascript/vela/utils/Jsc.js +19 -11
  38. package/lib/compiler/javascript/vela/utils/UxCompileUtil.d.ts +1 -1
  39. package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +4 -4
  40. package/lib/compiler/javascript/vela/utils/ZipUtil.d.ts +19 -3
  41. package/lib/compiler/javascript/vela/utils/ZipUtil.js +34 -29
  42. package/lib/compiler/javascript/vela/utils/signature/Base64.d.ts +0 -1
  43. package/lib/compiler/javascript/vela/utils/signature/SignUtil.d.ts +23 -7
  44. package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +94 -45
  45. package/lib/compiler/javascript/vela/utils/signature/Signer.d.ts +0 -1
  46. package/lib/compiler/javascript/vela/utils/webpackLoader/addColSourceMap.d.ts +3 -0
  47. package/lib/compiler/javascript/vela/utils/webpackLoader/addColSourceMap.js +56 -0
  48. package/lib/compiler/javascript/vela/utils/webpackLoader/extractMapData.d.ts +3 -0
  49. package/lib/compiler/javascript/vela/utils/webpackLoader/{splitMap.js → extractMapData.js} +2 -2
  50. package/lib/config/UxConfig.d.ts +45 -7
  51. package/lib/config/UxConfig.js +156 -40
  52. package/lib/config/XtsConfig.d.ts +6 -4
  53. package/lib/config/XtsConfig.js +22 -7
  54. package/lib/index.d.ts +9 -1
  55. package/lib/index.js +35 -1
  56. package/lib/loader/ux/JsLoader.d.ts +2 -0
  57. package/lib/loader/ux/JsLoader.js +6 -9
  58. package/lib/loader/ux/PngLoader.js +4 -5
  59. package/lib/loader/ux/android/UxLoader.d.ts +11 -0
  60. package/lib/loader/ux/android/UxLoader.js +39 -0
  61. package/lib/loader/ux/{AppUxLoader.d.ts → vela/AppUxLoader.d.ts} +1 -1
  62. package/lib/loader/ux/{AppUxLoader.js → vela/AppUxLoader.js} +6 -3
  63. package/lib/loader/ux/vela/HmlLoader.d.ts +24 -0
  64. package/lib/loader/ux/vela/HmlLoader.js +63 -0
  65. package/lib/loader/ux/{UxLoader.d.ts → vela/UxLoader.d.ts} +1 -1
  66. package/lib/loader/ux/{UxLoader.js → vela/UxLoader.js} +12 -13
  67. package/lib/loader/xts/XtsLoader.js +6 -7
  68. package/lib/utils/BeforeCompileUtils.d.ts +21 -0
  69. package/lib/utils/BeforeCompileUtils.js +118 -0
  70. package/lib/utils/ux/ManifestSchema.d.ts +1 -1
  71. package/lib/utils/ux/UxFileUtils.d.ts +16 -3
  72. package/lib/utils/ux/UxFileUtils.js +50 -17
  73. package/lib/utils/ux/UxLoaderUtils.d.ts +7 -4
  74. package/lib/utils/ux/UxLoaderUtils.js +43 -25
  75. package/lib/utils/ux/android/AndroidUx.d.ts +27 -0
  76. package/lib/utils/ux/android/AndroidUx.js +98 -0
  77. package/lib/utils/xts/XtsFileLaneUtils.d.ts +10 -0
  78. package/lib/utils/xts/XtsFileLaneUtils.js +68 -0
  79. package/lib/utils/xts/XtsFollowWorks.js +8 -8
  80. package/package.json +16 -8
  81. package/lib/compiler/javascript/vela/utils/webpackLoader/splitMap.d.ts +0 -3
  82. package/lib/utils/PreWorkUtils.d.ts +0 -22
  83. package/lib/utils/PreWorkUtils.js +0 -106
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const parser_1 = require("@aiot-toolkit/parser");
16
+ const shared_utils_1 = require("@aiot-toolkit/shared-utils");
17
+ const UxToTypescript_1 = __importDefault(require("@aiot-toolkit/parser/lib/ux/translate/android/UxToTypescript"));
18
+ const generator_1 = require("@aiot-toolkit/generator");
19
+ const path_1 = __importDefault(require("path"));
20
+ /**
21
+ * AndroidUx
22
+ */
23
+ class AndroidUx {
24
+ /**
25
+ *
26
+ * 编译 ux 文件
27
+ * 1. 获取文件类型:app page 普通ux
28
+ * 2. 使用`UxParse`解析
29
+ * 3. 使用`UxToTypeScript`转换
30
+ * 4. 使用`TypeScriptGenerator`生成
31
+ * @param params
32
+ */
33
+ compileUx(params) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const { context, file, compilerOption } = params;
36
+ const { path: filePath, content } = file;
37
+ const { projectPath } = context;
38
+ const fileType = this.getFileType(filePath, context);
39
+ // 无内容的文件,添加空内容警告
40
+ if (!content) {
41
+ return {
42
+ files: [],
43
+ logs: [
44
+ {
45
+ level: shared_utils_1.Loglevel.WARN,
46
+ message: `${filePath} is empty`,
47
+ filePath
48
+ }
49
+ ]
50
+ };
51
+ }
52
+ const logs = [];
53
+ const option = {
54
+ filePath,
55
+ projectPath,
56
+ projectType: shared_utils_1.ProjectType.ANDDROID_UX,
57
+ fileType,
58
+ onLog: function (log) {
59
+ logs.push(log);
60
+ },
61
+ content: content.toString()
62
+ };
63
+ const uxAst = yield new parser_1.UxParser(option, compilerOption, {}, (path) => path).parser();
64
+ const tsAst = yield new UxToTypescript_1.default(option, compilerOption, context).translate(uxAst.ast, uxAst.offsetList || []);
65
+ const filePathParse = path_1.default.parse(filePath);
66
+ const code = new generator_1.TypescriptGenerator().generate({
67
+ sourceFilePath: filePathParse.base,
68
+ targetFilePath: `${filePathParse.name}.js`,
69
+ ast: tsAst.targetTree,
70
+ mapList: tsAst.mapList
71
+ });
72
+ return {
73
+ files: [
74
+ {
75
+ path: filePath,
76
+ content: code.code
77
+ },
78
+ {
79
+ path: `${filePathParse.dir}/${filePathParse.base}.map`,
80
+ content: code.sourcemap
81
+ }
82
+ // resource todo
83
+ ],
84
+ logs
85
+ };
86
+ });
87
+ }
88
+ getFileType(filePath, context) {
89
+ const { entries } = context;
90
+ if (path_1.default.basename(filePath) === 'app.ux') {
91
+ return 'app';
92
+ }
93
+ else if (entries.includes(filePath)) {
94
+ return 'page';
95
+ }
96
+ }
97
+ }
98
+ exports.default = AndroidUx;
@@ -0,0 +1,10 @@
1
+ declare class XtsFileLaneUtils {
2
+ /**
3
+ * 将buildPath文件夹的内容压缩成zip包,放置于targetPath路径下
4
+ * @param buildPath
5
+ * @param targetPath
6
+ * @param zipRootDirNames 可自定义压缩包内最外层目录的名称
7
+ */
8
+ static zipProject(buildPath: string[], targetFile: string, zipRootDirNames?: string[]): Promise<void>;
9
+ }
10
+ export default XtsFileLaneUtils;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const shared_utils_1 = require("@aiot-toolkit/shared-utils");
16
+ const archiver_1 = __importDefault(require("archiver"));
17
+ const fs_extra_1 = __importDefault(require("fs-extra"));
18
+ const path_1 = __importDefault(require("path"));
19
+ class XtsFileLaneUtils {
20
+ /**
21
+ * 将buildPath文件夹的内容压缩成zip包,放置于targetPath路径下
22
+ * @param buildPath
23
+ * @param targetPath
24
+ * @param zipRootDirNames 可自定义压缩包内最外层目录的名称
25
+ */
26
+ static zipProject(buildPath, targetFile, zipRootDirNames) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ return new Promise((resolve, reject) => {
29
+ const output = fs_extra_1.default.createWriteStream(targetFile);
30
+ const archive = archiver_1.default.create('zip', {
31
+ zlib: { level: 9 }
32
+ });
33
+ // 监听错误
34
+ archive.on('error', (err) => {
35
+ shared_utils_1.ColorConsole.throw(`${err.message}`);
36
+ output.close();
37
+ reject();
38
+ });
39
+ // 监听写入流打开的事件
40
+ output.on('open', () => {
41
+ shared_utils_1.ColorConsole.info(`Write stream is open`);
42
+ });
43
+ output.on('close', () => {
44
+ shared_utils_1.ColorConsole.info(`Write stream is closed`);
45
+ resolve();
46
+ });
47
+ // 将压缩文件导入到输出流中
48
+ archive.pipe(output);
49
+ // 指定压缩目录
50
+ buildPath.forEach((folder, index) => {
51
+ const folderName = path_1.default.basename(folder); // 获取文件夹名
52
+ if (zipRootDirNames && zipRootDirNames[index]) {
53
+ archive.directory(folder, zipRootDirNames[index]);
54
+ }
55
+ else {
56
+ archive.directory(folder, folderName);
57
+ }
58
+ });
59
+ archive.on('finish', () => {
60
+ shared_utils_1.ColorConsole.info('finish');
61
+ });
62
+ // 完成压缩,关闭输出流
63
+ archive.finalize();
64
+ });
65
+ });
66
+ }
67
+ }
68
+ exports.default = XtsFileLaneUtils;
@@ -12,11 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
16
- const FileLaneUtil_1 = __importDefault(require("file-lane/lib/utils/FileLaneUtil"));
15
+ const shared_utils_1 = require("@aiot-toolkit/shared-utils");
17
16
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
17
  const path_1 = __importDefault(require("path"));
19
18
  const UxFileUtils_1 = __importDefault(require("./../ux/UxFileUtils"));
19
+ const XtsFileLaneUtils_1 = __importDefault(require("../../utils/xts/XtsFileLaneUtils"));
20
20
  /**
21
21
  * XtsFollowWorks
22
22
  */
@@ -33,7 +33,7 @@ class XtsFollowWorks {
33
33
  const zipPath = path_1.default.join(projectPath, 'dist');
34
34
  // buildPath必须是真实文件夹路径
35
35
  if (!fs_extra_1.default.existsSync(buildPath)) {
36
- ColorConsole_1.default.throw(`buildPath: '${buildPath}' not exist`);
36
+ shared_utils_1.ColorConsole.throw(`buildPath: '${buildPath}' not exist`);
37
37
  }
38
38
  try {
39
39
  // 确认文件夹是否存在,不存在则创建
@@ -41,10 +41,10 @@ class XtsFollowWorks {
41
41
  // 清空dist文件夹
42
42
  fs_extra_1.default.emptyDirSync(zipPath);
43
43
  const filePath = XtsFollowWorks.getFilePath(projectPath, 'dist', options.packageName, 'rpk');
44
- yield FileLaneUtil_1.default.zipProject([buildPath], filePath, [options.packageName]);
44
+ yield XtsFileLaneUtils_1.default.zipProject([buildPath], filePath, [options.packageName]);
45
45
  }
46
46
  catch (err) {
47
- ColorConsole_1.default.throw(`${err.message}`);
47
+ shared_utils_1.ColorConsole.throw(`${err.message}`);
48
48
  }
49
49
  });
50
50
  }
@@ -57,8 +57,8 @@ class XtsFollowWorks {
57
57
  * @param context
58
58
  */
59
59
  static zipDistributedQuickApp(context) {
60
- var _a, _b;
61
60
  return __awaiter(this, void 0, void 0, function* () {
61
+ var _a, _b;
62
62
  const deviceList = [
63
63
  {
64
64
  device: 'phone',
@@ -115,13 +115,13 @@ class XtsFollowWorks {
115
115
  const buildPaths = item.aspectList.map((name) => path_1.default.join(projectPath, output, name));
116
116
  const filePath = XtsFollowWorks.getFilePath(projectPath, 'dist', item.device);
117
117
  try {
118
- yield FileLaneUtil_1.default.zipProject(buildPaths, filePath);
118
+ yield XtsFileLaneUtils_1.default.zipProject(buildPaths, filePath);
119
119
  }
120
120
  catch (error) { }
121
121
  }
122
122
  }
123
123
  else {
124
- ColorConsole_1.default.throw('not find manifest.json');
124
+ shared_utils_1.ColorConsole.throw('not find manifest.json');
125
125
  }
126
126
  });
127
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.2-dev.7",
3
+ "version": "2.0.2",
4
4
  "description": "The process tool for packaging aiot projects.",
5
5
  "keywords": [
6
6
  "aiotpack"
@@ -19,23 +19,31 @@
19
19
  "test": "node ./__tests__/aiotpack.test.js"
20
20
  },
21
21
  "dependencies": {
22
- "@aiot-toolkit/generator": "2.0.2-dev.7",
23
- "@aiot-toolkit/parser": "2.0.2-dev.7",
22
+ "@aiot-toolkit/generator": "2.0.2",
23
+ "@aiot-toolkit/parser": "2.0.2",
24
+ "@aiot-toolkit/shared-utils": "2.0.2",
24
25
  "@hap-toolkit/aaptjs": "^2.0.0",
26
+ "@rspack/core": "^1.0.0",
27
+ "aiot-parse5": "^1.0.0",
28
+ "archiver": "^7.0.1",
25
29
  "babel-loader": "^9.1.3",
26
- "del": "^4.1.0",
27
30
  "fast-glob": "^3.3.2",
28
- "file-lane": "2.0.2-dev.7",
31
+ "file-lane": "2.0.2",
29
32
  "file-loader": "^6.2.0",
30
33
  "fs-extra": "^11.2.0",
31
- "jsrsasign": "^7.2.2",
34
+ "jsrsasign": "^11.1.0",
32
35
  "jszip": "^3.10.1",
36
+ "lodash": "^4.17.21",
37
+ "ts-morph": "^19.0.0",
33
38
  "url-loader": "^4.1.1",
34
- "webpack": "^5.89.0",
39
+ "webpack-bundle-analyzer": "^4.10.2",
35
40
  "webpack-sources": "^3.2.3"
36
41
  },
37
42
  "devDependencies": {
43
+ "@types/archiver": "^6.0.2",
44
+ "@types/fs-extra": "^11.0.4",
38
45
  "@types/jsrsasign": "^10.5.12",
39
46
  "@types/webpack-sources": "^3.2.3"
40
- }
47
+ },
48
+ "gitHead": "8ca4bf2ed7bcf11911e5c514696951bdba4fc12d"
41
49
  }
@@ -1,3 +0,0 @@
1
- import { LoaderContext } from 'webpack';
2
- declare function splitMap(this: LoaderContext<any>, source: string, map: any): void;
3
- export default splitMap;
@@ -1,22 +0,0 @@
1
- import { IFileLaneContext } from 'file-lane';
2
- import { PreWork } from 'file-lane/lib/interface/IFileLaneConfig';
3
- import IJavascriptCompileOption from '../compiler/javascript/interface/IJavascriptCompileOption';
4
- /**
5
- * PreWorkUtils
6
- */
7
- declare class PreWorkUtils {
8
- /**
9
- * 获取ux项目的路由入口
10
- * @param context
11
- * @param fileList
12
- * @returns
13
- */
14
- static getEntries(context: IFileLaneContext): Promise<void>;
15
- static clean: PreWork<IJavascriptCompileOption>;
16
- /**
17
- * 获取项目的全局样式变量配置
18
- * @param context
19
- */
20
- static getGlobalVar(context: IFileLaneContext): Promise<void>;
21
- }
22
- export default PreWorkUtils;
@@ -1,106 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- var _a;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
17
- const del_1 = __importDefault(require("del"));
18
- const fs_extra_1 = __importDefault(require("fs-extra"));
19
- const path_1 = __importDefault(require("path"));
20
- const TranslateCache_1 = __importDefault(require("../../../parser/lib/ux/translate/vela/TranslateCache"));
21
- const UxFileUtils_1 = __importDefault(require("./ux/UxFileUtils"));
22
- const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
23
- /**
24
- * PreWorkUtils
25
- */
26
- class PreWorkUtils {
27
- /**
28
- * 获取ux项目的路由入口
29
- * @param context
30
- * @param fileList
31
- * @returns
32
- */
33
- static getEntries(context) {
34
- const { projectPath } = context;
35
- const srcPath = path_1.default.join(projectPath, 'src');
36
- // 判断路径是否真实存在
37
- const manifestContent = UxFileUtils_1.default.getMainfestInfo(projectPath);
38
- // 存储entries
39
- let entryList = [];
40
- if (manifestContent) {
41
- const { router } = manifestContent;
42
- if (!router) {
43
- // 没有router配置
44
- ColorConsole_1.default.throw(`### manifest ### No router configuration`);
45
- }
46
- const { pages } = router;
47
- if (!pages) {
48
- // 没有pages配置
49
- ColorConsole_1.default.throw(`### manifest ### No pages configuration`);
50
- }
51
- Object.keys(pages).map((page) => {
52
- const pageContent = pages[page];
53
- const entryDir = path_1.default.join(srcPath, page);
54
- const entryPage = path_1.default.join(entryDir, `${pageContent.component}.ux`);
55
- if (fs_extra_1.default.existsSync(entryPage)) {
56
- entryList.push(entryPage);
57
- }
58
- else {
59
- // 路径不存在
60
- ColorConsole_1.default.throw(`### manifest ### path '${entryPage}' does not exist`);
61
- }
62
- });
63
- context['entries'] = entryList;
64
- return Promise.resolve();
65
- }
66
- else {
67
- // manifest.json文件无有效内容
68
- ColorConsole_1.default.error(`### manifest ### File has no valid content`);
69
- return Promise.reject();
70
- }
71
- }
72
- /**
73
- * 获取项目的全局样式变量配置
74
- * @param context
75
- */
76
- static getGlobalVar(context) {
77
- const { projectPath } = context;
78
- const filePath = path_1.default.join(projectPath, 'src', 'globalVar.json');
79
- let globalVar = {};
80
- // 判断文件是否存在
81
- if (fs_extra_1.default.existsSync(filePath)) {
82
- // 存在则取内容,否则内容为空
83
- globalVar = fs_extra_1.default.readJSONSync(filePath);
84
- }
85
- context.globalVar = globalVar;
86
- return Promise.resolve();
87
- }
88
- }
89
- _a = PreWorkUtils;
90
- PreWorkUtils.clean = (context, _, config, compileOption) => __awaiter(void 0, void 0, void 0, function* () {
91
- yield (0, del_1.default)(path_1.default.join(context.projectPath, context.output));
92
- if (compileOption) {
93
- yield (0, del_1.default)(path_1.default.join(compileOption.projectPath, compileOption.outputPath));
94
- yield (0, del_1.default)(path_1.default.join(compileOption.projectPath, compileOption.releasePath));
95
- yield (0, del_1.default)(path_1.default.join(context.projectPath, compileOption.outputPath));
96
- yield (0, del_1.default)(path_1.default.join(context.projectPath, compileOption.releasePath));
97
- }
98
- TranslateCache_1.default.featureCache.clear();
99
- BinaryPlugin.reset();
100
- BinaryPlugin.config = {
101
- projectPath: context.projectPath,
102
- source: compileOption === null || compileOption === void 0 ? void 0 : compileOption.sourceRoot,
103
- output: compileOption === null || compileOption === void 0 ? void 0 : compileOption.outputPath
104
- };
105
- });
106
- exports.default = PreWorkUtils;