@aiot-toolkit/aiotpack 2.0.1-alpha.11 → 2.0.1-alpha.13

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 (55) hide show
  1. package/lib/compiler/javascript/JavascriptCompiler.d.ts +1 -0
  2. package/lib/compiler/javascript/JavascriptCompiler.js +20 -16
  3. package/lib/compiler/javascript/JavascriptCompiler.js.map +1 -1
  4. package/lib/compiler/javascript/JavascriptDefaultCompileOption.d.ts +1 -0
  5. package/lib/compiler/javascript/JavascriptDefaultCompileOption.js +5 -0
  6. package/lib/compiler/javascript/JavascriptDefaultCompileOption.js.map +1 -1
  7. package/lib/compiler/javascript/vela/model/Package.js +2 -2
  8. package/lib/compiler/javascript/vela/model/Package.js.map +1 -1
  9. package/lib/compiler/javascript/vela/utils/Jsc.d.ts +1 -1
  10. package/lib/compiler/javascript/vela/utils/Jsc.js +4 -5
  11. package/lib/compiler/javascript/vela/utils/Jsc.js.map +1 -1
  12. package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +2 -2
  13. package/lib/compiler/javascript/vela/utils/UxCompileUtil.js.map +1 -1
  14. package/lib/compiler/javascript/vela/utils/ZipUtil.js +4 -4
  15. package/lib/compiler/javascript/vela/utils/ZipUtil.js.map +1 -1
  16. package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +14 -10
  17. package/lib/compiler/javascript/vela/utils/signature/SignUtil.js.map +1 -1
  18. package/lib/config/UxConfig.d.ts +3 -3
  19. package/lib/config/UxConfig.js +13 -2
  20. package/lib/config/UxConfig.js.map +1 -1
  21. package/lib/followWorks/xts/entryTemplate.d.ts +2 -2
  22. package/lib/followWorks/xts/entryTemplate.js +61 -42
  23. package/lib/followWorks/xts/entryTemplate.js.map +1 -1
  24. package/lib/followWorks/xts/generateRpk.js +1 -1
  25. package/lib/followWorks/xts/generateRpk.js.map +1 -1
  26. package/lib/followWorks/xts/ts2wasm.js +3 -12
  27. package/lib/followWorks/xts/ts2wasm.js.map +1 -1
  28. package/lib/loader/ux/JsLoader.d.ts +9 -0
  29. package/lib/loader/ux/JsLoader.js +38 -0
  30. package/lib/loader/ux/JsLoader.js.map +1 -0
  31. package/lib/loader/ux/PngLoader.js +4 -7
  32. package/lib/loader/ux/PngLoader.js.map +1 -1
  33. package/lib/loader/xts/XtsLoader.js +3 -7
  34. package/lib/loader/xts/XtsLoader.js.map +1 -1
  35. package/lib/preWorks/xts/preInstall.js +4 -10
  36. package/lib/preWorks/xts/preInstall.js.map +1 -1
  37. package/lib/utils/PreWorkUtils.js +9 -4
  38. package/lib/utils/PreWorkUtils.js.map +1 -1
  39. package/lib/utils/ux/ManifestSchema.d.ts +3 -0
  40. package/lib/utils/ux/ManifestSchema.js +209 -0
  41. package/lib/utils/ux/ManifestSchema.js.map +1 -0
  42. package/lib/utils/ux/UxFileUtils.d.ts +21 -4
  43. package/lib/utils/ux/UxFileUtils.js +74 -3
  44. package/lib/utils/ux/UxFileUtils.js.map +1 -1
  45. package/lib/utils/ux/UxFollowWorks.js +14 -2
  46. package/lib/utils/ux/UxFollowWorks.js.map +1 -1
  47. package/lib/utils/ux/UxLoaderUtils.d.ts +1 -1
  48. package/lib/utils/ux/UxLoaderUtils.js +3 -7
  49. package/lib/utils/ux/UxLoaderUtils.js.map +1 -1
  50. package/lib/utils/ux/UxPreWorks.d.ts +10 -0
  51. package/lib/utils/ux/UxPreWorks.js +33 -0
  52. package/lib/utils/ux/UxPreWorks.js.map +1 -0
  53. package/lib/utils/xts/XtsFollowWorks.js +3 -10
  54. package/lib/utils/xts/XtsFollowWorks.js.map +1 -1
  55. package/package.json +5 -5
@@ -0,0 +1,9 @@
1
+ import { IFileLaneContext, IFileParam, ILoader } from 'file-lane';
2
+ /**
3
+ * JsLoader
4
+ */
5
+ declare class JsLoader implements ILoader {
6
+ context: IFileLaneContext;
7
+ parser(files: IFileParam<any>[]): IFileParam<any>[] | Promise<IFileParam<any>[]>;
8
+ }
9
+ export default JsLoader;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const ParserUtil_1 = __importDefault(require("@aiot-toolkit/parser/lib/utils/ParserUtil"));
7
+ const ScriptParser_1 = __importDefault(require("@aiot-toolkit/parser/lib/ux/parser/ScriptParser"));
8
+ const ScriptToTypescript_1 = __importDefault(require("@aiot-toolkit/parser/lib/ux/translate/vela/ScriptToTypescript"));
9
+ /**
10
+ * JsLoader
11
+ */
12
+ class JsLoader {
13
+ parser(files) {
14
+ const project = ParserUtil_1.default.createProject();
15
+ return files.map((item) => {
16
+ if (!item.content) {
17
+ return {
18
+ path: item.path,
19
+ content: item.content
20
+ };
21
+ }
22
+ return {
23
+ path: item.path,
24
+ content: new ScriptToTypescript_1.default(project, {
25
+ filePath: item.path,
26
+ projectPath: this.context.projectPath
27
+ })
28
+ .translate({
29
+ content: new ScriptParser_1.default().parser(item.content.toString()).ast.content
30
+ }, [])
31
+ .targetTree.getFullText()
32
+ };
33
+ });
34
+ }
35
+ }
36
+ exports.default = JsLoader;
37
+
38
+ //# sourceMappingURL=JsLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["loader/ux/JsLoader.ts"],"names":[],"mappings":";;;;;AAAA,2FAAkE;AAClE,mGAA0E;AAC1E,uHAA8F;AAE9F;;GAEG;AACH,MAAM,QAAQ;IAEZ,MAAM,CAAC,KAAwB;QAC7B,MAAM,OAAO,GAAG,oBAAU,CAAC,aAAa,EAAE,CAAA;QAC1C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACxB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,OAAO;oBACL,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB,CAAA;aACF;YACD,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,4BAAkB,CAAC,OAAO,EAAE;oBACvC,QAAQ,EAAE,IAAI,CAAC,IAAI;oBACnB,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;iBACtC,CAAC;qBACC,SAAS,CACR;oBACE,OAAO,EAAE,IAAI,sBAAY,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO;iBACxE,EACD,EAAE,CACH;qBACA,UAAU,CAAC,WAAW,EAAE;aAC5B,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AACD,kBAAe,QAAQ,CAAA","file":"JsLoader.js","sourcesContent":["import ParserUtil from '@aiot-toolkit/parser/lib/utils/ParserUtil'\nimport ScriptParser from '@aiot-toolkit/parser/lib/ux/parser/ScriptParser'\nimport ScriptToTypescript from '@aiot-toolkit/parser/lib/ux/translate/vela/ScriptToTypescript'\nimport { IFileLaneContext, IFileParam, ILoader } from 'file-lane'\n/**\n * JsLoader\n */\nclass JsLoader implements ILoader {\n context!: IFileLaneContext\n parser(files: IFileParam<any>[]): IFileParam<any>[] | Promise<IFileParam<any>[]> {\n const project = ParserUtil.createProject()\n return files.map((item) => {\n if (!item.content) {\n return {\n path: item.path,\n content: item.content\n }\n }\n return {\n path: item.path,\n content: new ScriptToTypescript(project, {\n filePath: item.path,\n projectPath: this.context.projectPath\n })\n .translate(\n {\n content: new ScriptParser().parser(item.content.toString()).ast.content\n },\n []\n )\n .targetTree.getFullText()\n }\n })\n }\n}\nexport default JsLoader\n"],"sourceRoot":"../../../src"}
@@ -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 FileUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/FileUtil"));
18
17
  const path_1 = __importDefault(require("path"));
@@ -31,10 +30,7 @@ class PngLoader {
31
30
  const fullName = `${name}${ext}`;
32
31
  //判断文本,空文本则结束该文件处理
33
32
  if (!content) {
34
- ColorConsole_1.default.log({
35
- level: shared_utils_1.LOG_LEVEL.Warn,
36
- message: `【XtsLoader】the file '${fullName}' under the path '${filePath}' has no content `
37
- });
33
+ ColorConsole_1.default.warn(`The file '${fullName}' under the path '${filePath}' has no content `);
38
34
  return [];
39
35
  }
40
36
  // 判断传入的.png资源是不是.9.png资源
@@ -58,13 +54,14 @@ class PngLoader {
58
54
  yield aaptjs.singleCrunch(filePath, outputFile);
59
55
  }
60
56
  catch (error) {
61
- // 报错
62
- console.error('.9.png资源文件优化失败', error);
57
+ ColorConsole_1.default.throw(`.9.png resource file processing failed`);
63
58
  }
64
59
  }
65
60
  });
66
61
  }
67
62
  }
63
+ ;
64
+ PngLoader.raw = true;
68
65
  exports.default = PngLoader;
69
66
 
70
67
  //# sourceMappingURL=PngLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["loader/ux/PngLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6DAAsD;AACtD,+FAAsE;AACtE,6FAAoE;AAEpE,gDAAuB;AACvB,oEAA2C;AAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAE7C;;GAEG;AACH,MAAM,SAAS;IAEP,MAAM,CAAC,KAAmB;;YAC9B,MAAM,WAAW,GAAiB,EAAE,CAAA;YACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;gBACxC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,cAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBAC1C,MAAM,QAAQ,GAAG,GAAG,IAAI,GAAG,GAAG,EAAE,CAAA;gBAChC,kBAAkB;gBAClB,IAAI,CAAC,OAAO,EAAE;oBACZ,sBAAY,CAAC,GAAG,CAAC;wBACf,KAAK,EAAE,wBAAS,CAAC,IAAI;wBACrB,OAAO,EAAE,wBAAwB,QAAQ,qBAAqB,QAAQ,mBAAmB;qBAC1F,CAAC,CAAA;oBACF,OAAO,EAAE,CAAA;iBACV;gBACD,yBAAyB;gBACzB,IAAI,kBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE;oBAC3C,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;iBACjC;qBAAM;oBACL,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;iBACvB;aACF;YACD,OAAO,WAAW,CAAA;QACpB,CAAC;KAAA;IACa,WAAW,CAAC,QAAgB;;YACxC,mBAAmB;YACnB,IAAI,CAAC,kBAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;gBACpC,mCAAmC;gBACnC,MAAM,UAAU,GAAG,kBAAQ,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;gBACrE,IAAI;oBACF,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;iBAChD;gBAAC,OAAO,KAAK,EAAE;oBACd,KAAK;oBACL,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;iBACvC;aACF;QACH,CAAC;KAAA;CACF;AACD,kBAAe,SAAS,CAAA","file":"PngLoader.js","sourcesContent":["import { LOG_LEVEL } from '@aiot-toolkit/shared-utils'\nimport ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport FileUtil from '@aiot-toolkit/shared-utils/lib/utils/FileUtil'\nimport { IFileLaneContext, IFileParam, ILoader } from 'file-lane'\nimport Path from 'path'\nimport PngUtils from '../../utils/PngUtils'\nconst aaptjs = require('@hap-toolkit/aaptjs')\n\n/**\n * PngLoader\n */\nclass PngLoader implements ILoader {\n context!: IFileLaneContext\n async parser(files: IFileParam[]): Promise<IFileParam[]> {\n const resultFiles: IFileParam[] = []\n for (const file of files) {\n const { path: filePath, content } = file\n const { name, ext } = Path.parse(filePath)\n const fullName = `${name}${ext}`\n //判断文本,空文本则结束该文件处理\n if (!content) {\n ColorConsole.log({\n level: LOG_LEVEL.Warn,\n message: `【XtsLoader】the file '${fullName}' under the path '${filePath}' has no content `\n })\n return []\n }\n // 判断传入的.png资源是不是.9.png资源\n if (FileUtil.match(filePath, /.+\\.9\\.png$/)) {\n await this.compile9Png(filePath)\n } else {\n resultFiles.push(file)\n }\n }\n return resultFiles\n }\n private async compile9Png(filePath: string) {\n // 判断.9.png是否经过编码处理\n if (!PngUtils.isEncode9Png(filePath)) {\n // 将.9.png资源使用@hap-toolkit/aaptjs处理\n const outputFile = PngUtils.convertOutputPath(filePath, this.context)\n try {\n await aaptjs.singleCrunch(filePath, outputFile)\n } catch (error) {\n // 报错\n console.error('.9.png资源文件优化失败', error)\n }\n }\n }\n}\nexport default PngLoader\n"],"sourceRoot":"../../../src"}
1
+ {"version":3,"sources":["loader/ux/PngLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+FAAsE;AACtE,6FAAoE;AAEpE,gDAAuB;AACvB,oEAA2C;AAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAE7C;;GAEG;AACH,MAAM,SAAS;IAEP,MAAM,CAAC,KAAmB;;YAC9B,MAAM,WAAW,GAAiB,EAAE,CAAA;YACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;gBACxC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,cAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBAC1C,MAAM,QAAQ,GAAG,GAAG,IAAI,GAAG,GAAG,EAAE,CAAA;gBAChC,kBAAkB;gBAClB,IAAI,CAAC,OAAO,EAAE;oBACZ,sBAAY,CAAC,IAAI,CAAC,aAAa,QAAQ,qBAAqB,QAAQ,mBAAmB,CAAC,CAAA;oBACxF,OAAO,EAAE,CAAA;iBACV;gBACD,yBAAyB;gBACzB,IAAI,kBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE;oBAC3C,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;iBACjC;qBAAM;oBACL,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;iBACvB;aACF;YACD,OAAO,WAAW,CAAA;QACpB,CAAC;KAAA;IACa,WAAW,CAAC,QAAgB;;YACxC,mBAAmB;YACnB,IAAI,CAAC,kBAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;gBACpC,mCAAmC;gBACnC,MAAM,UAAU,GAAG,kBAAQ,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;gBACrE,IAAI;oBACF,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;iBAChD;gBAAC,OAAO,KAAK,EAAE;oBACd,sBAAY,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;iBAC7D;aACF;QACH,CAAC;KAAA;CACF;AAED,CAAC;AAAC,SAAiB,CAAC,GAAG,GAAG,IAAI,CAAA;AAC9B,kBAAe,SAAS,CAAA","file":"PngLoader.js","sourcesContent":["import ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport FileUtil from '@aiot-toolkit/shared-utils/lib/utils/FileUtil'\nimport { IFileLaneContext, IFileParam, ILoader } from 'file-lane'\nimport Path from 'path'\nimport PngUtils from '../../utils/PngUtils'\nconst aaptjs = require('@hap-toolkit/aaptjs')\n\n/**\n * PngLoader\n */\nclass PngLoader implements ILoader {\n context!: IFileLaneContext\n async parser(files: IFileParam[]): Promise<IFileParam[]> {\n const resultFiles: IFileParam[] = []\n for (const file of files) {\n const { path: filePath, content } = file\n const { name, ext } = Path.parse(filePath)\n const fullName = `${name}${ext}`\n //判断文本,空文本则结束该文件处理\n if (!content) {\n ColorConsole.warn(`The file '${fullName}' under the path '${filePath}' has no content `)\n return []\n }\n // 判断传入的.png资源是不是.9.png资源\n if (FileUtil.match(filePath, /.+\\.9\\.png$/)) {\n await this.compile9Png(filePath)\n } else {\n resultFiles.push(file)\n }\n }\n return resultFiles\n }\n private async compile9Png(filePath: string) {\n // 判断.9.png是否经过编码处理\n if (!PngUtils.isEncode9Png(filePath)) {\n // 将.9.png资源使用@hap-toolkit/aaptjs处理\n const outputFile = PngUtils.convertOutputPath(filePath, this.context)\n try {\n await aaptjs.singleCrunch(filePath, outputFile)\n } catch (error) {\n ColorConsole.throw(`.9.png resource file processing failed`)\n }\n }\n }\n}\n\n;(PngLoader as any).raw = true\nexport default PngLoader\n"],"sourceRoot":"../../../src"}
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const generator_1 = require("@aiot-toolkit/generator");
7
7
  const parser_1 = require("@aiot-toolkit/parser");
8
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
9
8
  const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
10
9
  const FileUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/FileUtil"));
11
10
  const path_1 = __importDefault(require("path"));
@@ -24,14 +23,11 @@ class XtsLoader {
24
23
  const newFileName = `${name}.ts`;
25
24
  //判断文本,空文本则结束该文件处理
26
25
  if (!content) {
27
- ColorConsole_1.default.log({
28
- level: shared_utils_1.LOG_LEVEL.Warn,
29
- message: `【XtsLoader】the file '${fullName}' under the path '${path}' has no content `
30
- });
26
+ ColorConsole_1.default.warn(`The file '${fullName}' under the path '${path}' has no content `);
31
27
  return [];
32
28
  }
33
- const parserResult = new parser_1.XtsParser(project, ColorConsole_1.default.log).parser(content, fullName);
34
- const { ast, mapList } = new parser_1.XtsToTypescript(project, ColorConsole_1.default.log, this.context, path).translate(parserResult.ast, parserResult.offsetList);
29
+ const parserResult = new parser_1.XtsParser(project, ColorConsole_1.default.logger).parser(content.toString(), fullName);
30
+ const { ast, mapList } = new parser_1.XtsToTypescript(project, ColorConsole_1.default.logger, this.context, path).translate(parserResult.ast, parserResult.offsetList);
35
31
  const { code, sourcemap } = new generator_1.TypescriptGenerator().generate({
36
32
  sourceFilePath: fullName,
37
33
  targetFilePath: newFileName,
@@ -1 +1 @@
1
- {"version":3,"sources":["loader/xts/XtsLoader.ts"],"names":[],"mappings":";;;;;AAAA,uDAA6D;AAC7D,iDAAiE;AACjE,6DAAsD;AACtD,+FAAsE;AACtE,6FAAoE;AAEpE,gDAAuB;AACvB,uCAAkC;AAClC;;GAEG;AACH,MAAM,SAAS;IAEb,MAAM,CAAC,KAAmB;QACxB,MAAM,OAAO,GAAG,IAAI,kBAAO,EAAE,CAAA;QAC7B,MAAM,WAAW,GAAiB,EAAE,CAAA;QACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;YACrC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACtC,MAAM,QAAQ,GAAG,GAAG,IAAI,GAAG,GAAG,EAAE,CAAA;YAChC,MAAM,WAAW,GAAG,GAAG,IAAI,KAAK,CAAA;YAChC,kBAAkB;YAClB,IAAI,CAAC,OAAO,EAAE;gBACZ,sBAAY,CAAC,GAAG,CAAC;oBACf,KAAK,EAAE,wBAAS,CAAC,IAAI;oBACrB,OAAO,EAAE,wBAAwB,QAAQ,qBAAqB,IAAI,mBAAmB;iBACtF,CAAC,CAAA;gBACF,OAAO,EAAE,CAAA;aACV;YACD,MAAM,YAAY,GAAG,IAAI,kBAAS,CAAC,OAAO,EAAE,sBAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YACvF,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,wBAAe,CAC1C,OAAO,EACP,sBAAY,CAAC,GAAG,EAChB,IAAI,CAAC,OAAO,EACZ,IAAI,CACL,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;YACtD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,+BAAmB,EAAE,CAAC,QAAQ,CAAC;gBAC7D,cAAc,EAAE,QAAQ;gBACxB,cAAc,EAAE,WAAW;gBAC3B,GAAG;gBACH,OAAO;aACR,CAAC,CAAA;YACF,WAAW,CAAC,IAAI,CACd;gBACE,IAAI,EAAE,kBAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC;gBAC5C,OAAO,EAAE,IAAI;aACd,EACD;gBACE,IAAI,EAAE,kBAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,IAAI,SAAS,CAAC;gBACjD,OAAO,EAAE,SAAS;aACnB,CACF,CAAA;SACF;QACD,OAAO;QACP,OAAO,WAAW,CAAA;IACpB,CAAC;CACF;AACD,kBAAe,SAAS,CAAA","file":"XtsLoader.js","sourcesContent":["import { TypescriptGenerator } from '@aiot-toolkit/generator'\nimport { XtsParser, XtsToTypescript } from '@aiot-toolkit/parser'\nimport { LOG_LEVEL } from '@aiot-toolkit/shared-utils'\nimport ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport FileUtil from '@aiot-toolkit/shared-utils/lib/utils/FileUtil'\nimport { IFileLaneContext, IFileParam, ILoader } from 'file-lane'\nimport Path from 'path'\nimport { Project } from 'ts-morph'\n/**\n * XtsLoader\n */\nclass XtsLoader implements ILoader {\n context!: IFileLaneContext\n parser(files: IFileParam[]): IFileParam[] {\n const project = new Project()\n const resultFiles: IFileParam[] = []\n for (const file in files) {\n const { path, content } = files[file]\n const { name, ext } = Path.parse(path)\n const fullName = `${name}${ext}`\n const newFileName = `${name}.ts`\n //判断文本,空文本则结束该文件处理\n if (!content) {\n ColorConsole.log({\n level: LOG_LEVEL.Warn,\n message: `【XtsLoader】the file '${fullName}' under the path '${path}' has no content `\n })\n return []\n }\n const parserResult = new XtsParser(project, ColorConsole.log).parser(content, fullName)\n const { ast, mapList } = new XtsToTypescript(\n project,\n ColorConsole.log,\n this.context,\n path\n ).translate(parserResult.ast, parserResult.offsetList)\n const { code, sourcemap } = new TypescriptGenerator().generate({\n sourceFilePath: fullName,\n targetFilePath: newFileName,\n ast,\n mapList\n })\n resultFiles.push(\n {\n path: FileUtil.updatePath(path, newFileName),\n content: code\n },\n {\n path: FileUtil.updatePath(path, `${name}.map.ts`),\n content: sourcemap\n }\n )\n }\n // 返回内容\n return resultFiles\n }\n}\nexport default XtsLoader\n"],"sourceRoot":"../../../src"}
1
+ {"version":3,"sources":["loader/xts/XtsLoader.ts"],"names":[],"mappings":";;;;;AAAA,uDAA6D;AAC7D,iDAAiE;AACjE,+FAAsE;AACtE,6FAAoE;AAEpE,gDAAuB;AACvB,uCAAkC;AAClC;;GAEG;AACH,MAAM,SAAS;IAEb,MAAM,CAAC,KAAmB;QACxB,MAAM,OAAO,GAAG,IAAI,kBAAO,EAAE,CAAA;QAC7B,MAAM,WAAW,GAAiB,EAAE,CAAA;QACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;YACrC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACtC,MAAM,QAAQ,GAAG,GAAG,IAAI,GAAG,GAAG,EAAE,CAAA;YAChC,MAAM,WAAW,GAAG,GAAG,IAAI,KAAK,CAAA;YAChC,kBAAkB;YAClB,IAAI,CAAC,OAAO,EAAE;gBACZ,sBAAY,CAAC,IAAI,CAAC,aAAa,QAAQ,qBAAqB,IAAI,mBAAmB,CAAC,CAAA;gBACpF,OAAO,EAAE,CAAA;aACV;YACD,MAAM,YAAY,GAAG,IAAI,kBAAS,CAAC,OAAO,EAAE,sBAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CACrE,OAAO,CAAC,QAAQ,EAAE,EAClB,QAAQ,CACT,CAAA;YACD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,wBAAe,CAC1C,OAAO,EACP,sBAAY,CAAC,MAAM,EACnB,IAAI,CAAC,OAAO,EACZ,IAAI,CACL,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;YACtD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,+BAAmB,EAAE,CAAC,QAAQ,CAAC;gBAC7D,cAAc,EAAE,QAAQ;gBACxB,cAAc,EAAE,WAAW;gBAC3B,GAAG;gBACH,OAAO;aACR,CAAC,CAAA;YACF,WAAW,CAAC,IAAI,CACd;gBACE,IAAI,EAAE,kBAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC;gBAC5C,OAAO,EAAE,IAAI;aACd,EACD;gBACE,IAAI,EAAE,kBAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,IAAI,SAAS,CAAC;gBACjD,OAAO,EAAE,SAAS;aACnB,CACF,CAAA;SACF;QACD,OAAO;QACP,OAAO,WAAW,CAAA;IACpB,CAAC;CACF;AACD,kBAAe,SAAS,CAAA","file":"XtsLoader.js","sourcesContent":["import { TypescriptGenerator } from '@aiot-toolkit/generator'\nimport { XtsParser, XtsToTypescript } from '@aiot-toolkit/parser'\nimport ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport FileUtil from '@aiot-toolkit/shared-utils/lib/utils/FileUtil'\nimport { IFileLaneContext, IFileParam, ILoader } from 'file-lane'\nimport Path from 'path'\nimport { Project } from 'ts-morph'\n/**\n * XtsLoader\n */\nclass XtsLoader implements ILoader {\n context!: IFileLaneContext\n parser(files: IFileParam[]): IFileParam[] {\n const project = new Project()\n const resultFiles: IFileParam[] = []\n for (const file in files) {\n const { path, content } = files[file]\n const { name, ext } = Path.parse(path)\n const fullName = `${name}${ext}`\n const newFileName = `${name}.ts`\n //判断文本,空文本则结束该文件处理\n if (!content) {\n ColorConsole.warn(`The file '${fullName}' under the path '${path}' has no content `)\n return []\n }\n const parserResult = new XtsParser(project, ColorConsole.logger).parser(\n content.toString(),\n fullName\n )\n const { ast, mapList } = new XtsToTypescript(\n project,\n ColorConsole.logger,\n this.context,\n path\n ).translate(parserResult.ast, parserResult.offsetList)\n const { code, sourcemap } = new TypescriptGenerator().generate({\n sourceFilePath: fullName,\n targetFilePath: newFileName,\n ast,\n mapList\n })\n resultFiles.push(\n {\n path: FileUtil.updatePath(path, newFileName),\n content: code\n },\n {\n path: FileUtil.updatePath(path, `${name}.map.ts`),\n content: sourcemap\n }\n )\n }\n // 返回内容\n return resultFiles\n }\n}\nexport default XtsLoader\n"],"sourceRoot":"../../../src"}
@@ -20,16 +20,14 @@ const path_1 = __importDefault(require("path"));
20
20
  const preInstall = (context, _, __, compilerOption) => __awaiter(void 0, void 0, void 0, function* () {
21
21
  var _a;
22
22
  if ((_a = compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.skip) === null || _a === void 0 ? void 0 : _a.includes('install')) {
23
- ColorConsole_1.default.log({
24
- message: `skip install pre-dependencies due to --skip ${compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.skip.join(',')}`
25
- });
23
+ ColorConsole_1.default.info(`### skip install pre-dependencies due to --skip ${compilerOption === null || compilerOption === void 0 ? void 0 : compilerOption.skip.join(',')}`);
26
24
  return;
27
25
  }
28
26
  const { projectPath } = context;
29
27
  const packagePath = path_1.default.resolve(projectPath, 'package.json');
30
28
  const preContent = {
31
29
  dependencies: {
32
- '@mi/ts-framework': 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/ts-framework/-/@mi/ts-framework-1.0.7.tgz',
30
+ '@mi/ts-framework': 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/ts-framework/-/@mi/ts-framework-1.0.8.tgz',
33
31
  '@mi/wasmnizer-ts': 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/wasmnizer-ts/-/@mi/wasmnizer-ts-0.0.12.tgz'
34
32
  }
35
33
  };
@@ -49,17 +47,13 @@ const preInstall = (context, _, __, compilerOption) => __awaiter(void 0, void 0,
49
47
  });
50
48
  }
51
49
  }
52
- ColorConsole_1.default.log({
53
- message: 'Installing pre-dependencies. The initial build may take some time, please be patient...'
54
- });
50
+ ColorConsole_1.default.info('### Installing pre-dependencies. The initial build may take some time, please be patient...');
55
51
  (0, child_process_1.execSync)('npm install', {
56
52
  cwd: projectPath
57
53
  });
58
54
  // 目前ts2wasm不支持@符号
59
55
  fs_1.default.renameSync(path_1.default.resolve(projectPath, 'node_modules/@mi'), path_1.default.resolve(projectPath, 'node_modules/mi'));
60
- ColorConsole_1.default.log({
61
- message: 'Dependencies installation complete.'
62
- });
56
+ ColorConsole_1.default.info('### Dependencies installation complete.');
63
57
  });
64
58
  exports.preInstall = preInstall;
65
59
 
@@ -1 +1 @@
1
- {"version":3,"sources":["preWorks/xts/preInstall.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+FAAsE;AACtE,iDAAwC;AAExC,4CAAmB;AACnB,gDAAuB;AAEhB,MAAM,UAAU,GAAgC,CAAO,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE;;IAC9F,IAAI,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,0CAAE,QAAQ,CAAC,SA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CACX,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,kBAAkB,CAAC,EAC7C,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAC7C,CAAA;IAED,sBAAY,CAAC,GAAG,CAAC;QACf,OAAO,EAAE,qCAAqC;KAC/C,CAAC,CAAA;AACJ,CAAC,CAAA,CAAA;AAtDY,QAAA,UAAU,cAsDtB","file":"preInstall.js","sourcesContent":["import ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport { execSync } from 'child_process'\nimport { PreWork } from 'file-lane/lib/interface/IFileLaneConfig'\nimport fs from 'fs'\nimport path from 'path'\nimport { IXtsCompileOptions } from '../../interface/ICompileOptions'\nexport const preInstall: PreWork<IXtsCompileOptions> = async (context, _, __, compilerOption) => {\n if (compilerOption?.skip?.includes('install')) {\n ColorConsole.log({\n message: `skip install pre-dependencies due to --skip ${compilerOption?.skip.join(',')}`\n })\n return\n }\n const { projectPath } = context\n const packagePath = path.resolve(projectPath, 'package.json')\n const preContent = {\n dependencies: {\n '@mi/ts-framework':\n 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/ts-framework/-/@mi/ts-framework-1.0.7.tgz',\n '@mi/wasmnizer-ts':\n 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/wasmnizer-ts/-/@mi/wasmnizer-ts-0.0.12.tgz'\n }\n }\n\n if (!fs.existsSync(packagePath)) {\n /** 如果没有 package.json 则创建 */\n fs.writeFileSync(packagePath, JSON.stringify(preContent, undefined, 2), {\n encoding: 'utf-8'\n })\n } else {\n const pckageContent: Record<string, any> = require(packagePath)\n if (\n !pckageContent.dependencies['@mi/ts-framework'] ||\n !pckageContent.dependencies['@mi/wasmnizer-ts']\n ) {\n Object.assign(pckageContent, preContent)\n fs.writeFileSync(packagePath, JSON.stringify(pckageContent), {\n encoding: 'utf-8'\n })\n }\n }\n\n ColorConsole.log({\n message:\n 'Installing pre-dependencies. The initial build may take some time, please be patient...'\n })\n\n execSync('npm install', {\n cwd: projectPath\n })\n\n // 目前ts2wasm不支持@符号\n fs.renameSync(\n path.resolve(projectPath, 'node_modules/@mi'),\n path.resolve(projectPath, 'node_modules/mi')\n )\n\n ColorConsole.log({\n message: 'Dependencies installation complete.'\n })\n}\n"],"sourceRoot":"../../../src"}
1
+ {"version":3,"sources":["preWorks/xts/preInstall.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+FAAsE;AACtE,iDAAwC;AAExC,4CAAmB;AACnB,gDAAuB;AAEhB,MAAM,UAAU,GAAgC,CAAO,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE;;IAC9F,IAAI,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,0CAAE,QAAQ,CAAC,SAAS,CAAC,EAAE;QAC7C,sBAAY,CAAC,IAAI,CACf,mDAAmD,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CACpF,CAAA;QACD,OAAM;KACP;IACD,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAA;IAC/B,MAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IAC7D,MAAM,UAAU,GAAG;QACjB,YAAY,EAAE;YACZ,kBAAkB,EAChB,wGAAwG;YAC1G,kBAAkB,EAChB,yGAAyG;SAC5G;KACF,CAAA;IAED,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QAC/B,4BAA4B;QAC5B,YAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE;YACtE,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAA;KACH;SAAM;QACL,MAAM,aAAa,GAAwB,OAAO,CAAC,WAAW,CAAC,CAAA;QAC/D,IACE,CAAC,aAAa,CAAC,YAAY,CAAC,kBAAkB,CAAC;YAC/C,CAAC,aAAa,CAAC,YAAY,CAAC,kBAAkB,CAAC,EAC/C;YACA,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;YACxC,YAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE;gBAC3D,QAAQ,EAAE,OAAO;aAClB,CAAC,CAAA;SACH;KACF;IAED,sBAAY,CAAC,IAAI,CACf,6FAA6F,CAC9F,CAAA;IAED,IAAA,wBAAQ,EAAC,aAAa,EAAE;QACtB,GAAG,EAAE,WAAW;KACjB,CAAC,CAAA;IAEF,kBAAkB;IAClB,YAAE,CAAC,UAAU,CACX,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,kBAAkB,CAAC,EAC7C,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAC7C,CAAA;IAED,sBAAY,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAA;AAC9D,CAAC,CAAA,CAAA;AAnDY,QAAA,UAAU,cAmDtB","file":"preInstall.js","sourcesContent":["import ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport { execSync } from 'child_process'\nimport { PreWork } from 'file-lane/lib/interface/IFileLaneConfig'\nimport fs from 'fs'\nimport path from 'path'\nimport { IXtsCompileOptions } from '../../interface/ICompileOptions'\nexport const preInstall: PreWork<IXtsCompileOptions> = async (context, _, __, compilerOption) => {\n if (compilerOption?.skip?.includes('install')) {\n ColorConsole.info(\n `### skip install pre-dependencies due to --skip ${compilerOption?.skip.join(',')}`\n )\n return\n }\n const { projectPath } = context\n const packagePath = path.resolve(projectPath, 'package.json')\n const preContent = {\n dependencies: {\n '@mi/ts-framework':\n 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/ts-framework/-/@mi/ts-framework-1.0.8.tgz',\n '@mi/wasmnizer-ts':\n 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/wasmnizer-ts/-/@mi/wasmnizer-ts-0.0.12.tgz'\n }\n }\n\n if (!fs.existsSync(packagePath)) {\n /** 如果没有 package.json 则创建 */\n fs.writeFileSync(packagePath, JSON.stringify(preContent, undefined, 2), {\n encoding: 'utf-8'\n })\n } else {\n const pckageContent: Record<string, any> = require(packagePath)\n if (\n !pckageContent.dependencies['@mi/ts-framework'] ||\n !pckageContent.dependencies['@mi/wasmnizer-ts']\n ) {\n Object.assign(pckageContent, preContent)\n fs.writeFileSync(packagePath, JSON.stringify(pckageContent), {\n encoding: 'utf-8'\n })\n }\n }\n\n ColorConsole.info(\n '### Installing pre-dependencies. The initial build may take some time, please be patient...'\n )\n\n execSync('npm install', {\n cwd: projectPath\n })\n\n // 目前ts2wasm不支持@符号\n fs.renameSync(\n path.resolve(projectPath, 'node_modules/@mi'),\n path.resolve(projectPath, 'node_modules/mi')\n )\n\n ColorConsole.info('### Dependencies installation complete.')\n}\n"],"sourceRoot":"../../../src"}
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  var _a;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
+ const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
16
17
  const del_1 = __importDefault(require("del"));
17
18
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
19
  const path_1 = __importDefault(require("path"));
@@ -37,11 +38,13 @@ class PreWorkUtils {
37
38
  if (manifestContent) {
38
39
  const { router } = manifestContent;
39
40
  if (!router) {
40
- // 报错,没有router配置
41
+ // 没有router配置
42
+ ColorConsole_1.default.throw(`### manifest ### No router configuration`);
41
43
  }
42
44
  const { pages } = router;
43
45
  if (!pages) {
44
- // 报错,没有pages配置
46
+ // 没有pages配置
47
+ ColorConsole_1.default.throw(`### manifest ### No pages configuration`);
45
48
  }
46
49
  Object.keys(pages).map((page) => {
47
50
  const pageContent = pages[page];
@@ -51,14 +54,16 @@ class PreWorkUtils {
51
54
  entryList.push(entryPage);
52
55
  }
53
56
  else {
54
- // 报错,路径不存在
57
+ // 路径不存在
58
+ ColorConsole_1.default.throw(`### manifest ### path '${entryPage}' does not exist`);
55
59
  }
56
60
  });
57
61
  context['entries'] = entryList;
58
62
  return Promise.resolve();
59
63
  }
60
64
  else {
61
- // 报错 manifest.json文件无有效内容
65
+ // manifest.json文件无有效内容
66
+ ColorConsole_1.default.error(`### manifest ### File has no valid content`);
62
67
  return Promise.reject();
63
68
  }
64
69
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/PreWorkUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8CAAqB;AAGrB,wDAAyB;AACzB,gDAAuB;AAEvB,mEAA0C;AAE1C;;GAEG;AACH,MAAM,YAAY;IAChB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,OAAyB;QACzC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAA;QAC/B,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;QAC7C,aAAa;QACb,MAAM,eAAe,GAAG,qBAAW,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QAChE,YAAY;QACZ,IAAI,SAAS,GAAa,EAAE,CAAA;QAC5B,IAAI,eAAe,EAAE;YACnB,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAA;YAClC,IAAI,CAAC,MAAM,EAAE;gBACX,gBAAgB;aACjB;YACD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;YACxB,IAAI,CAAC,KAAK,EAAE;gBACV,eAAe;aAChB;YACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;gBAC/B,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACzC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,WAAW,CAAC,SAAS,KAAK,CAAC,CAAA;gBACpE,IAAI,kBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;oBAC5B,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;iBAC1B;qBAAM;oBACL,WAAW;iBACZ;YACH,CAAC,CAAC,CAAA;YACF,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAAA;YAC9B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;SACzB;aAAM;YACL,0BAA0B;YAC1B,OAAO,OAAO,CAAC,MAAM,EAAE,CAAA;SACxB;IACH,CAAC;;;AAEM,kBAAK,GAAsC,CAAO,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE;IAC5F,IAAA,aAAG,EAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACnD,IAAI,aAAa,EAAE;QACjB,IAAA,aAAG,EAAC,cAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,CAAA;QACnE,IAAA,aAAG,EAAC,cAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAA;KACrE;AACH,CAAC,CANW,AAMX,CAAA;AAEH,kBAAe,YAAY,CAAA","file":"PreWorkUtils.js","sourcesContent":["import del from 'del'\nimport { IFileLaneContext } from 'file-lane'\nimport { PreWork } from 'file-lane/lib/interface/IFileLaneConfig'\nimport Fs from 'fs-extra'\nimport Path from 'path'\nimport IJavascriptCompileOption from '../compiler/javascript/interface/IJavascriptCompileOption'\nimport UxFileUtils from './ux/UxFileUtils'\n\n/**\n * PreWorkUtils\n */\nclass PreWorkUtils {\n /**\n * 获取ux项目的路由入口\n * @param context\n * @param fileList\n * @returns\n */\n static getEntries(context: IFileLaneContext) {\n const { projectPath } = context\n const srcPath = Path.join(projectPath, 'src')\n // 判断路径是否真实存在\n const manifestContent = UxFileUtils.getMainfestInfo(projectPath)\n // 存储entries\n let entryList: string[] = []\n if (manifestContent) {\n const { router } = manifestContent\n if (!router) {\n // 报错,没有router配置\n }\n const { pages } = router\n if (!pages) {\n // 报错,没有pages配置\n }\n Object.keys(pages).map((page) => {\n const pageContent = pages[page]\n const entryDir = Path.join(srcPath, page)\n const entryPage = Path.join(entryDir, `${pageContent.component}.ux`)\n if (Fs.existsSync(entryPage)) {\n entryList.push(entryPage)\n } else {\n // 报错,路径不存在\n }\n })\n context['entries'] = entryList\n return Promise.resolve()\n } else {\n // 报错 manifest.json文件无有效内容\n return Promise.reject()\n }\n }\n\n static clean: PreWork<IJavascriptCompileOption> = async (context, _, config, compileOption) => {\n del(Path.join(context.projectPath, context.output))\n if (compileOption) {\n del(Path.join(compileOption.projectPath, compileOption.outputPath))\n del(Path.join(compileOption.projectPath, compileOption.releasePath))\n }\n }\n}\nexport default PreWorkUtils\n"],"sourceRoot":"../../src"}
1
+ {"version":3,"sources":["utils/PreWorkUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+FAAsE;AACtE,8CAAqB;AAGrB,wDAAyB;AACzB,gDAAuB;AAEvB,mEAA0C;AAE1C;;GAEG;AACH,MAAM,YAAY;IAChB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,OAAyB;QACzC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAA;QAC/B,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;QAC7C,aAAa;QACb,MAAM,eAAe,GAAG,qBAAW,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QAChE,YAAY;QACZ,IAAI,SAAS,GAAa,EAAE,CAAA;QAC5B,IAAI,eAAe,EAAE;YACnB,MAAM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AO,CAAC,MAAM,CAAC,CAAC,CAAA;IACnD,IAAI,aAAa,EAAE;QACjB,IAAA,aAAG,EAAC,cAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,CAAA;QACnE,IAAA,aAAG,EAAC,cAAI,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAA;KACrE;AACH,CAAC,CANW,AAMX,CAAA;AAEH,kBAAe,YAAY,CAAA","file":"PreWorkUtils.js","sourcesContent":["import ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport del from 'del'\nimport { IFileLaneContext } from 'file-lane'\nimport { PreWork } from 'file-lane/lib/interface/IFileLaneConfig'\nimport Fs from 'fs-extra'\nimport Path from 'path'\nimport IJavascriptCompileOption from '../compiler/javascript/interface/IJavascriptCompileOption'\nimport UxFileUtils from './ux/UxFileUtils'\n\n/**\n * PreWorkUtils\n */\nclass PreWorkUtils {\n /**\n * 获取ux项目的路由入口\n * @param context\n * @param fileList\n * @returns\n */\n static getEntries(context: IFileLaneContext) {\n const { projectPath } = context\n const srcPath = Path.join(projectPath, 'src')\n // 判断路径是否真实存在\n const manifestContent = UxFileUtils.getMainfestInfo(projectPath)\n // 存储entries\n let entryList: string[] = []\n if (manifestContent) {\n const { router } = manifestContent\n if (!router) {\n // 没有router配置\n ColorConsole.throw(`### manifest ### No router configuration`)\n }\n const { pages } = router\n if (!pages) {\n // 没有pages配置\n ColorConsole.throw(`### manifest ### No pages configuration`)\n }\n Object.keys(pages).map((page) => {\n const pageContent = pages[page]\n const entryDir = Path.join(srcPath, page)\n const entryPage = Path.join(entryDir, `${pageContent.component}.ux`)\n if (Fs.existsSync(entryPage)) {\n entryList.push(entryPage)\n } else {\n // 路径不存在\n ColorConsole.throw(`### manifest ### path '${entryPage}' does not exist`)\n }\n })\n context['entries'] = entryList\n return Promise.resolve()\n } else {\n // manifest.json文件无有效内容\n ColorConsole.error(`### manifest ### File has no valid content`)\n return Promise.reject()\n }\n }\n\n static clean: PreWork<IJavascriptCompileOption> = async (context, _, config, compileOption) => {\n del(Path.join(context.projectPath, context.output))\n if (compileOption) {\n del(Path.join(compileOption.projectPath, compileOption.outputPath))\n del(Path.join(compileOption.projectPath, compileOption.releasePath))\n }\n }\n}\nexport default PreWorkUtils\n"],"sourceRoot":"../../src"}
@@ -0,0 +1,3 @@
1
+ import { JSONSchemaType } from '@aiot-toolkit/shared-utils/lib/utils/CommonUtil';
2
+ declare const ManifestSchema: JSONSchemaType;
3
+ export default ManifestSchema;
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ManifestSchema = {
4
+ type: 'object',
5
+ required: ['package', 'name', 'icon', 'versionCode', 'config', 'router'],
6
+ properties: {
7
+ package: {
8
+ type: 'string'
9
+ },
10
+ name: {
11
+ type: 'string'
12
+ },
13
+ icon: {
14
+ type: 'string'
15
+ },
16
+ banner: {
17
+ type: 'string'
18
+ },
19
+ versionName: {
20
+ type: 'string'
21
+ },
22
+ versionCode: {
23
+ type: ['number']
24
+ },
25
+ minPlatformVersion: {
26
+ type: ['number']
27
+ },
28
+ features: {
29
+ type: 'array',
30
+ items: {
31
+ type: 'object',
32
+ properties: {
33
+ name: {
34
+ type: 'string'
35
+ }
36
+ }
37
+ }
38
+ },
39
+ config: {
40
+ type: 'object',
41
+ properties: {
42
+ logLevel: {
43
+ enum: ['off', 'error', 'warn', 'info', 'log', 'debug']
44
+ },
45
+ designWidth: {
46
+ type: ['number', 'string']
47
+ },
48
+ data: {
49
+ // TODO 全局数据对象,属性名不能以$或_开头,
50
+ type: 'object'
51
+ },
52
+ background: {
53
+ // TODO 更详细的后台运行配置信息,
54
+ type: 'object'
55
+ },
56
+ network: {
57
+ // TODO 更详细的网络配置信息,
58
+ type: 'object'
59
+ }
60
+ }
61
+ },
62
+ router: {
63
+ // TODO 更详细的后台运行配置信息,
64
+ type: 'object',
65
+ required: ['entry', 'pages'],
66
+ properties: {
67
+ entry: {
68
+ type: 'string'
69
+ },
70
+ // TODO 看下 key 不确定能否校验值,
71
+ pages: {
72
+ type: 'object'
73
+ },
74
+ errorPage: {
75
+ type: 'string'
76
+ },
77
+ // TODO 看下 key 不确定能否校验值,
78
+ widgets: {
79
+ type: 'object'
80
+ }
81
+ }
82
+ },
83
+ display: {
84
+ type: 'object',
85
+ properties: {
86
+ backgroundColor: {
87
+ // TODO HEXColor
88
+ type: 'string'
89
+ },
90
+ fullScreen: {
91
+ type: 'boolean'
92
+ },
93
+ titleBar: {
94
+ type: 'boolean'
95
+ },
96
+ titleBarBackgroundColor: {
97
+ // TODO HEXColor
98
+ type: 'string'
99
+ },
100
+ titleBarTextColor: {
101
+ // TODO HEXColor
102
+ type: 'string'
103
+ },
104
+ menu: {
105
+ type: 'boolean'
106
+ },
107
+ windowSoftInputMode: {
108
+ enum: ['adjustPan', 'adjustResize']
109
+ },
110
+ pages: {
111
+ type: 'object'
112
+ },
113
+ orientation: {
114
+ enum: ['portrait', 'landscape']
115
+ },
116
+ statusBarImmersive: {
117
+ type: 'boolean'
118
+ },
119
+ statusBarTextStyle: {
120
+ enum: ['light', 'dark', 'auto']
121
+ },
122
+ statusBarBackgroundColor: {
123
+ type: 'string'
124
+ },
125
+ statusBarBackgroundOpacity: {
126
+ type: 'number'
127
+ },
128
+ fitCutout: {
129
+ enum: ['none', 'portrait', 'landscape']
130
+ },
131
+ textSizeAdjust: {
132
+ enum: ['none', 'auto']
133
+ },
134
+ themeMode: {
135
+ enum: [-1, 0, 1]
136
+ },
137
+ menuBarData: {
138
+ // TODO 详细校验
139
+ type: 'object'
140
+ },
141
+ forceDark: {
142
+ type: 'boolean'
143
+ },
144
+ pageCache: {
145
+ type: 'boolean'
146
+ },
147
+ cacheDuration: {
148
+ type: 'number'
149
+ }
150
+ }
151
+ },
152
+ subpackages: {
153
+ // TODO 与后面的分包校验融合
154
+ type: 'array',
155
+ items: {
156
+ type: 'object',
157
+ properties: {
158
+ name: {
159
+ type: 'string'
160
+ },
161
+ // TODO 详细的规则校验
162
+ resource: {
163
+ type: 'string'
164
+ }
165
+ },
166
+ // 是否必须?
167
+ required: ['name', 'resource']
168
+ }
169
+ },
170
+ menuBarData: {
171
+ type: 'object',
172
+ properties: {
173
+ menuBar: {
174
+ type: 'boolean'
175
+ },
176
+ menuBarStyle: {
177
+ enum: ['dark', 'light']
178
+ },
179
+ shareTitle: {
180
+ type: 'string'
181
+ },
182
+ shareDescription: {
183
+ type: 'string'
184
+ },
185
+ shareIcon: {
186
+ type: 'string'
187
+ },
188
+ shareCurrentPage: {
189
+ type: 'string'
190
+ },
191
+ shareParams: {
192
+ type: 'string'
193
+ },
194
+ shareUrl: {
195
+ type: 'string'
196
+ }
197
+ }
198
+ },
199
+ deviceTypeList: {
200
+ type: 'array',
201
+ items: {
202
+ type: 'string'
203
+ }
204
+ }
205
+ }
206
+ };
207
+ exports.default = ManifestSchema;
208
+
209
+ //# sourceMappingURL=ManifestSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/ux/ManifestSchema.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAmB;IACrC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,CAAC;IACxE,UAAU,EAAE;QACV,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;SACf;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;SACf;QACD,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,QAAQ,CAAC;SACjB;QACD,kBAAkB,EAAE;YAClB,IAAI,EAAE,CAAC,QAAQ,CAA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BACJ,IAAI,EAAE,QAAQ;qBACf;oBACD,eAAe;oBACf,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;qBACf;iBACF;gBACD,QAAQ;gBACR,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;aAC/B;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,SAAS;iBAChB;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;iBACxB;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;iBACf;gBACD,gBAAgB,EAAE;oBAChB,IAAI,EAAE,QAAQ;iBACf;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;iBACf;gBACD,gBAAgB,EAAE;oBAChB,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;iBACf;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,cAAc,EAAE;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;aACf;SACF;KACF;CACF,CAAA;AAED,kBAAe,cAAc,CAAA","file":"ManifestSchema.js","sourcesContent":["import { JSONSchemaType } from '@aiot-toolkit/shared-utils/lib/utils/CommonUtil'\n\nconst ManifestSchema: JSONSchemaType = {\n type: 'object',\n required: ['package', 'name', 'icon', 'versionCode', 'config', 'router'],\n properties: {\n package: {\n type: 'string'\n },\n name: {\n type: 'string'\n },\n icon: {\n type: 'string'\n },\n banner: {\n type: 'string'\n },\n versionName: {\n type: 'string'\n },\n versionCode: {\n type: ['number']\n },\n minPlatformVersion: {\n type: ['number']\n },\n features: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n }\n }\n }\n },\n config: {\n type: 'object',\n properties: {\n logLevel: {\n enum: ['off', 'error', 'warn', 'info', 'log', 'debug']\n },\n designWidth: {\n type: ['number', 'string']\n },\n data: {\n // TODO 全局数据对象,属性名不能以$或_开头,\n type: 'object'\n },\n background: {\n // TODO 更详细的后台运行配置信息,\n type: 'object'\n },\n network: {\n // TODO 更详细的网络配置信息,\n type: 'object'\n }\n }\n },\n router: {\n // TODO 更详细的后台运行配置信息,\n type: 'object',\n required: ['entry', 'pages'],\n properties: {\n entry: {\n type: 'string'\n },\n // TODO 看下 key 不确定能否校验值,\n pages: {\n type: 'object'\n },\n errorPage: {\n type: 'string'\n },\n // TODO 看下 key 不确定能否校验值,\n widgets: {\n type: 'object'\n }\n }\n },\n display: {\n type: 'object',\n properties: {\n backgroundColor: {\n // TODO HEXColor\n type: 'string'\n },\n fullScreen: {\n type: 'boolean'\n },\n titleBar: {\n type: 'boolean'\n },\n titleBarBackgroundColor: {\n // TODO HEXColor\n type: 'string'\n },\n titleBarTextColor: {\n // TODO HEXColor\n type: 'string'\n },\n menu: {\n type: 'boolean'\n },\n windowSoftInputMode: {\n enum: ['adjustPan', 'adjustResize']\n },\n pages: {\n type: 'object'\n },\n orientation: {\n enum: ['portrait', 'landscape']\n },\n statusBarImmersive: {\n type: 'boolean'\n },\n statusBarTextStyle: {\n enum: ['light', 'dark', 'auto']\n },\n statusBarBackgroundColor: {\n type: 'string'\n },\n statusBarBackgroundOpacity: {\n type: 'number'\n },\n fitCutout: {\n enum: ['none', 'portrait', 'landscape']\n },\n textSizeAdjust: {\n enum: ['none', 'auto']\n },\n themeMode: {\n enum: [-1, 0, 1]\n },\n menuBarData: {\n // TODO 详细校验\n type: 'object'\n },\n forceDark: {\n type: 'boolean'\n },\n pageCache: {\n type: 'boolean'\n },\n cacheDuration: {\n type: 'number'\n }\n }\n },\n subpackages: {\n // TODO 与后面的分包校验融合\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n },\n // TODO 详细的规则校验\n resource: {\n type: 'string'\n }\n },\n // 是否必须?\n required: ['name', 'resource']\n }\n },\n menuBarData: {\n type: 'object',\n properties: {\n menuBar: {\n type: 'boolean'\n },\n menuBarStyle: {\n enum: ['dark', 'light']\n },\n shareTitle: {\n type: 'string'\n },\n shareDescription: {\n type: 'string'\n },\n shareIcon: {\n type: 'string'\n },\n shareCurrentPage: {\n type: 'string'\n },\n shareParams: {\n type: 'string'\n },\n shareUrl: {\n type: 'string'\n }\n }\n },\n deviceTypeList: {\n type: 'array',\n items: {\n type: 'string'\n }\n }\n }\n}\n\nexport default ManifestSchema\n"],"sourceRoot":"../../../src"}
@@ -1,8 +1,5 @@
1
1
  import IManifest from '../../compiler/javascript/vela/interface/IManifest';
2
- /**
3
- * FileUtils
4
- */
5
- declare class UxFileUtils {
2
+ export declare class UxFileUtils {
6
3
  static readonly CONFIG_FILE_NAME = "manifest.json";
7
4
  /**
8
5
  * 获取manifest.json路径
@@ -18,5 +15,25 @@ declare class UxFileUtils {
18
15
  * @returns
19
16
  */
20
17
  static getMainfestInfo(projectPath: string, sourceRoot?: string): IManifest;
18
+ /**
19
+ * 检查 manifest文件,并显示错误信息
20
+ *
21
+ * 1. TypeError,使用Error 样式
22
+ * 2. 其它错误,使用 Warn 样式
23
+ * 3. 如果存在TypeError,则终止程序
24
+ *
25
+ * @param projectPath 项目路径
26
+ * @param sourceRoot 源码路径--相对项目根目录
27
+ * @returns
28
+ */
29
+ static validateManifest(projectPath: string, sourceRoot?: string): Error[] | undefined;
30
+ /**
31
+ * 检查 sitemap.json 文件,并显示错误信息
32
+ *
33
+ * 1. 当sitemap.json的 rules 中配置的page 不存在于 manifest.json 中时,报错并终止程序
34
+ * @param projectPath
35
+ * @param sourceRoot
36
+ */
37
+ static validateSitemap(projectPath: string, sourceRoot?: string): void;
21
38
  }
22
39
  export default UxFileUtils;