@aiot-toolkit/aiotpack 2.0.1-alpha.9 → 2.0.2-beta.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 (113) hide show
  1. package/lib/compiler/enum/CompileMode.js +0 -2
  2. package/lib/compiler/interface/ICompileParam.js +0 -2
  3. package/lib/compiler/interface/ICompiler.js +0 -2
  4. package/lib/compiler/interface/ISignConfig.js +0 -2
  5. package/lib/compiler/javascript/JavascriptCompiler.d.ts +1 -1
  6. package/lib/compiler/javascript/JavascriptCompiler.js +51 -18
  7. package/lib/compiler/javascript/JavascriptDefaultCompileOption.d.ts +1 -0
  8. package/lib/compiler/javascript/JavascriptDefaultCompileOption.js +5 -3
  9. package/lib/compiler/javascript/interface/IJavascriptCompileOption.d.ts +8 -4
  10. package/lib/compiler/javascript/interface/IJavascriptCompileOption.js +0 -2
  11. package/lib/compiler/javascript/interface/IWebpackConfigurator.js +0 -2
  12. package/lib/compiler/javascript/vela/VelaWebpackConfigurator.d.ts +1 -2
  13. package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js +0 -5
  14. package/lib/compiler/javascript/vela/enum/BuildNameFormatType.js +0 -2
  15. package/lib/compiler/javascript/vela/enum/EntryType.js +0 -2
  16. package/lib/compiler/javascript/vela/interface/IChunk.js +0 -2
  17. package/lib/compiler/javascript/vela/interface/IManifest.d.ts +3 -0
  18. package/lib/compiler/javascript/vela/interface/IManifest.js +0 -2
  19. package/lib/compiler/javascript/vela/interface/IQuickAppConfig.js +0 -2
  20. package/lib/compiler/javascript/vela/model/Package.js +2 -4
  21. package/lib/compiler/javascript/vela/plugin/WrapPlugin.d.ts +0 -1
  22. package/lib/compiler/javascript/vela/plugin/WrapPlugin.js +19 -24
  23. package/lib/compiler/javascript/vela/utils/Jsc.d.ts +1 -1
  24. package/lib/compiler/javascript/vela/utils/Jsc.js +4 -7
  25. package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +2 -4
  26. package/lib/compiler/javascript/vela/utils/ZipUtil.js +5 -7
  27. package/lib/compiler/javascript/vela/utils/signature/Base64.js +0 -2
  28. package/lib/compiler/javascript/vela/utils/signature/CRC32.js +0 -2
  29. package/lib/compiler/javascript/vela/utils/signature/SignUtil.d.ts +1 -1
  30. package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +14 -12
  31. package/lib/compiler/javascript/vela/utils/signature/Signer.js +0 -2
  32. package/lib/compiler/javascript/vela/utils/webpackLoader/addColSourceMap.d.ts +3 -0
  33. package/lib/compiler/javascript/vela/utils/webpackLoader/addColSourceMap.js +58 -0
  34. package/lib/compiler/javascript/vela/utils/webpackLoader/splitMap.d.ts +3 -0
  35. package/lib/compiler/javascript/vela/utils/webpackLoader/splitMap.js +20 -0
  36. package/lib/config/UxConfig.d.ts +7 -4
  37. package/lib/config/UxConfig.js +44 -12
  38. package/lib/config/XtsConfig.d.ts +3 -1
  39. package/lib/config/XtsConfig.js +11 -3
  40. package/lib/{utils → followWorks}/ux/UxFollowWorks.d.ts +1 -0
  41. package/lib/{utils → followWorks}/ux/UxFollowWorks.js +72 -14
  42. package/lib/followWorks/xts/entryTemplate.d.ts +2 -2
  43. package/lib/followWorks/xts/entryTemplate.js +61 -44
  44. package/lib/followWorks/xts/generateRpk.js +1 -3
  45. package/lib/followWorks/xts/ts2wasm.js +3 -14
  46. package/lib/index.js +0 -2
  47. package/lib/interface/ICompileOptions.d.ts +1 -1
  48. package/lib/interface/ICompileOptions.js +1 -3
  49. package/lib/interface/IDeviceList.js +0 -2
  50. package/lib/loader/ux/AppUxLoader.d.ts +2 -0
  51. package/lib/loader/ux/AppUxLoader.js +1 -3
  52. package/lib/loader/ux/JsLoader.d.ts +9 -0
  53. package/lib/loader/ux/JsLoader.js +39 -0
  54. package/lib/loader/ux/PngLoader.js +4 -9
  55. package/lib/loader/ux/UxLoader.d.ts +2 -0
  56. package/lib/loader/ux/UxLoader.js +15 -4
  57. package/lib/loader/xts/XtsLoader.js +3 -9
  58. package/lib/preWorks/ux/UxPreWorks.d.ts +10 -0
  59. package/lib/preWorks/ux/UxPreWorks.js +31 -0
  60. package/lib/preWorks/xts/preInstall.js +4 -12
  61. package/lib/utils/PngUtils.js +0 -2
  62. package/lib/utils/PreWorkUtils.d.ts +5 -0
  63. package/lib/utils/PreWorkUtils.js +40 -9
  64. package/lib/utils/ux/ManifestSchema.d.ts +3 -0
  65. package/lib/utils/ux/ManifestSchema.js +207 -0
  66. package/lib/utils/ux/UxFileUtils.d.ts +21 -4
  67. package/lib/utils/ux/UxFileUtils.js +74 -5
  68. package/lib/utils/ux/UxLoaderUtils.d.ts +11 -7
  69. package/lib/utils/ux/UxLoaderUtils.js +119 -33
  70. package/lib/utils/xts/XtsFollowWorks.js +3 -12
  71. package/package.json +6 -10
  72. package/lib/compiler/enum/CompileMode.js.map +0 -1
  73. package/lib/compiler/interface/ICompileParam.js.map +0 -1
  74. package/lib/compiler/interface/ICompiler.js.map +0 -1
  75. package/lib/compiler/interface/ISignConfig.js.map +0 -1
  76. package/lib/compiler/javascript/JavascriptCompiler.js.map +0 -1
  77. package/lib/compiler/javascript/JavascriptDefaultCompileOption.js.map +0 -1
  78. package/lib/compiler/javascript/interface/IJavascriptCompileOption.js.map +0 -1
  79. package/lib/compiler/javascript/interface/IWebpackConfigurator.js.map +0 -1
  80. package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js.map +0 -1
  81. package/lib/compiler/javascript/vela/enum/BuildNameFormatType.js.map +0 -1
  82. package/lib/compiler/javascript/vela/enum/EntryType.js.map +0 -1
  83. package/lib/compiler/javascript/vela/interface/IChunk.js.map +0 -1
  84. package/lib/compiler/javascript/vela/interface/IManifest.js.map +0 -1
  85. package/lib/compiler/javascript/vela/interface/IQuickAppConfig.js.map +0 -1
  86. package/lib/compiler/javascript/vela/model/Package.js.map +0 -1
  87. package/lib/compiler/javascript/vela/plugin/WrapPlugin.js.map +0 -1
  88. package/lib/compiler/javascript/vela/utils/Jsc.js.map +0 -1
  89. package/lib/compiler/javascript/vela/utils/UxCompileUtil.js.map +0 -1
  90. package/lib/compiler/javascript/vela/utils/ZipUtil.js.map +0 -1
  91. package/lib/compiler/javascript/vela/utils/signature/Base64.js.map +0 -1
  92. package/lib/compiler/javascript/vela/utils/signature/CRC32.js.map +0 -1
  93. package/lib/compiler/javascript/vela/utils/signature/SignUtil.js.map +0 -1
  94. package/lib/compiler/javascript/vela/utils/signature/Signer.js.map +0 -1
  95. package/lib/config/UxConfig.js.map +0 -1
  96. package/lib/config/XtsConfig.js.map +0 -1
  97. package/lib/followWorks/xts/entryTemplate.js.map +0 -1
  98. package/lib/followWorks/xts/generateRpk.js.map +0 -1
  99. package/lib/followWorks/xts/ts2wasm.js.map +0 -1
  100. package/lib/index.js.map +0 -1
  101. package/lib/interface/ICompileOptions.js.map +0 -1
  102. package/lib/interface/IDeviceList.js.map +0 -1
  103. package/lib/loader/ux/AppUxLoader.js.map +0 -1
  104. package/lib/loader/ux/PngLoader.js.map +0 -1
  105. package/lib/loader/ux/UxLoader.js.map +0 -1
  106. package/lib/loader/xts/XtsLoader.js.map +0 -1
  107. package/lib/preWorks/xts/preInstall.js.map +0 -1
  108. package/lib/utils/PngUtils.js.map +0 -1
  109. package/lib/utils/PreWorkUtils.js.map +0 -1
  110. package/lib/utils/ux/UxFileUtils.js.map +0 -1
  111. package/lib/utils/ux/UxFollowWorks.js.map +0 -1
  112. package/lib/utils/ux/UxLoaderUtils.js.map +0 -1
  113. package/lib/utils/xts/XtsFollowWorks.js.map +0 -1
@@ -3,11 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UxFileUtils = void 0;
7
+ const shared_utils_1 = require("@aiot-toolkit/shared-utils");
8
+ const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
9
+ const CommonUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/CommonUtil"));
6
10
  const fs_extra_1 = __importDefault(require("fs-extra"));
7
11
  const path_1 = __importDefault(require("path"));
8
- /**
9
- * FileUtils
10
- */
12
+ const ManifestSchema_1 = __importDefault(require("./ManifestSchema"));
11
13
  class UxFileUtils {
12
14
  /**
13
15
  * 获取manifest.json路径
@@ -27,8 +29,75 @@ class UxFileUtils {
27
29
  static getMainfestInfo(projectPath, sourceRoot = 'src') {
28
30
  return fs_extra_1.default.readJSONSync(UxFileUtils.getManifestFilePath(projectPath, sourceRoot));
29
31
  }
32
+ /**
33
+ * 检查 manifest文件,并显示错误信息
34
+ *
35
+ * 1. TypeError,使用Error 样式
36
+ * 2. 其它错误,使用 Warn 样式
37
+ * 3. 如果存在TypeError,则终止程序
38
+ *
39
+ * @param projectPath 项目路径
40
+ * @param sourceRoot 源码路径--相对项目根目录
41
+ * @returns
42
+ */
43
+ static validateManifest(projectPath, sourceRoot = 'src') {
44
+ const path = UxFileUtils.getManifestFilePath(projectPath, sourceRoot);
45
+ if (!fs_extra_1.default.existsSync(path)) {
46
+ ColorConsole_1.default.throw(`file is missing`, {
47
+ word: path,
48
+ style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Throw)
49
+ });
50
+ }
51
+ const jsonData = this.getMainfestInfo(projectPath, sourceRoot);
52
+ const schema = ManifestSchema_1.default;
53
+ const errors = CommonUtil_1.default.validateJson(jsonData, schema);
54
+ if (errors) {
55
+ ColorConsole_1.default.warn(`Manefest.json error: `, ...errors.map((item, index) => {
56
+ return {
57
+ word: `\r\n${index + 1}. ${item.message}`,
58
+ style: item instanceof TypeError
59
+ ? ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Error)
60
+ : ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Warn)
61
+ };
62
+ }));
63
+ const stop = Boolean(errors.find((item) => item instanceof TypeError));
64
+ if (stop) {
65
+ ColorConsole_1.default.throw({
66
+ word: `missing required content, program stoped`,
67
+ style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Throw)
68
+ });
69
+ }
70
+ }
71
+ return errors;
72
+ }
73
+ /**
74
+ * 检查 sitemap.json 文件,并显示错误信息
75
+ *
76
+ * 1. 当sitemap.json的 rules 中配置的page 不存在于 manifest.json 中时,报错并终止程序
77
+ * @param projectPath
78
+ * @param sourceRoot
79
+ */
80
+ static validateSitemap(projectPath, sourceRoot = 'src') {
81
+ const sitemapPath = path_1.default.join(projectPath, sourceRoot, 'sitemap.json');
82
+ if (fs_extra_1.default.existsSync(sitemapPath)) {
83
+ try {
84
+ const rules = fs_extra_1.default.readJSONSync(sitemapPath).rules;
85
+ const manifest = this.getMainfestInfo(projectPath, sourceRoot);
86
+ const pages = Object.keys(manifest.router.pages || {});
87
+ rules.forEach((item, index) => {
88
+ const page = item.page;
89
+ if (page !== '*' && !pages.includes(page)) {
90
+ ColorConsole_1.default.throw(`The ${index + 1}th item of sitemap rules is configured incorrectly, the page ${page} does not exist`);
91
+ }
92
+ return page;
93
+ });
94
+ }
95
+ catch (error) {
96
+ ColorConsole_1.default.warn(error === null || error === void 0 ? void 0 : error.toString());
97
+ }
98
+ }
99
+ }
30
100
  }
101
+ exports.UxFileUtils = UxFileUtils;
31
102
  UxFileUtils.CONFIG_FILE_NAME = 'manifest.json';
32
103
  exports.default = UxFileUtils;
33
-
34
- //# sourceMappingURL=UxFileUtils.js.map
@@ -1,5 +1,7 @@
1
+ import { ILog } from '@aiot-toolkit/shared-utils';
1
2
  import { IFileLaneContext, IFileParam } from 'file-lane';
2
3
  import { SourceFile } from 'ts-morph';
4
+ import IJavascriptCompileOption from '../../compiler/javascript/interface/IJavascriptCompileOption';
3
5
  /**
4
6
  * UxLoaderUtils
5
7
  */
@@ -12,17 +14,17 @@ declare class UxLoaderUtils {
12
14
  * @param project
13
15
  * @returns
14
16
  */
15
- static compileUxToJavascript(file: IFileParam, context: IFileLaneContext, isAppUx: boolean): Promise<{
16
- path: string;
17
- content: string;
18
- }[]>;
17
+ static compileUxToJavascript(file: IFileParam, context: IFileLaneContext, isAppUx: boolean, compilerOption: IJavascriptCompileOption): Promise<{
18
+ files: IFileParam[];
19
+ logs: ILog[];
20
+ }>;
19
21
  /**
20
22
  * 转换app.ux文件为js文件
21
23
  * @param file
22
24
  * @param resultFiles
23
25
  * @param context
24
26
  */
25
- static compileAppUxToJavascript(file: IFileParam, resultFiles: IFileParam[], context: IFileLaneContext): Promise<void>;
27
+ static compileAppUxToJavascript(file: IFileParam, resultFiles: IFileParam[], context: IFileLaneContext, compileOption: IJavascriptCompileOption): Promise<void>;
26
28
  /**
27
29
  * 判断是否为src/app.ux
28
30
  * @param filePath
@@ -42,12 +44,14 @@ declare class UxLoaderUtils {
42
44
  * @returns
43
45
  */
44
46
  static getAppUxContent(fileContent: string): string;
47
+ private static addTemplateProtobuf;
45
48
  /**
46
49
  * 给template增加外层包裹内容
47
50
  * @param templateTree
48
51
  * @returns
49
52
  */
50
- static wrapTempalte(templateTree: SourceFile): string;
53
+ static wrapTempalte(templateTree: SourceFile, file: IFileParam, compilerOption: IJavascriptCompileOption): string;
54
+ private static wrapStyle;
51
55
  /**
52
56
  * 给script增加外层包裹内容
53
57
  * @param isPageUx
@@ -55,6 +59,6 @@ declare class UxLoaderUtils {
55
59
  * @returns
56
60
  */
57
61
  static handleScriptContent(isPageUx: boolean, appScriptTree: SourceFile): string;
58
- static getReturnType(isPageUx: boolean): "$app_exports$['entry'] =" | "return";
62
+ static getReturnType(isPageUx: boolean): "$app_exports$['entry'] =" | "module.exports = ";
59
63
  }
60
64
  export default UxLoaderUtils;
@@ -38,12 +38,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  const generator_1 = require("@aiot-toolkit/generator");
39
39
  const UxParser_1 = __importDefault(require("@aiot-toolkit/parser/lib/ux/parser/UxParser"));
40
40
  const UxToTypescript_1 = __importDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/UxToTypescript"));
41
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
42
41
  const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
43
42
  const FileUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/FileUtil"));
43
+ const StringUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/StringUtil"));
44
44
  const parse5 = __importStar(require("parse5"));
45
45
  const path_1 = __importDefault(require("path"));
46
46
  const ts_morph_1 = require("ts-morph");
47
+ const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
48
+ const { extractFunctions } = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/protobufControl');
47
49
  /**
48
50
  * UxLoaderUtils
49
51
  */
@@ -55,9 +57,10 @@ class UxLoaderUtils {
55
57
  * @param project
56
58
  * @returns
57
59
  */
58
- static compileUxToJavascript(file, context, isAppUx) {
60
+ static compileUxToJavascript(file, context, isAppUx, compilerOption) {
59
61
  return __awaiter(this, void 0, void 0, function* () {
60
62
  const project = new ts_morph_1.Project();
63
+ const logs = [];
61
64
  const { path: filePath, content } = file;
62
65
  const { name, ext } = path_1.default.parse(filePath);
63
66
  const fullName = `${name}${ext}`;
@@ -65,29 +68,34 @@ class UxLoaderUtils {
65
68
  const newFileName = `${name}.js`;
66
69
  //判断文本,空文本则结束该文件处理
67
70
  if (!content) {
68
- ColorConsole_1.default.log({
69
- level: shared_utils_1.LOG_LEVEL.Warn,
70
- message: `【compileUxToJavascript】the file '${fullName}' under the path '${filePath}' has no content `
71
- });
72
- return [];
71
+ ColorConsole_1.default.warn(`The file '${fullName}' under the path '${filePath}' has no content `);
72
+ return {
73
+ files: [],
74
+ logs
75
+ };
73
76
  }
74
77
  // 配置转换参数
75
78
  const options = {
76
79
  projectPath: context.projectPath,
77
- filePath
80
+ filePath,
81
+ onLog: (log) => {
82
+ logs.push(log);
83
+ }
78
84
  };
79
85
  // 开始转换
80
- const parserResult = yield new UxParser_1.default(options).parser(content, fullName);
86
+ const globalVar = ('globalVar' in context && context.globalVar) || {};
87
+ const parserResult = yield new UxParser_1.default(options, globalVar).parser(content.toString(), fullName);
81
88
  // 区分app.ux和一般ux
82
89
  // app.ux解析结果中加上manifest.json的内容
83
90
  const manifestJson = `require('./manifest.json')`;
84
91
  // 区分页面组件和子组件
85
92
  const isPageUx = UxLoaderUtils.isPageUx(context, filePath);
86
93
  const integrateFunction = (appImport, appStyleTree, appTemplateTree, appScriptTree) => {
94
+ // script代码放在第三个位置不能变化,影响更新source map
87
95
  return isAppUx
88
96
  ? [
89
97
  `${appImport.join('\n')}`,
90
- `var $app_style$ = ${JSON.stringify(appStyleTree)}`,
98
+ `var $app_style$ = ${UxLoaderUtils.wrapStyle(StringUtil_1.default.arrayTostring(appStyleTree, true), file, compilerOption)}`,
91
99
  `var $app_script$ = ${UxLoaderUtils.handleScriptContent(false, appScriptTree)}\n`,
92
100
  `$app_script$({}, $app_exports$, $app_require$);\n\n`,
93
101
  `$app_exports$.default.style = $app_style$;`,
@@ -95,9 +103,9 @@ class UxLoaderUtils {
95
103
  ]
96
104
  : [
97
105
  `${appImport.join('\n')}`,
98
- `var $app_style$ = ${JSON.stringify(appStyleTree)}\n`,
106
+ `var $app_style$ = ${UxLoaderUtils.wrapStyle(StringUtil_1.default.arrayTostring(appStyleTree, true), file, compilerOption)}\n`,
99
107
  `var $app_script$ = ${UxLoaderUtils.handleScriptContent(isPageUx, appScriptTree)}`,
100
- `var $app_template$ = ${UxLoaderUtils.wrapTempalte(appTemplateTree)}\n`,
108
+ `var $app_template$ = ${UxLoaderUtils.wrapTempalte(appTemplateTree, file, compilerOption)}\n`,
101
109
  `${UxLoaderUtils.getReturnType(isPageUx)} function ($app_exports$) {`,
102
110
  `$app_script$({}, $app_exports$, $app_require$);`,
103
111
  `$app_exports$.default.template = $app_template$;`,
@@ -105,24 +113,27 @@ class UxLoaderUtils {
105
113
  `}`
106
114
  ];
107
115
  };
108
- const { targetTree, mapList } = new UxToTypescript_1.default(options, project, integrateFunction).translate(parserResult.ast, []);
109
- const { code, sourcemap } = new generator_1.TypescriptGenerator().generate({
116
+ const { targetTree, mapList, sourceMap } = yield new UxToTypescript_1.default(options, project, integrateFunction, compilerOption).translate(parserResult.ast, []);
117
+ const { code } = new generator_1.TypescriptGenerator().generate({
110
118
  sourceFilePath: fullName,
111
119
  targetFilePath: newFileName,
112
120
  ast: targetTree,
113
121
  mapList
114
122
  });
115
123
  // 返回转换后的文件内容以及map内容
116
- return [
117
- {
118
- path: FileUtil_1.default.updatePath(filePath, newFileName),
119
- content: code
120
- },
121
- {
122
- path: FileUtil_1.default.updatePath(filePath, `${name}.map.js`),
123
- content: sourcemap
124
- }
125
- ];
124
+ return {
125
+ files: [
126
+ {
127
+ path: FileUtil_1.default.updatePath(filePath, newFileName),
128
+ content: code
129
+ },
130
+ {
131
+ path: FileUtil_1.default.updatePath(filePath, `${name}.js.map`),
132
+ content: sourceMap.toString()
133
+ }
134
+ ],
135
+ logs
136
+ };
126
137
  });
127
138
  }
128
139
  /**
@@ -131,7 +142,7 @@ class UxLoaderUtils {
131
142
  * @param resultFiles
132
143
  * @param context
133
144
  */
134
- static compileAppUxToJavascript(file, resultFiles, context) {
145
+ static compileAppUxToJavascript(file, resultFiles, context, compileOption) {
135
146
  return __awaiter(this, void 0, void 0, function* () {
136
147
  const { path: filePath, content } = file;
137
148
  let appContent = content;
@@ -141,8 +152,8 @@ class UxLoaderUtils {
141
152
  appContent = UxLoaderUtils.getAppUxContent(content);
142
153
  }
143
154
  // 解析script和style两部分
144
- const compileFiles = yield UxLoaderUtils.compileUxToJavascript({ path: filePath, content: appContent }, context, isAppUx);
145
- resultFiles.push(...compileFiles);
155
+ const compileResult = yield UxLoaderUtils.compileUxToJavascript({ path: filePath, content: appContent }, context, isAppUx, compileOption);
156
+ resultFiles.push(...compileResult.files);
146
157
  });
147
158
  }
148
159
  /**
@@ -184,16 +195,93 @@ class UxLoaderUtils {
184
195
  }
185
196
  return parse5.serialize(parentNode);
186
197
  }
198
+ static addTemplateProtobuf(file, code) {
199
+ const funToString = (fun) => {
200
+ const { aiotfor, aiotcb } = fun;
201
+ // 如果aiotfor存在,需要把函数体替换为aiotfor.funcArr
202
+ if (aiotfor) {
203
+ const { funcArr = [], key, value } = aiotfor;
204
+ const forFun = `function(${key || '$idx'}, ${value || '$item'}) {
205
+ return [
206
+ ${funcArr.map((item) => funToString(item)).join(',\r\n')}
207
+ ]
208
+ }`;
209
+ return forFun;
210
+ }
211
+ if (aiotcb) {
212
+ const { funcArr = [] } = aiotcb;
213
+ const cbFun = `function($data){
214
+ return [
215
+ ${funcArr.map((item) => funToString(item)).join(',\r\n')}
216
+ ]
217
+ }`;
218
+ return cbFun;
219
+ }
220
+ return fun.toString();
221
+ };
222
+ const stringifyObjectWithFunctions = (obj) => {
223
+ const processValue = (value) => {
224
+ if (typeof value === 'function') {
225
+ return value.toString();
226
+ }
227
+ else if (typeof value === 'object' && value !== null) {
228
+ return stringifyObjectWithFunctions(value);
229
+ }
230
+ else {
231
+ return JSON.stringify(value, undefined, 2);
232
+ }
233
+ };
234
+ const entries = Object.entries(obj).map(([key, value]) => {
235
+ return `"${key}": ${processValue(value)}`;
236
+ });
237
+ return `{
238
+ ${entries.join(',\r\n ')}
239
+ }`;
240
+ };
241
+ const { path } = file;
242
+ const aiot = extractFunctions(code);
243
+ const { funcArr = [], optArr } = aiot;
244
+ const templateResult = BinaryPlugin.addTemplate(path, path, code);
245
+ BinaryPlugin.addTagName(path, path);
246
+ const result = `function (vm) {
247
+ const _vm_ = vm || this
248
+ return aiot.__cv__(
249
+ "${templateResult.name}",
250
+ ${templateResult.index},
251
+ {
252
+ __vm__:_vm_,
253
+ __func__:[
254
+ ${funcArr.map((item) => funToString(item)).join(',\r\n')}
255
+ ],
256
+ __optsArr__:[
257
+ ${optArr.map((item) => stringifyObjectWithFunctions(item))},
258
+ ]
259
+ }
260
+ )
261
+ }`;
262
+ return result;
263
+ }
187
264
  /**
188
265
  * 给template增加外层包裹内容
189
266
  * @param templateTree
190
267
  * @returns
191
268
  */
192
- static wrapTempalte(templateTree) {
193
- return `function (vm) {
269
+ static wrapTempalte(templateTree, file, compilerOption) {
270
+ const result = `function (vm) {
194
271
  const _vm_ = vm || this
195
272
  return ${templateTree.getFullText()}
196
273
  }`;
274
+ if (compilerOption.enableProtobuf) {
275
+ return this.addTemplateProtobuf(file, result);
276
+ }
277
+ return result;
278
+ }
279
+ static wrapStyle(code, file, compilerOption) {
280
+ if (compilerOption.enableProtobuf) {
281
+ const result = BinaryPlugin.addStyle(file.path, file.path, code);
282
+ return `['${result.name}', ${result.index}]`;
283
+ }
284
+ return code;
197
285
  }
198
286
  /**
199
287
  * 给script增加外层包裹内容
@@ -206,10 +294,10 @@ class UxLoaderUtils {
206
294
  // 页面组件添加ViewModel处理代码
207
295
  appScriptTree.addStatements(UxLoaderUtils.contenAccess);
208
296
  }
209
- return `function __scriptModule__(module, exports, $app_require$) {\t${appScriptTree.getFullText()}}`;
297
+ return `function __scriptModule__(module, exports, $app_require$) {\t${appScriptTree.getFullText()}\n}`;
210
298
  }
211
299
  static getReturnType(isPageUx) {
212
- return isPageUx ? `$app_exports$['entry'] =` : 'return';
300
+ return isPageUx ? `$app_exports$['entry'] =` : 'module.exports = ';
213
301
  }
214
302
  }
215
303
  // 页面组件需要添加ViewModel数据校验和处理代码
@@ -237,5 +325,3 @@ UxLoaderUtils.contenAccess = `\n
237
325
  })
238
326
  }`;
239
327
  exports.default = UxLoaderUtils;
240
-
241
- //# sourceMappingURL=UxLoaderUtils.js.map
@@ -12,7 +12,6 @@ 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 shared_utils_1 = require("@aiot-toolkit/shared-utils");
16
15
  const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
17
16
  const FileLaneUtil_1 = __importDefault(require("file-lane/lib/utils/FileLaneUtil"));
18
17
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -34,10 +33,7 @@ class XtsFollowWorks {
34
33
  const zipPath = path_1.default.join(projectPath, 'dist');
35
34
  // buildPath必须是真实文件夹路径
36
35
  if (!fs_extra_1.default.existsSync(buildPath)) {
37
- ColorConsole_1.default.log({
38
- level: shared_utils_1.LOG_LEVEL.Error,
39
- message: `XtsConfig follwWorkers zip build error, buildPath not exist`
40
- });
36
+ ColorConsole_1.default.throw(`buildPath: '${buildPath}' not exist`);
41
37
  }
42
38
  try {
43
39
  // 确认文件夹是否存在,不存在则创建
@@ -48,7 +44,7 @@ class XtsFollowWorks {
48
44
  yield FileLaneUtil_1.default.zipProject([buildPath], filePath, [options.packageName]);
49
45
  }
50
46
  catch (err) {
51
- ColorConsole_1.default.log({ level: shared_utils_1.LOG_LEVEL.Error, message: err.message });
47
+ ColorConsole_1.default.throw(`${err.message}`);
52
48
  }
53
49
  });
54
50
  }
@@ -125,10 +121,7 @@ class XtsFollowWorks {
125
121
  }
126
122
  }
127
123
  else {
128
- ColorConsole_1.default.log({
129
- level: shared_utils_1.LOG_LEVEL.Error,
130
- message: 'zip DistributedQuickApp not find manifest.json'
131
- });
124
+ ColorConsole_1.default.throw('not find manifest.json');
132
125
  }
133
126
  });
134
127
  }
@@ -146,5 +139,3 @@ class XtsFollowWorks {
146
139
  }
147
140
  }
148
141
  exports.default = XtsFollowWorks;
149
-
150
- //# sourceMappingURL=XtsFollowWorks.js.map
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/aiotpack",
3
- "version": "2.0.1-alpha.9",
3
+ "version": "2.0.2-beta.2",
4
4
  "description": "The process tool for packaging aiot projects.",
5
5
  "keywords": [
6
6
  "aiotpack"
7
7
  ],
8
- "author": "徐俊杰 <xujunjie1@xiaomi.com>",
9
8
  "homepage": "",
10
9
  "license": "ISC",
11
10
  "main": "lib/index.js",
@@ -16,25 +15,22 @@
16
15
  "files": [
17
16
  "lib"
18
17
  ],
19
- "repository": {
20
- "type": "git",
21
- "url": "ssh://xujunjie1@git.mioffice.cn:29418/vela/aiot-toolkit"
22
- },
23
18
  "scripts": {
24
19
  "test": "node ./__tests__/aiotpack.test.js"
25
20
  },
26
21
  "dependencies": {
27
- "@aiot-toolkit/generator": "2.0.1-alpha.9",
28
- "@aiot-toolkit/parser": "2.0.1-alpha.9",
22
+ "@aiot-toolkit/generator": "2.0.2-beta.2",
23
+ "@aiot-toolkit/parser": "2.0.2-beta.2",
29
24
  "@hap-toolkit/aaptjs": "^2.0.0",
30
25
  "babel-loader": "^9.1.3",
31
26
  "del": "^4.1.0",
32
27
  "fast-glob": "^3.3.2",
33
- "file-lane": "2.0.1-alpha.9",
28
+ "file-lane": "2.0.2-beta.2",
34
29
  "file-loader": "^6.2.0",
35
30
  "fs-extra": "^11.2.0",
36
31
  "jsrsasign": "^7.2.2",
37
32
  "jszip": "^3.10.1",
33
+ "source-map": "^0.7.4",
38
34
  "url-loader": "^4.1.1",
39
35
  "webpack": "^5.89.0",
40
36
  "webpack-sources": "^3.2.3"
@@ -43,5 +39,5 @@
43
39
  "@types/jsrsasign": "^10.5.12",
44
40
  "@types/webpack-sources": "^3.2.3"
45
41
  },
46
- "gitHead": "d593999b9ca345bce8b3ba40a7d11f6685ac03b5"
42
+ "gitHead": "5226bdb0ba61daef207531c2eaaf3d034e04c50f"
47
43
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/enum/CompileMode.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,IAAK,WAUJ;AAVD,WAAK,WAAW;IACd;;OAEG;IACH,0CAA2B,CAAA;IAE3B;;OAEG;IACH,wCAAyB,CAAA;AAC3B,CAAC,EAVI,WAAW,KAAX,WAAW,QAUf;AACD,WAAU,WAAW;IACnB;;;;OAIG;IACH,SAAgB,gBAAgB,CAAC,KAAkB;QACjD,OAAO,KAAK,KAAK,WAAW,CAAC,UAAU,CAAA;IACzC,CAAC;IAFe,4BAAgB,mBAE/B,CAAA;AACH,CAAC,EATS,WAAW,KAAX,WAAW,QASpB;AACD,kBAAe,WAAW,CAAA","file":"CompileMode.js","sourcesContent":["/**\n * 编译模式枚举\n */\nenum CompileMode {\n /**\n * 开发模式\n */\n DEVELOPMENT = 'development',\n\n /**\n * 生产模式\n */\n PRODUCTION = 'production'\n}\nnamespace CompileMode {\n /**\n * 判断是否为生产模式\n * @param value\n * @returns\n */\n export function isProductionMode(value: CompileMode): boolean {\n return value === CompileMode.PRODUCTION\n }\n} \nexport default CompileMode\n"],"sourceRoot":"../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/interface/ICompileParam.ts"],"names":[],"mappings":"","file":"ICompileParam.js","sourcesContent":["import { Dictionary } from '@aiot-toolkit/shared-utils/lib/type/Type'\nimport CompileMode from '../enum/CompileMode'\n\n/**\n * 编译参数\n */\nexport default interface ICompileParam extends Dictionary<any> {\n /**\n * 项目路径\n */\n projectPath: string\n\n /**\n * 打包模式,开发环境/生产环境\n */\n mode: CompileMode\n\n platform: string\n\n /**\n * 打包来源\n *\n * cmd:命令行\n * quickapp-ide:快应用 IDE\n * 其它自定义值\n */\n originType?: string\n}\n"],"sourceRoot":"../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/interface/ICompiler.ts"],"names":[],"mappings":"","file":"ICompiler.js","sourcesContent":["import ICompileParam from \"./ICompileParam\";\n\nexport default interface ICompiler {\n compile(param: ICompileParam): Promise<void>;\n clean(param: ICompileParam): Promise<void>;\n}\n"],"sourceRoot":"../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/interface/ISignConfig.ts"],"names":[],"mappings":"","file":"ISignConfig.js","sourcesContent":["/**\n * ISignConfig\n */\nexport default interface ISignConfig {\n privatekey: Buffer\n certificate: Buffer\n}\n"],"sourceRoot":"../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/JavascriptCompiler.ts"],"names":[],"mappings":"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","file":"JavascriptCompiler.js","sourcesContent":["import ColorConsole2 from '@aiot-toolkit/shared-utils/lib/ColorConsole2'\nimport path from 'path'\nimport { Configuration, webpack } from 'webpack'\nimport ICompileParam from '../interface/ICompileParam'\nimport ICompiler from '../interface/ICompiler'\nimport IJavascriptCompileOption from './interface/IJavascriptCompileOption'\nimport IWebpackConfigurator from './interface/IWebpackConfigurator'\nimport VelaWebpackConfigurator from './vela/VelaWebpackConfigurator'\nimport UxCompileUtil from './vela/utils/UxCompileUtil'\n\nclass JavascriptCompiler implements ICompiler {\n async compile(param: IJavascriptCompileOption): Promise<void> {\n return new Promise(async (resolve, reject) => {\n this.showEnvLog(param)\n await this.clean(param)\n const config = this.createWebpackConfig(param)\n webpack(config, (error) => {\n if (error) {\n reject(error)\n } else {\n ColorConsole2.info(`webpack complete`)\n resolve()\n }\n })\n })\n }\n\n private createWebpackConfig(param: IJavascriptCompileOption): Configuration {\n const configurator = this.getConfigurator()\n if (!configurator) {\n throw new Error(`This project is not supported`)\n }\n\n configurator.param = param\n // 如果configurator有 create 函数,直接返回\n // 否则,结合configurator生成默认配置,并使用\n if (configurator.create) {\n return configurator.create()\n }\n\n const { projectPath, mode, devtool, outputPath } = param\n const buildPath = path.resolve(projectPath, outputPath)\n\n const result: Configuration = {\n context: projectPath,\n mode,\n devtool,\n output: {\n globalObject: 'window',\n filename: '[name].js',\n publicPath: './',\n path: buildPath\n },\n module: {},\n stats: {\n builtAt: false,\n entrypoints: false,\n children: false,\n chunks: false,\n chunkModules: false,\n chunkOrigins: false,\n modules: false,\n version: false,\n assets: false\n }\n }\n\n if (configurator.createEntry) {\n result.entry = configurator.createEntry()\n }\n\n if (configurator.createRules && result.module) {\n result.module.rules = configurator.createRules()\n }\n\n if (configurator.createPlugins) {\n result.plugins = configurator.createPlugins()\n }\n\n if (configurator.hook) {\n configurator.hook(result)\n }\n\n return result\n }\n\n private getConfigurator(): IWebpackConfigurator {\n return new VelaWebpackConfigurator()\n }\n\n private showEnvLog(param: ICompileParam) {\n const env = {\n NODE_PLATFORM: param.platform,\n NODE_PHASE: param.mode\n }\n\n console.log(`Configuration environment:${JSON.stringify(env)}`)\n }\n\n async clean(param: ICompileParam & IJavascriptCompileOption): Promise<void> {\n const { outputPath, releasePath, projectPath } = param\n UxCompileUtil.clean([outputPath, releasePath].map((item) => path.resolve(projectPath, item)))\n }\n}\n\nexport default JavascriptCompiler\n"],"sourceRoot":"../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/JavascriptDefaultCompileOption.ts"],"names":[],"mappings":";;;;;AAAA,4CAAmB;AACnB,gDAAuB;AAGvB,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,iCAAiC,CAAC,CAAA;AACnF,MAAM,8BAA8B,GAAsC;IACxE,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,QAAQ;IAClB,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,eAAe;IAC7B,gBAAgB;IAChB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CACvB,CAAA;AAED,kBAAe,8BAA8B,CAAA","file":"JavascriptDefaultCompileOption.js","sourcesContent":["import os from 'os'\nimport path from 'path'\nimport IJavascriptCompileOption from './interface/IJavascriptCompileOption'\n\nconst clientRecordPath = path.join(os.homedir(), 'hap-toolkit-client-records.json')\nconst JavascriptDefaultCompileOption: Partial<IJavascriptCompileOption> = {\n devtool: false,\n sourceRoot: './src',\n signRoot: './sign',\n releasePath: './dist',\n outputPath: './build',\n dataCoverage: './.nyc_output',\n clientRecordPath,\n server: { port: 8000 }\n}\n\nexport default JavascriptDefaultCompileOption\n"],"sourceRoot":"../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/interface/IJavascriptCompileOption.ts"],"names":[],"mappings":"","file":"IJavascriptCompileOption.js","sourcesContent":["import ICompileParam from '../../interface/ICompileParam'\nimport BuildNameFormatType from '../vela/enum/BuildNameFormatType'\n\nexport default interface IJavascriptCompileOption extends ICompileParam {\n devtool?: string | false\n\n /**\n * 源码根目录\n */\n sourceRoot: string\n\n /**\n * 证书签名路径\n */\n signRoot: string\n\n /**\n * 应用程序目录\n */\n releasePath: string\n\n /**\n * 输出目录\n */\n outputPath: string\n\n /**\n * 项目运行的代码覆盖率数据\n */\n dataCoverage: string\n\n clientRecordPath: string\n\n /**\n * 运行端口\n */\n server: { port: number }\n\n /**\n * 包名格式\n */\n buildNameFormat?: BuildNameFormatType\n\n /**\n * 禁用 jsc\n */\n disabledJSC?: boolean\n}\n"],"sourceRoot":"../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/interface/IWebpackConfigurator.ts"],"names":[],"mappings":"","file":"IWebpackConfigurator.js","sourcesContent":["import {\n Configuration,\n EntryObject,\n RuleSetRule,\n WebpackPluginInstance,\n} from \"webpack\";\nimport ICompileParam from \"../../interface/ICompileParam\";\n\n/**\n * webpack配置器\n *\n * 可用2种方式生成 webpack 配置\n *\n * 1. 完全自定义:仅实现 create 函数返回完整的 webpack配置\n * 2. 系统默认配置 +自定义常用属性:实现createPlugin、createEntry、createRules、hook\n */\ninterface IWebpackConfigurator {\n /**\n * 编译参数\n */\n param: ICompileParam;\n\n /**\n * 创建 webpack 完整配置\n *\n * 如实现此函数,则其它函数无效\n */\n create?(): Configuration;\n\n /**\n * 创建 webpack 的 plugins\n */\n createPlugins?(): WebpackPluginInstance[];\n\n /**\n * 创建 webpack 的 entry\n */\n createEntry?(): string | string[] | EntryObject;\n\n /**\n * 创建 webpack 的 rules\n */\n createRules?(): RuleSetRule[];\n\n /**\n * 对已有的 webpack 配置做修改\n * @param config\n */\n hook?(config: Configuration): void;\n}\n\nexport default IWebpackConfigurator;\n"],"sourceRoot":"../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/VelaWebpackConfigurator.ts"],"names":[],"mappings":";;;;;AAAA,wDAAyB;AACzB,gDAAuB;AAEvB,gFAAuD;AAIvD,qEAA4C;AAC5C,0EAAiD;AAEjD,MAAM,uBAAuB;IAG3B,aAAa;QACX,OAAO;YACL,cAAc;YACd,IAAI,oBAAU,EAAE;SACjB,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAC9C,MAAM,cAAc,GAAG,qBAAW,CAAC,mBAAmB,CACpD,IAAI,CAAC,KAAK,CAAC,WAAW,EACtB,IAAI,CAAC,KAAK,CAAC,UAAU,CACtB,CAAA;QAED,IAAI,kBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;YACjC,MAAM,MAAM,GAAG,kBAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;YAC9C,OAAO,uBAAa,CAAC,cAAc,CACjC,MAAM,EACN,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,EACrC,WAAW,CACZ,CAAA;SACF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,sCAAsC,cAAc,EAAE,CAAC,CAAA;SACxE;IACH,CAAC;IACD,WAAW;QACT,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAC9C,MAAM,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;QACrD,OAAO;YACL;gBACE,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE;oBACH;wBACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;wBACvC,OAAO,EAAE;4BACP,yCAAyC;4BACzC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;4BAC3B,cAAc,EAAE,IAAI;yBACrB;qBACF;iBACF;aACF;YACD;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;aAC/C;YACD;gBACE,IAAI,EAAE,oFAAoF;gBAC1F,GAAG,EAAE;oBACH,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;oBACrC,OAAO,EAAE;wBACP,KAAK,EAAE,CAAC;wBACR,IAAI,EAAE,qCAAqC;wBAC3C,UAAU,EAAE,GAAG;wBACf,QAAQ,EAAE,KAAK;qBAChB;iBACF;aACF;SACF,CAAA;IACH,CAAC;IAED,IAAI,CAAC,MAAqB;QACxB,cAAc;IAChB,CAAC;CACF;AAED,kBAAe,uBAAuB,CAAA","file":"VelaWebpackConfigurator.js","sourcesContent":["import fs from 'fs-extra'\nimport path from 'path'\nimport { Configuration, EntryObject, RuleSetRule, WebpackPluginInstance } from 'webpack'\nimport UxFileUtils from '../../../utils/ux/UxFileUtils'\nimport ICompileParam from '../../interface/ICompileParam'\nimport IJavascriptCompileOption from '../interface/IJavascriptCompileOption'\nimport IWebpackConfigurator from '../interface/IWebpackConfigurator'\nimport WrapPlugin from './plugin/WrapPlugin'\nimport UxCompileUtil from './utils/UxCompileUtil'\n\nclass VelaWebpackConfigurator implements IWebpackConfigurator {\n param!: ICompileParam & IJavascriptCompileOption\n\n createPlugins(): WebpackPluginInstance[] {\n return [\n // 给 入口js 添加包裹\n new WrapPlugin()\n ]\n }\n\n /**\n * 通过读取 manifest.json 生成 entry\n * @returns\n */\n createEntry(): string | EntryObject | string[] {\n const { projectPath, sourceRoot } = this.param\n const configFilePath = UxFileUtils.getManifestFilePath(\n this.param.projectPath,\n this.param.sourceRoot\n )\n\n if (fs.existsSync(configFilePath)) {\n const config = fs.readJSONSync(configFilePath)\n return UxCompileUtil.resolveEntries(\n config,\n path.resolve(projectPath, sourceRoot),\n projectPath\n )\n } else {\n throw new Error(`Configuration file does not exist: ${configFilePath}`)\n }\n }\n createRules(): RuleSetRule[] {\n const { projectPath, sourceRoot } = this.param\n const srcPath = path.resolve(projectPath, sourceRoot)\n return [\n {\n test: /\\.js$/,\n use: [\n {\n loader: require.resolve('babel-loader'),\n options: {\n // configFile: getBabelConfigJsPath(cwd),\n cwd: this.param.projectPath,\n cacheDirectory: true\n }\n }\n ]\n },\n {\n test: /\\.json$/,\n include: [path.join(srcPath, 'manifest.json')]\n },\n {\n test: /\\.(png|jpe?g|gif|svg|bmp|webp|mp4|wmv|avi|mpg|rmvb|mov|flv|otf|ttf|ttc|woff|eot)$/i,\n use: {\n loader: require.resolve('url-loader'),\n options: {\n limit: 0,\n name: `dynamicAssets/[name].[hash:8].[ext]`,\n publicPath: '/',\n esModule: false\n }\n }\n }\n ]\n }\n\n hook(config: Configuration): void {\n // todo 合并用户配置\n }\n}\n\nexport default VelaWebpackConfigurator\n"],"sourceRoot":"../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/enum/BuildNameFormatType.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,IAAK,mBAUJ;AAVD,WAAK,mBAAmB;IACtB;;OAEG;IACH,mEAAW,CAAA;IAEX;;OAEG;IACH,qEAAY,CAAA;AACd,CAAC,EAVI,mBAAmB,KAAnB,mBAAmB,QAUvB;AAED,kBAAe,mBAAmB,CAAA;AAElC,WAAU,mBAAmB;IAC3B;;OAEG;IACU,4BAAQ,GAA0B;QAC7C,mBAAmB,CAAC,OAAO;QAC3B,mBAAmB,CAAC,QAAQ;KAC7B,CAAA;IAED;;OAEG;IACH,SAAgB,QAAQ,CAAC,KAA0B;QACjD,MAAM,GAAG,GAA6C;YACpD,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,SAAS;YACxC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,UAAU;SAC3C,CAAA;QACD,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC;IANe,4BAAQ,WAMvB,CAAA;IAED,SAAgB,MAAM,CAAC,KAA0B;QAC/C,MAAM,GAAG,GAA6C;YACpD,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,yDAAyD;YACxF,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,iDAAiD;SAClF,CAAA;QACD,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC;IANe,0BAAM,SAMrB,CAAA;AACH,CAAC,EA3BS,mBAAmB,KAAnB,mBAAmB,QA2B5B","file":"BuildNameFormatType.js","sourcesContent":["/**\n * 构建名格式类型枚举\n */\nenum BuildNameFormatType {\n /**\n * 默认格式\n */\n DEFAULT = 1,\n\n /**\n * 原始格式,文件名不带版本号\n */\n ORIGINAL = 2\n}\n\nexport default BuildNameFormatType\n\nnamespace BuildNameFormatType {\n /**\n * 枚举值列表,一般用于列表显示,例如下拉框\n */\n export const ALL_LIST: BuildNameFormatType[] = [\n BuildNameFormatType.DEFAULT,\n BuildNameFormatType.ORIGINAL\n ]\n\n /**\n * 枚举值转换为字符串\n */\n export function toString(value: BuildNameFormatType) {\n const dic: { [key in BuildNameFormatType]: string } = {\n [BuildNameFormatType.DEFAULT]: 'default',\n [BuildNameFormatType.ORIGINAL]: 'original'\n }\n return dic[value] || ''\n }\n\n export function toDesc(value: BuildNameFormatType) {\n const dic: { [key in BuildNameFormatType]: string } = {\n [BuildNameFormatType.DEFAULT]: 'The format is: packageName.signaturType.version.extname',\n [BuildNameFormatType.ORIGINAL]: 'The format is: packageName.signaturType.extname'\n }\n return dic[value] || ''\n }\n}\n"],"sourceRoot":"../../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/enum/EntryType.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,IAAK,SA8BJ;AA9BD,WAAK,SAAS;IACZ;;OAEG;IACH,wBAAW,CAAA;IAEX;;OAEG;IACH,0BAAa,CAAA;IAEb;;OAEG;IACH,+BAAkB,CAAA;IAElB;;OAEG;IACH,0BAAa,CAAA;IAEb;;OAEG;IACH,4BAAe,CAAA;IAEf;;OAEG;IACH,sBAAS,CAAA;AACX,CAAC,EA9BI,SAAS,KAAT,SAAS,QA8Bb;AAED,kBAAe,SAAS,CAAA","file":"EntryType.js","sourcesContent":["/**\n * 入口类型枚举\n */\nenum EntryType {\n /**\n * 应用程序\n */\n APP = 'app',\n\n /**\n * 页面\n */\n PAGE = 'page',\n\n /**\n * 组件\n */\n COMPONENT = 'comp',\n\n /**\n * 卡片\n */\n CARD = 'card',\n\n /**\n * 悬浮窗口\n */\n FLOAT = 'float',\n\n /**\n * JavaScript\n */\n JS = 'js',\n}\n\nexport default EntryType"],"sourceRoot":"../../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/interface/IChunk.ts"],"names":[],"mappings":"","file":"IChunk.js","sourcesContent":["/**\n * IChunk\n */\nexport type IFileHash = {\n name: string\n hash: Buffer\n}\nexport type IChunkOptions = {\n files: IFileHash[]\n}\nexport type IPartChunk = {\n tag: boolean\n startIndex: number\n len: number\n previous: number\n sign?: Buffer\n}\nexport interface IChunk {\n signchunk: Buffer\n tag: boolean\n length: number\n options: IChunkOptions\n sections: {\n header: IPartChunk\n central: IPartChunk\n footer: IPartChunk\n }\n}\n"],"sourceRoot":"../../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/interface/IManifest.ts"],"names":[],"mappings":"","file":"IManifest.js","sourcesContent":["import { Dictionary } from '@aiot-toolkit/shared-utils/lib/type/Type'\n\n/**\n * vela manifest文件对应的数据结构\n */\nexport default interface IManifest {\n package: string\n name?: string\n versionName?: string\n minPlatformVersion?: number\n deviceId?: string\n deviceTypeList?: string[]\n features?: IFeatures[]\n config?: {\n logLevel: string\n designWidth?: string | number\n }\n router: {\n entry: string\n pages: Dictionary<{ component?: string }>\n }\n minAPILevel?: number\n}\n\nexport interface IFeatures {\n name: string\n}\n"],"sourceRoot":"../../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/interface/IQuickAppConfig.ts"],"names":[],"mappings":"","file":"IQuickAppConfig.js","sourcesContent":["import { Configuration } from 'webpack'\nimport IJavascriptCompileOption from '../../interface/IJavascriptCompileOption'\n\n/**\n * IQuickAppConfig\n *\n * 项目中 quickapp.config.js 的对象结构\n */\nexport default interface IQuickAppConfig {\n cli: Partial<IJavascriptCompileOption>\n webpack: Partial<Configuration>\n}\n"],"sourceRoot":"../../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/model/Package.ts"],"names":[],"mappings":";;;;;AAAA,iGAAwE;AAwBxE;;;;GAIG;AACH,MAAM,OAAO;IAoCX;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAID;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IACnC,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,IAAmB;QACpC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;QAC9B,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YAC/B,uBAAa,CAAC,KAAK,CAAC,QAAQ,aAAa,sBAAsB,CAAC,CAAA;YAChE,OAAM;SACP;QACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,IAAI,CAAA;QACvC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,YAAY,IAAsB;QAjElC;;WAEG;QACH,eAAU,GAAY,KAAK,CAAA;QAoBnB,kBAAa,GAAoB,EAAE,CAAA;QASnC,iBAAY,GAAwB,EAAE,CAAA;QAkC5C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAEzB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC;aACjE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAC/B,IAAI,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;CACF;AACD,kBAAe,OAAO,CAAA","file":"Package.js","sourcesContent":["import ColorConsole2 from '@aiot-toolkit/shared-utils/lib/ColorConsole2'\nimport { Dictionary } from '@aiot-toolkit/shared-utils/lib/type/Type'\n\n/**\n * 文件资源\n */\nexport interface IFileResource {\n /**\n * 文件路径\n */\n fileBuildPath: string\n\n /**\n * 文件内容\n */\n fileContentBuffer: Buffer\n\n /**\n * 文件摘要\n * 文件内容生成的 hash 值\n */\n fileContentDigest?: Uint8Array\n}\n\n/**\n * 定义文件包\n *\n * 相当于虚拟的 rpk 包\n */\nclass Package {\n /**\n * 包前缀\n */\n filePrefix?: string\n\n /**\n * 子包名称;整包没有\n */\n fileSubname?: string\n\n /**\n * 是否为独立包\n */\n standalone: boolean = false\n\n /**\n * 后缀名\n */\n fileSuffix?: string\n\n icon?: string\n\n banner?: string\n\n comment?: string\n\n /**\n * 资源路径匹配\n */\n subMatch?: RegExp\n\n readonly fileName: string\n\n private _resourceList: IFileResource[] = []\n\n /**\n * 资源文件列表\n */\n public get resourceList(): IFileResource[] {\n return this._resourceList\n }\n\n private _resourceDic: Dictionary<boolean> = {}\n\n /**\n * 资源文件字典,以高效检查资源是否存在\n */\n public get resourceDic(): Dictionary<boolean> {\n return this._resourceDic\n }\n\n /**\n * 是否已包含指定文件\n * @param filePath 文件路径\n * @returns\n */\n public include(filePath: string) {\n return this.resourceDic[filePath]\n }\n\n /**\n * 添加资源\n * @param data\n * @returns\n */\n public addResource(data: IFileResource) {\n const { fileBuildPath } = data\n if (this.include(fileBuildPath)) {\n ColorConsole2.throw(`File ${fileBuildPath} is added repeatedly`)\n return\n }\n this._resourceDic[fileBuildPath] = true\n this._resourceList.push(data)\n }\n\n constructor(data: Partial<Package>) {\n Object.assign(this, data)\n\n this.fileName = [this.filePrefix, this.fileSubname, this.fileSuffix]\n .filter((item) => Boolean(item))\n .join('.')\n }\n}\nexport default Package\n"],"sourceRoot":"../../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/plugin/WrapPlugin.ts"],"names":[],"mappings":";;AAAA,qCAA+C;AAC/C,qDAA8C;AAE9C,MAAM,UAAU;IACd,KAAK,CAAC,QAAkB;QACtB,cAAc;QACd,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,EAAE;YAC3D,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CACjC;gBACE,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,qBAAW,CAAC,6BAA6B;aACjD,EACD,GAAG,EAAE;gBACH,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACxB,CAAC,CACF,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,IAAI,CAAC,WAAwB;QACnC,SAAS;QACT,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,CAAA;QAEjF,wBAAwB;QACxB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;gBAC7B,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAA;gBAC7D,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,8BAAY,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAQ,CAAA;aAChF;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,YAAY,CAAC,IAAY;QAC/B,OAAO;;;;;;;;;;;;eAYI,IAAI;;;;;EAKjB,CAAA;IACA,CAAC;CACF;AAED,kBAAe,UAAU,CAAA","file":"WrapPlugin.js","sourcesContent":["import { Compilation, Compiler } from 'webpack'\nimport { ConcatSource } from 'webpack-sources'\n\nclass WrapPlugin {\n apply(compiler: Compiler) {\n // 给入口文件加上包裹函数\n compiler.hooks.compilation.tap('WrapPlugin', (compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: 'WrapPlugin',\n stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE\n },\n () => {\n this.wrap(compilation)\n }\n )\n })\n }\n\n private wrap(compilation: Compilation) {\n // 获取入口文件\n const entrys = Object.keys(compilation.options.entry).map((item) => `${item}.js`)\n\n // 从chunk找到所有入口文件,添加包裹函数\n entrys.forEach((entry) => {\n if (compilation.assets[entry]) {\n const content = compilation.assets[entry].source().toString()\n compilation.assets[entry] = new ConcatSource(this.wrapFunction(content)) as any\n }\n })\n }\n\n private wrapFunction(code: string) {\n return `\nexport default function(global, globalThis, window, $app_exports$, $app_evaluate$){\n var org_app_require = $app_require$;\n\n (function(global, globalThis, window, $app_exports$, $app_evaluate$){\n var setTimeout = global.setTimeout;\n var setInterval = global.setInterval;\n var clearTimeout = global.clearTimeout;\n var clearInterval = global.clearInterval;\n var $app_require$ = global.$app_require$ || org_app_require\n\n var createPageHandler = function() {\n return ${code}\n }\n\n return createPageHandler();\n })(global, globalThis, window, $app_exports$, $app_evaluate$)\n}`\n }\n}\n\nexport default WrapPlugin\n"],"sourceRoot":"../../../../../src"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["compiler/javascript/vela/utils/Jsc.ts"],"names":[],"mappings":";;;;;AAAA,iGAAwE;AACxE,iGAAwE;AACxE,8CAAqB;AACrB;;GAEG;AACH,MAAM,GAAG;IACP,YACkB,WAAmB,EACnB,SAAiB;QADjB,gBAAW,GAAX,WAAW,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAQ;IAChC,CAAC;IAEJ,GAAG;QACD,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;QACvC,OAAO,oBAAU,CAAC,aAAa,CAAC,WAAW,EAAE,mBAAmB,CAAC;aAC9D,IAAI,CAAC,CAAC,MAAW,EAAE,EAAE;YACpB,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAClC,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,EAAE;YACT,OAAO,IAAA,aAAG,EAAC,GAAG,SAAS,UAAU,CAAC,CAAA;QACpC,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;YACtB,uBAAa,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAClC,OAAO,CAAC,IAAI,EAAE,CAAA;QAChB,CAAC,CAAC,CAAA;IACN,CAAC;CACF;AACD,kBAAe,GAAG,CAAA","file":"Jsc.js","sourcesContent":["import ColorConsole2 from '@aiot-toolkit/shared-utils/lib/ColorConsole2'\nimport CommonUtil from '@aiot-toolkit/shared-utils/lib/utils/CommonUtil'\nimport del from 'del'\n/**\n * Jsc\n */\nclass Jsc {\n constructor(\n public readonly projectPath: string,\n public readonly buildPath: string\n ) {}\n\n jsc() {\n const { projectPath, buildPath } = this\n return CommonUtil.requireModule(projectPath, `@aiot-toolkit/jsc`)\n .then((module: any) => {\n return module.default(buildPath)\n })\n .then(() => {\n return del(`${buildPath}/**/*.js`)\n })\n .catch((error: Error) => {\n ColorConsole2.error(error.message)\n process.exit()\n })\n }\n}\nexport default Jsc\n"],"sourceRoot":"../../../../../src"}