@aiot-toolkit/aiotpack 2.0.1-alpha.9 → 2.0.2-beta.10

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 (115) 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 +17 -5
  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 +11 -7
  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 +3 -5
  26. package/lib/compiler/javascript/vela/utils/ZipUtil.js +6 -8
  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 +59 -0
  34. package/lib/compiler/javascript/vela/utils/webpackLoader/extractMapData.d.ts +3 -0
  35. package/lib/compiler/javascript/vela/utils/webpackLoader/extractMapData.js +20 -0
  36. package/lib/config/UxConfig.d.ts +8 -19
  37. package/lib/config/UxConfig.js +69 -13
  38. package/lib/config/XtsConfig.d.ts +5 -2
  39. package/lib/config/XtsConfig.js +12 -5
  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 +14 -4
  52. package/lib/loader/ux/HmlLoader.d.ts +24 -0
  53. package/lib/loader/ux/HmlLoader.js +63 -0
  54. package/lib/loader/ux/JsLoader.d.ts +11 -0
  55. package/lib/loader/ux/JsLoader.js +40 -0
  56. package/lib/loader/ux/PngLoader.js +4 -9
  57. package/lib/loader/ux/UxLoader.d.ts +2 -0
  58. package/lib/loader/ux/UxLoader.js +15 -4
  59. package/lib/loader/xts/XtsLoader.js +3 -9
  60. package/lib/preWorks/ux/UxPreWorks.d.ts +10 -0
  61. package/lib/preWorks/ux/UxPreWorks.js +31 -0
  62. package/lib/preWorks/xts/preInstall.js +4 -12
  63. package/lib/utils/PngUtils.js +0 -2
  64. package/lib/utils/PreWorkUtils.d.ts +5 -0
  65. package/lib/utils/PreWorkUtils.js +45 -12
  66. package/lib/utils/ux/ManifestSchema.d.ts +3 -0
  67. package/lib/utils/ux/ManifestSchema.js +207 -0
  68. package/lib/utils/ux/UxFileUtils.d.ts +21 -4
  69. package/lib/utils/ux/UxFileUtils.js +74 -5
  70. package/lib/utils/ux/UxLoaderUtils.d.ts +14 -7
  71. package/lib/utils/ux/UxLoaderUtils.js +144 -38
  72. package/lib/utils/xts/XtsFollowWorks.js +3 -12
  73. package/package.json +8 -10
  74. package/lib/compiler/enum/CompileMode.js.map +0 -1
  75. package/lib/compiler/interface/ICompileParam.js.map +0 -1
  76. package/lib/compiler/interface/ICompiler.js.map +0 -1
  77. package/lib/compiler/interface/ISignConfig.js.map +0 -1
  78. package/lib/compiler/javascript/JavascriptCompiler.js.map +0 -1
  79. package/lib/compiler/javascript/JavascriptDefaultCompileOption.js.map +0 -1
  80. package/lib/compiler/javascript/interface/IJavascriptCompileOption.js.map +0 -1
  81. package/lib/compiler/javascript/interface/IWebpackConfigurator.js.map +0 -1
  82. package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js.map +0 -1
  83. package/lib/compiler/javascript/vela/enum/BuildNameFormatType.js.map +0 -1
  84. package/lib/compiler/javascript/vela/enum/EntryType.js.map +0 -1
  85. package/lib/compiler/javascript/vela/interface/IChunk.js.map +0 -1
  86. package/lib/compiler/javascript/vela/interface/IManifest.js.map +0 -1
  87. package/lib/compiler/javascript/vela/interface/IQuickAppConfig.js.map +0 -1
  88. package/lib/compiler/javascript/vela/model/Package.js.map +0 -1
  89. package/lib/compiler/javascript/vela/plugin/WrapPlugin.js.map +0 -1
  90. package/lib/compiler/javascript/vela/utils/Jsc.js.map +0 -1
  91. package/lib/compiler/javascript/vela/utils/UxCompileUtil.js.map +0 -1
  92. package/lib/compiler/javascript/vela/utils/ZipUtil.js.map +0 -1
  93. package/lib/compiler/javascript/vela/utils/signature/Base64.js.map +0 -1
  94. package/lib/compiler/javascript/vela/utils/signature/CRC32.js.map +0 -1
  95. package/lib/compiler/javascript/vela/utils/signature/SignUtil.js.map +0 -1
  96. package/lib/compiler/javascript/vela/utils/signature/Signer.js.map +0 -1
  97. package/lib/config/UxConfig.js.map +0 -1
  98. package/lib/config/XtsConfig.js.map +0 -1
  99. package/lib/followWorks/xts/entryTemplate.js.map +0 -1
  100. package/lib/followWorks/xts/generateRpk.js.map +0 -1
  101. package/lib/followWorks/xts/ts2wasm.js.map +0 -1
  102. package/lib/index.js.map +0 -1
  103. package/lib/interface/ICompileOptions.js.map +0 -1
  104. package/lib/interface/IDeviceList.js.map +0 -1
  105. package/lib/loader/ux/AppUxLoader.js.map +0 -1
  106. package/lib/loader/ux/PngLoader.js.map +0 -1
  107. package/lib/loader/ux/UxLoader.js.map +0 -1
  108. package/lib/loader/xts/XtsLoader.js.map +0 -1
  109. package/lib/preWorks/xts/preInstall.js.map +0 -1
  110. package/lib/utils/PngUtils.js.map +0 -1
  111. package/lib/utils/PreWorkUtils.js.map +0 -1
  112. package/lib/utils/ux/UxFileUtils.js.map +0 -1
  113. package/lib/utils/ux/UxFollowWorks.js.map +0 -1
  114. package/lib/utils/ux/UxLoaderUtils.js.map +0 -1
  115. package/lib/utils/xts/XtsFollowWorks.js.map +0 -1
@@ -26,5 +26,3 @@ var CompileMode;
26
26
  CompileMode.isProductionMode = isProductionMode;
27
27
  })(CompileMode || (CompileMode = {}));
28
28
  exports.default = CompileMode;
29
-
30
- //# sourceMappingURL=CompileMode.js.map
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=ICompileParam.js.map
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=ICompiler.js.map
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=ISignConfig.js.map
@@ -2,10 +2,10 @@ import ICompileParam from '../interface/ICompileParam';
2
2
  import ICompiler from '../interface/ICompiler';
3
3
  import IJavascriptCompileOption from './interface/IJavascriptCompileOption';
4
4
  declare class JavascriptCompiler implements ICompiler {
5
+ readonly QUICKAPP_CONFIG = "quickapp.config.js";
5
6
  compile(param: IJavascriptCompileOption): Promise<void>;
6
7
  private createWebpackConfig;
7
8
  private getConfigurator;
8
- private showEnvLog;
9
9
  clean(param: ICompileParam & IJavascriptCompileOption): Promise<void>;
10
10
  }
11
11
  export default JavascriptCompiler;
@@ -12,25 +12,39 @@ 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 ColorConsole2_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole2"));
15
+ const CommonUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/CommonUtil"));
16
+ const lodash_1 = __importDefault(require("lodash"));
16
17
  const path_1 = __importDefault(require("path"));
17
18
  const webpack_1 = require("webpack");
18
19
  const VelaWebpackConfigurator_1 = __importDefault(require("./vela/VelaWebpackConfigurator"));
19
20
  const UxCompileUtil_1 = __importDefault(require("./vela/utils/UxCompileUtil"));
20
21
  class JavascriptCompiler {
22
+ constructor() {
23
+ this.QUICKAPP_CONFIG = 'quickapp.config.js';
24
+ }
21
25
  compile(param) {
22
26
  return __awaiter(this, void 0, void 0, function* () {
23
27
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
24
- this.showEnvLog(param);
25
28
  yield this.clean(param);
26
29
  const config = this.createWebpackConfig(param);
27
- (0, webpack_1.webpack)(config, (error) => {
30
+ (0, webpack_1.webpack)(config, (error, stats) => {
28
31
  if (error) {
29
- reject(error);
32
+ reject([error]);
30
33
  }
31
34
  else {
32
- ColorConsole2_1.default.info(`webpack complete`);
33
- resolve();
35
+ const statsObj = stats === null || stats === void 0 ? void 0 : stats.toJson();
36
+ if (statsObj) {
37
+ const { errors, warnings } = statsObj;
38
+ if ((errors === null || errors === void 0 ? void 0 : errors.length) || (warnings === null || warnings === void 0 ? void 0 : warnings.length)) {
39
+ reject({
40
+ errors,
41
+ warnings
42
+ });
43
+ }
44
+ else {
45
+ resolve();
46
+ }
47
+ }
34
48
  }
35
49
  });
36
50
  }));
@@ -49,6 +63,7 @@ class JavascriptCompiler {
49
63
  }
50
64
  const { projectPath, mode, devtool, outputPath } = param;
51
65
  const buildPath = path_1.default.resolve(projectPath, outputPath);
66
+ const quickAppConfig = CommonUtil_1.default.requireModule(path_1.default.join(param.projectPath, this.QUICKAPP_CONFIG));
52
67
  const result = {
53
68
  context: projectPath,
54
69
  mode,
@@ -59,7 +74,18 @@ class JavascriptCompiler {
59
74
  publicPath: './',
60
75
  path: buildPath
61
76
  },
62
- module: {},
77
+ module: {
78
+ rules: [
79
+ {
80
+ test: /\.ux$/,
81
+ use: [
82
+ {
83
+ loader: path_1.default.join(__dirname, '../javascript/vela/utils/webpackLoader/extractMapData.js')
84
+ }
85
+ ]
86
+ }
87
+ ]
88
+ },
63
89
  stats: {
64
90
  builtAt: false,
65
91
  entrypoints: false,
@@ -76,7 +102,23 @@ class JavascriptCompiler {
76
102
  result.entry = configurator.createEntry();
77
103
  }
78
104
  if (configurator.createRules && result.module) {
79
- result.module.rules = configurator.createRules();
105
+ const readyRules = result.module.rules;
106
+ const configuratorRules = configurator.createRules();
107
+ result.module.rules =
108
+ Array.isArray(readyRules) && readyRules.length > 0
109
+ ? [...configuratorRules, ...readyRules]
110
+ : configuratorRules;
111
+ // 判断devtool类型 inline-source-map时,添加第0列关系映射
112
+ if (devtool === 'inline-source-map') {
113
+ result.module.rules.unshift({
114
+ test: /\.ux$/,
115
+ use: [
116
+ {
117
+ loader: path_1.default.join(__dirname, '../javascript/vela/utils/webpackLoader/addColSourceMap.js')
118
+ }
119
+ ]
120
+ });
121
+ }
80
122
  }
81
123
  if (configurator.createPlugins) {
82
124
  result.plugins = configurator.createPlugins();
@@ -84,18 +126,11 @@ class JavascriptCompiler {
84
126
  if (configurator.hook) {
85
127
  configurator.hook(result);
86
128
  }
87
- return result;
129
+ return lodash_1.default.merge({}, result, quickAppConfig === null || quickAppConfig === void 0 ? void 0 : quickAppConfig.webpack);
88
130
  }
89
131
  getConfigurator() {
90
132
  return new VelaWebpackConfigurator_1.default();
91
133
  }
92
- showEnvLog(param) {
93
- const env = {
94
- NODE_PLATFORM: param.platform,
95
- NODE_PHASE: param.mode
96
- };
97
- console.log(`Configuration environment:${JSON.stringify(env)}`);
98
- }
99
134
  clean(param) {
100
135
  return __awaiter(this, void 0, void 0, function* () {
101
136
  const { outputPath, releasePath, projectPath } = param;
@@ -104,5 +139,3 @@ class JavascriptCompiler {
104
139
  }
105
140
  }
106
141
  exports.default = JavascriptCompiler;
107
-
108
- //# sourceMappingURL=JavascriptCompiler.js.map
@@ -1,3 +1,4 @@
1
1
  import IJavascriptCompileOption from './interface/IJavascriptCompileOption';
2
2
  declare const JavascriptDefaultCompileOption: Partial<IJavascriptCompileOption>;
3
+ export declare function setServerPort(port: number): void;
3
4
  export default JavascriptDefaultCompileOption;
@@ -3,11 +3,11 @@ 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.setServerPort = void 0;
6
7
  const os_1 = __importDefault(require("os"));
7
8
  const path_1 = __importDefault(require("path"));
8
9
  const clientRecordPath = path_1.default.join(os_1.default.homedir(), 'hap-toolkit-client-records.json');
9
10
  const JavascriptDefaultCompileOption = {
10
- devtool: false,
11
11
  sourceRoot: './src',
12
12
  signRoot: './sign',
13
13
  releasePath: './dist',
@@ -16,6 +16,8 @@ const JavascriptDefaultCompileOption = {
16
16
  clientRecordPath,
17
17
  server: { port: 8000 }
18
18
  };
19
+ function setServerPort(port) {
20
+ JavascriptDefaultCompileOption.server.port = port;
21
+ }
22
+ exports.setServerPort = setServerPort;
19
23
  exports.default = JavascriptDefaultCompileOption;
20
-
21
- //# sourceMappingURL=JavascriptDefaultCompileOption.js.map
@@ -3,19 +3,19 @@ import BuildNameFormatType from '../vela/enum/BuildNameFormatType';
3
3
  export default interface IJavascriptCompileOption extends ICompileParam {
4
4
  devtool?: string | false;
5
5
  /**
6
- * 源码根目录
6
+ * 源码路径(相对项目根目录)
7
7
  */
8
8
  sourceRoot: string;
9
9
  /**
10
- * 证书签名路径
10
+ * 证书签名路径(相对项目根目录)
11
11
  */
12
12
  signRoot: string;
13
13
  /**
14
- * 应用程序目录
14
+ * 应用程序目录(相对项目根目录)
15
15
  */
16
16
  releasePath: string;
17
17
  /**
18
- * 输出目录
18
+ * 输出目录(相对项目根目录)
19
19
  */
20
20
  outputPath: string;
21
21
  /**
@@ -36,5 +36,17 @@ export default interface IJavascriptCompileOption extends ICompileParam {
36
36
  /**
37
37
  * 禁用 jsc
38
38
  */
39
- disabledJSC?: boolean;
39
+ disabledJsc?: boolean;
40
+ /**
41
+ * 启用 protobuf
42
+ */
43
+ enableProtobuf?: boolean;
44
+ /**
45
+ * 启用应用自动化测试
46
+ */
47
+ enableE2e?: boolean;
48
+ /**
49
+ * 启用代码体积分析,会生成 report.html 文件,可查看打包后各模块占用体积
50
+ */
51
+ enableStats?: boolean;
40
52
  }
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=IJavascriptCompileOption.js.map
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=IWebpackConfigurator.js.map
@@ -1,4 +1,4 @@
1
- import { Configuration, EntryObject, RuleSetRule, WebpackPluginInstance } from 'webpack';
1
+ import { EntryObject, RuleSetRule, WebpackPluginInstance } from 'webpack';
2
2
  import ICompileParam from '../../interface/ICompileParam';
3
3
  import IJavascriptCompileOption from '../interface/IJavascriptCompileOption';
4
4
  import IWebpackConfigurator from '../interface/IWebpackConfigurator';
@@ -11,6 +11,5 @@ declare class VelaWebpackConfigurator implements IWebpackConfigurator {
11
11
  */
12
12
  createEntry(): string | EntryObject | string[];
13
13
  createRules(): RuleSetRule[];
14
- hook(config: Configuration): void;
15
14
  }
16
15
  export default VelaWebpackConfigurator;
@@ -10,10 +10,20 @@ const WrapPlugin_1 = __importDefault(require("./plugin/WrapPlugin"));
10
10
  const UxCompileUtil_1 = __importDefault(require("./utils/UxCompileUtil"));
11
11
  class VelaWebpackConfigurator {
12
12
  createPlugins() {
13
- return [
13
+ const result = [
14
14
  // 给 入口js 添加包裹
15
15
  new WrapPlugin_1.default()
16
16
  ];
17
+ // 如果开启 stats 参数,则添加 webpack-bundle-analyzer 插件
18
+ if (this.param.enableStats) {
19
+ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
20
+ result.push(new BundleAnalyzerPlugin({
21
+ analyzerMode: 'static',
22
+ openAnalyzer: false,
23
+ excludeAssets: /^@(system|service)\./
24
+ }));
25
+ }
26
+ return result;
17
27
  }
18
28
  /**
19
29
  * 通过读取 manifest.json 生成 entry
@@ -40,7 +50,6 @@ class VelaWebpackConfigurator {
40
50
  {
41
51
  loader: require.resolve('babel-loader'),
42
52
  options: {
43
- // configFile: getBabelConfigJsPath(cwd),
44
53
  cwd: this.param.projectPath,
45
54
  cacheDirectory: true
46
55
  }
@@ -65,10 +74,5 @@ class VelaWebpackConfigurator {
65
74
  }
66
75
  ];
67
76
  }
68
- hook(config) {
69
- // todo 合并用户配置
70
- }
71
77
  }
72
78
  exports.default = VelaWebpackConfigurator;
73
-
74
- //# sourceMappingURL=VelaWebpackConfigurator.js.map
@@ -43,5 +43,3 @@ exports.default = BuildNameFormatType;
43
43
  }
44
44
  BuildNameFormatType.toDesc = toDesc;
45
45
  })(BuildNameFormatType || (BuildNameFormatType = {}));
46
-
47
- //# sourceMappingURL=BuildNameFormatType.js.map
@@ -31,5 +31,3 @@ var EntryType;
31
31
  EntryType["JS"] = "js";
32
32
  })(EntryType || (EntryType = {}));
33
33
  exports.default = EntryType;
34
-
35
- //# sourceMappingURL=EntryType.js.map
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=IChunk.js.map
@@ -6,6 +6,7 @@ export default interface IManifest {
6
6
  package: string;
7
7
  name?: string;
8
8
  versionName?: string;
9
+ versionCode?: number;
9
10
  minPlatformVersion?: number;
10
11
  deviceId?: string;
11
12
  deviceTypeList?: string[];
@@ -21,6 +22,8 @@ export default interface IManifest {
21
22
  }>;
22
23
  };
23
24
  minAPILevel?: number;
25
+ packageInfo?: Dictionary<string | number>;
26
+ icon: string;
24
27
  }
25
28
  export interface IFeatures {
26
29
  name: string;
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=IManifest.js.map
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=IQuickAppConfig.js.map
@@ -3,7 +3,7 @@ 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
- const ColorConsole2_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole2"));
6
+ const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
7
7
  /**
8
8
  * 定义文件包
9
9
  *
@@ -38,7 +38,7 @@ class Package {
38
38
  addResource(data) {
39
39
  const { fileBuildPath } = data;
40
40
  if (this.include(fileBuildPath)) {
41
- ColorConsole2_1.default.throw(`File ${fileBuildPath} is added repeatedly`);
41
+ ColorConsole_1.default.throw(`File ${fileBuildPath} is added repeatedly`);
42
42
  return;
43
43
  }
44
44
  this._resourceDic[fileBuildPath] = true;
@@ -58,5 +58,3 @@ class Package {
58
58
  }
59
59
  }
60
60
  exports.default = Package;
61
-
62
- //# sourceMappingURL=Package.js.map
@@ -2,6 +2,5 @@ import { Compiler } from 'webpack';
2
2
  declare class WrapPlugin {
3
3
  apply(compiler: Compiler): void;
4
4
  private wrap;
5
- private wrapFunction;
6
5
  }
7
6
  export default WrapPlugin;
@@ -20,32 +20,27 @@ class WrapPlugin {
20
20
  // 从chunk找到所有入口文件,添加包裹函数
21
21
  entrys.forEach((entry) => {
22
22
  if (compilation.assets[entry]) {
23
- const content = compilation.assets[entry].source().toString();
24
- compilation.assets[entry] = new webpack_sources_1.ConcatSource(this.wrapFunction(content));
23
+ const source = compilation.assets[entry];
24
+ compilation.assets[entry] = new webpack_sources_1.ConcatSource(`
25
+ export default function(global, globalThis, window, $app_exports$, $app_evaluate$){
26
+ var org_app_require = $app_require$;
27
+
28
+ (function(global, globalThis, window, $app_exports$, $app_evaluate$){
29
+ var setTimeout = global.setTimeout;
30
+ var setInterval = global.setInterval;
31
+ var clearTimeout = global.clearTimeout;
32
+ var clearInterval = global.clearInterval;
33
+ var $app_require$ = global.$app_require$ || org_app_require
34
+
35
+ var createPageHandler = function() {
36
+ return `, source, `
37
+ }
38
+
39
+ return createPageHandler();
40
+ })(global, globalThis, window, $app_exports$, $app_evaluate$)
41
+ }`);
25
42
  }
26
43
  });
27
44
  }
28
- wrapFunction(code) {
29
- return `
30
- export default function(global, globalThis, window, $app_exports$, $app_evaluate$){
31
- var org_app_require = $app_require$;
32
-
33
- (function(global, globalThis, window, $app_exports$, $app_evaluate$){
34
- var setTimeout = global.setTimeout;
35
- var setInterval = global.setInterval;
36
- var clearTimeout = global.clearTimeout;
37
- var clearInterval = global.clearInterval;
38
- var $app_require$ = global.$app_require$ || org_app_require
39
-
40
- var createPageHandler = function() {
41
- return ${code}
42
- }
43
-
44
- return createPageHandler();
45
- })(global, globalThis, window, $app_exports$, $app_evaluate$)
46
- }`;
47
- }
48
45
  }
49
46
  exports.default = WrapPlugin;
50
-
51
- //# sourceMappingURL=WrapPlugin.js.map
@@ -5,6 +5,6 @@ declare class Jsc {
5
5
  readonly projectPath: string;
6
6
  readonly buildPath: string;
7
7
  constructor(projectPath: string, buildPath: string);
8
- jsc(): Promise<string[]>;
8
+ jsc(): Promise<void | string[]>;
9
9
  }
10
10
  export default Jsc;
@@ -3,7 +3,7 @@ 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
- const ColorConsole2_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole2"));
6
+ const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
7
7
  const CommonUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/CommonUtil"));
8
8
  const del_1 = __importDefault(require("del"));
9
9
  /**
@@ -16,19 +16,16 @@ class Jsc {
16
16
  }
17
17
  jsc() {
18
18
  const { projectPath, buildPath } = this;
19
- return CommonUtil_1.default.requireModule(projectPath, `@aiot-toolkit/jsc`)
19
+ return CommonUtil_1.default.requireNodeModule(projectPath, `@aiot-toolkit/jsc`)
20
20
  .then((module) => {
21
21
  return module.default(buildPath);
22
22
  })
23
23
  .then(() => {
24
- return (0, del_1.default)(`${buildPath}/**/*.js`);
24
+ return (0, del_1.default)(`${buildPath}/**/*.js`, { force: true });
25
25
  })
26
26
  .catch((error) => {
27
- ColorConsole2_1.default.error(error.message);
28
- process.exit();
27
+ ColorConsole_1.default.throw(error.message);
29
28
  });
30
29
  }
31
30
  }
32
31
  exports.default = Jsc;
33
-
34
- //# sourceMappingURL=Jsc.js.map
@@ -3,6 +3,7 @@ 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
+ const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
6
7
  const fs_extra_1 = __importDefault(require("fs-extra"));
7
8
  const path_1 = __importDefault(require("path"));
8
9
  const EntryType_1 = __importDefault(require("../enum/EntryType"));
@@ -36,8 +37,7 @@ class UxCompileUtil {
36
37
  }
37
38
  const appFile = this.resolveFile(path_1.default.join(codeDir, 'app'));
38
39
  if (!fs_extra_1.default.existsSync(appFile)) {
39
- console.log(`app file does not exist`);
40
- process.exit(1);
40
+ ColorConsole_1.default.throw(`App file does not exist`);
41
41
  }
42
42
  const { pages = {}, widgets = {}, floatingWindows = {} } = router;
43
43
  const confsList = [
@@ -130,7 +130,7 @@ class UxCompileUtil {
130
130
  * @returns
131
131
  */
132
132
  static getExtensionList(withDot = true) {
133
- const result = ['js'];
133
+ const result = ['ux'];
134
134
  if (withDot) {
135
135
  return result.map((item) => `.${item}`);
136
136
  }
@@ -140,5 +140,3 @@ class UxCompileUtil {
140
140
  // 摘要文件夹
141
141
  UxCompileUtil.DIGEST_ZIP_DIR = 'META-INF';
142
142
  exports.default = UxCompileUtil;
143
-
144
- //# sourceMappingURL=UxCompileUtil.js.map
@@ -13,7 +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 ColorConsole2_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole2"));
16
+ const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
17
17
  const CommonUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/CommonUtil"));
18
18
  const FileUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/FileUtil"));
19
19
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -51,7 +51,7 @@ class ZipUtil {
51
51
  // 1
52
52
  const files = this.getSortedFiles(dist, param, config);
53
53
  if (!files.length) {
54
- ColorConsole2_1.default.error(`The build file is missing, stop generating the application package, please check carefully`);
54
+ ColorConsole_1.default.error(`The build file is missing, stop generating the application package, please check carefully`);
55
55
  return;
56
56
  }
57
57
  // 2
@@ -95,6 +95,7 @@ class ZipUtil {
95
95
  const { releasePath, projectPath } = param;
96
96
  const filePath = path_1.default.join(projectPath, releasePath, fileName);
97
97
  fs_extra_1.default.outputFileSync(filePath, buffer);
98
+ ColorConsole_1.default.success(`Project build and generate files:${fileName}`);
98
99
  });
99
100
  }
100
101
  static createZipBufferFromFileList(fileList, comment) {
@@ -177,9 +178,9 @@ class ZipUtil {
177
178
  result = result
178
179
  .filter((item) => {
179
180
  return !(item.startsWith(UxCompileUtil_1.default.DIGEST_ZIP_DIR) ||
180
- (param.mode === 'production' && !mapReg.test(item)));
181
+ (param.mode === CompileMode_1.default.PRODUCTION && mapReg.test(item)));
181
182
  })
182
- .map((item) => path_1.default.relative(dist, item));
183
+ .map((item) => path_1.default.relative(dist, item).split(path_1.default.sep).join(path_1.default.posix.sep));
183
184
  result.sort((a, b) => {
184
185
  const indexA = getFileIndex(a);
185
186
  const indexB = getFileIndex(b);
@@ -239,8 +240,7 @@ class ZipUtil {
239
240
  // fullPackageBuffer
240
241
  const fullPackageBuffer = yield SignUtil_1.default.signZipBufferForPackage(fullPackage, privatekey, certificate);
241
242
  if (fullPackageBuffer === false) {
242
- // 报错
243
- console.error('【ZipUtil】error: fullpackage signature failed');
243
+ ColorConsole_1.default.throw('Fullpackage signature failed');
244
244
  }
245
245
  else {
246
246
  fullPackage = fullPackageBuffer;
@@ -274,5 +274,3 @@ ZipUtil.ZIP_OPTION = {
274
274
  }
275
275
  };
276
276
  exports.default = ZipUtil;
277
-
278
- //# sourceMappingURL=ZipUtil.js.map
@@ -73,5 +73,3 @@ class Base64 {
73
73
  }
74
74
  Base64.re = new RegExp(/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/);
75
75
  exports.default = Base64;
76
-
77
- //# sourceMappingURL=Base64.js.map
@@ -41,5 +41,3 @@ class CRC32 {
41
41
  }
42
42
  CRC32.table = '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D';
43
43
  exports.default = CRC32;
44
-
45
- //# sourceMappingURL=CRC32.js.map
@@ -14,7 +14,7 @@ declare class SignUtil {
14
14
  static getProjectSignConfig(param: ICompileParam & IJavascriptCompileOption): {
15
15
  privatekey: Buffer;
16
16
  certificate: Buffer;
17
- } | undefined;
17
+ };
18
18
  static signZipBufferForPackage(zipBuffer: Buffer, privatekey: Buffer, certificate: Buffer): Promise<false | Buffer>;
19
19
  /**
20
20
  * 根据ZIP流获取文件实例