@aiot-toolkit/aiotpack 2.0.2-dev.1 → 2.0.2-dev.3
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.
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
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"));
|
|
@@ -31,12 +32,18 @@ class JavascriptCompiler {
|
|
|
31
32
|
reject([error]);
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
+
}
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
49
|
});
|
|
@@ -57,13 +64,18 @@ class JavascriptCompiler {
|
|
|
57
64
|
const { projectPath, mode, devtool, outputPath, sourceRoot } = param;
|
|
58
65
|
const buildPath = path_1.default.resolve(projectPath, outputPath);
|
|
59
66
|
const quickAppConfig = CommonUtil_1.default.requireModule(path_1.default.join(param.projectPath, this.QUICKAPP_CONFIG));
|
|
60
|
-
const result =
|
|
61
|
-
|
|
67
|
+
const result = {
|
|
68
|
+
context: projectPath,
|
|
69
|
+
mode,
|
|
70
|
+
devtool,
|
|
71
|
+
output: {
|
|
62
72
|
globalObject: 'window',
|
|
63
73
|
filename: '[name].js',
|
|
64
74
|
publicPath: './',
|
|
65
75
|
path: buildPath
|
|
66
|
-
},
|
|
76
|
+
},
|
|
77
|
+
module: {},
|
|
78
|
+
stats: {
|
|
67
79
|
builtAt: false,
|
|
68
80
|
entrypoints: false,
|
|
69
81
|
children: false,
|
|
@@ -73,11 +85,8 @@ class JavascriptCompiler {
|
|
|
73
85
|
modules: false,
|
|
74
86
|
version: false,
|
|
75
87
|
assets: false
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
'/Common': `${path_1.default.join(projectPath, sourceRoot)}/Common`
|
|
79
|
-
}
|
|
80
|
-
} });
|
|
88
|
+
}
|
|
89
|
+
};
|
|
81
90
|
if (configurator.createEntry) {
|
|
82
91
|
result.entry = configurator.createEntry();
|
|
83
92
|
}
|
|
@@ -90,7 +99,7 @@ class JavascriptCompiler {
|
|
|
90
99
|
if (configurator.hook) {
|
|
91
100
|
configurator.hook(result);
|
|
92
101
|
}
|
|
93
|
-
return result;
|
|
102
|
+
return lodash_1.default.merge({}, result, quickAppConfig === null || quickAppConfig === void 0 ? void 0 : quickAppConfig.webpack);
|
|
94
103
|
}
|
|
95
104
|
getConfigurator() {
|
|
96
105
|
return new VelaWebpackConfigurator_1.default();
|
package/lib/config/UxConfig.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IFileLaneConfig } from 'file-lane';
|
|
2
2
|
import IJavascriptCompileOption from '../compiler/javascript/interface/IJavascriptCompileOption';
|
|
3
3
|
import AppUxLoader from '../loader/ux/AppUxLoader';
|
|
4
|
-
import ImageCompressLoader from '../loader/ux/ImageCompressLoader';
|
|
5
4
|
import JsLoader from '../loader/ux/JsLoader';
|
|
6
5
|
import UxLoader from '../loader/ux/UxLoader';
|
|
7
6
|
declare class UxConfig implements IFileLaneConfig<IJavascriptCompileOption> {
|
|
@@ -22,10 +21,6 @@ declare class UxConfig implements IFileLaneConfig<IJavascriptCompileOption> {
|
|
|
22
21
|
test: RegExp[];
|
|
23
22
|
loader: (typeof JsLoader)[];
|
|
24
23
|
exclude?: undefined;
|
|
25
|
-
} | {
|
|
26
|
-
test: RegExp[];
|
|
27
|
-
loader: (typeof ImageCompressLoader)[];
|
|
28
|
-
exclude: RegExp[];
|
|
29
24
|
})[];
|
|
30
25
|
};
|
|
31
26
|
preWorks: import("file-lane/lib/interface/IFileLaneConfig").PreWork<IJavascriptCompileOption>[];
|
package/lib/config/UxConfig.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
7
|
const AppUxLoader_1 = __importDefault(require("../loader/ux/AppUxLoader"));
|
|
8
|
-
const ImageCompressLoader_1 = __importDefault(require("../loader/ux/ImageCompressLoader"));
|
|
9
8
|
const JsLoader_1 = __importDefault(require("../loader/ux/JsLoader"));
|
|
10
9
|
const PngLoader_1 = __importDefault(require("../loader/ux/PngLoader"));
|
|
11
10
|
const UxLoader_1 = __importDefault(require("../loader/ux/UxLoader"));
|
|
@@ -34,12 +33,12 @@ class UxConfig {
|
|
|
34
33
|
{
|
|
35
34
|
test: [/.+\.9.png/],
|
|
36
35
|
loader: [PngLoader_1.default]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
test: [/.+\.(png|jpg|jpeg|gif)/],
|
|
40
|
-
loader: [ImageCompressLoader_1.default],
|
|
41
|
-
exclude: [/.+\.9.png/]
|
|
42
36
|
}
|
|
37
|
+
// {
|
|
38
|
+
// test: [/.+\.(png|jpg|jpeg|gif)/],
|
|
39
|
+
// loader: [ImageCompressLoader],
|
|
40
|
+
// exclude: [/.+\.9.png/]
|
|
41
|
+
// }
|
|
43
42
|
]
|
|
44
43
|
};
|
|
45
44
|
this.preWorks = [
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
var _a;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
const TranslateCache_1 = __importDefault(require("@aiot-toolkit/parser/lib//ux/translate/vela/TranslateCache"));
|
|
17
|
+
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
17
18
|
const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
|
|
18
19
|
const CommonUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/CommonUtil"));
|
|
19
20
|
const FileUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/FileUtil"));
|
|
@@ -39,10 +40,36 @@ UxFollowWorks.webpack = (context, config, compilerOption) => __awaiter(void 0, v
|
|
|
39
40
|
.then(() => {
|
|
40
41
|
ColorConsole_1.default.info(`webpack complete`);
|
|
41
42
|
})
|
|
42
|
-
.catch((errors) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
.catch(({ errors, warnings }) => {
|
|
44
|
+
const errorLength = (errors === null || errors === void 0 ? void 0 : errors.length) || 0;
|
|
45
|
+
const messages = [`webpack error:\r\n`];
|
|
46
|
+
if (errors === null || errors === void 0 ? void 0 : errors.length) {
|
|
47
|
+
messages.push({
|
|
48
|
+
word: errors
|
|
49
|
+
.map((item, index) => {
|
|
50
|
+
return `${index + 1}. ${item.message}`;
|
|
51
|
+
})
|
|
52
|
+
.join('\r\n'),
|
|
53
|
+
style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Throw)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (warnings === null || warnings === void 0 ? void 0 : warnings.length) {
|
|
57
|
+
messages.push({
|
|
58
|
+
word: warnings
|
|
59
|
+
.map((item, index) => {
|
|
60
|
+
return `${errorLength + index + 1}. ${item.message}`;
|
|
61
|
+
})
|
|
62
|
+
.join('\r\n'),
|
|
63
|
+
style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Warn)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (errors === null || errors === void 0 ? void 0 : errors.length) {
|
|
67
|
+
ColorConsole_1.default.throw(...messages);
|
|
68
|
+
throw new Error();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
ColorConsole_1.default.warn(...messages);
|
|
72
|
+
}
|
|
46
73
|
});
|
|
47
74
|
});
|
|
48
75
|
UxFollowWorks.protobuf = (context, config, compilerOption) => __awaiter(void 0, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/aiotpack",
|
|
3
|
-
"version": "2.0.2-dev.
|
|
3
|
+
"version": "2.0.2-dev.3",
|
|
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,21 +15,17 @@
|
|
|
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.2-dev.
|
|
28
|
-
"@aiot-toolkit/parser": "2.0.2-dev.
|
|
22
|
+
"@aiot-toolkit/generator": "2.0.2-dev.3",
|
|
23
|
+
"@aiot-toolkit/parser": "2.0.2-dev.3",
|
|
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.2-dev.
|
|
28
|
+
"file-lane": "2.0.2-dev.3",
|
|
34
29
|
"file-loader": "^6.2.0",
|
|
35
30
|
"fs-extra": "^11.2.0",
|
|
36
31
|
"jsrsasign": "^7.2.2",
|
|
@@ -44,5 +39,5 @@
|
|
|
44
39
|
"@types/jsrsasign": "^10.5.12",
|
|
45
40
|
"@types/webpack-sources": "^3.2.3"
|
|
46
41
|
},
|
|
47
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e143a7038d5efaa59f01b2e2eb98422b1ec01097"
|
|
48
43
|
}
|