@aiot-toolkit/aiotpack 2.0.2-dev.1 → 2.0.2-dev.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.
|
@@ -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();
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/aiotpack",
|
|
3
|
-
"version": "2.0.2-dev.
|
|
3
|
+
"version": "2.0.2-dev.2",
|
|
4
4
|
"description": "The process tool for packaging aiot projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiotpack"
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"test": "node ./__tests__/aiotpack.test.js"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aiot-toolkit/generator": "2.0.2-dev.
|
|
28
|
-
"@aiot-toolkit/parser": "2.0.2-dev.
|
|
27
|
+
"@aiot-toolkit/generator": "2.0.2-dev.2",
|
|
28
|
+
"@aiot-toolkit/parser": "2.0.2-dev.2",
|
|
29
29
|
"@hap-toolkit/aaptjs": "^2.0.0",
|
|
30
30
|
"babel-loader": "^9.1.3",
|
|
31
31
|
"del": "^4.1.0",
|
|
32
32
|
"fast-glob": "^3.3.2",
|
|
33
|
-
"file-lane": "2.0.2-dev.
|
|
33
|
+
"file-lane": "2.0.2-dev.2",
|
|
34
34
|
"file-loader": "^6.2.0",
|
|
35
35
|
"fs-extra": "^11.2.0",
|
|
36
36
|
"jsrsasign": "^7.2.2",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@types/jsrsasign": "^10.5.12",
|
|
45
45
|
"@types/webpack-sources": "^3.2.3"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4979839c27a3477f7e72f1f1ed167200bc1d48b5"
|
|
48
48
|
}
|