@aiot-toolkit/aiotpack 2.0.3-beta.7 → 2.0.3-beta.8
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.
- package/lib/afterCompile/ux/UxAfterCompile.js +301 -266
- package/lib/afterCompile/xts/entryTemplate.js +111 -113
- package/lib/afterCompile/xts/generateRpk.js +25 -54
- package/lib/afterCompile/xts/ts2wasm.js +62 -63
- package/lib/afterWorks/ux/UxAfterWorks.js +12 -19
- package/lib/beforeCompile/ux/UxBeforeCompile.js +26 -25
- package/lib/beforeCompile/xts/preInstall.js +50 -55
- package/lib/beforeWorks/ux/UxBeforeWorks.js +12 -19
- package/lib/compiler/enum/CompileMode.js +16 -23
- package/lib/compiler/interface/ICompileParam.js +1 -2
- package/lib/compiler/interface/ICompiler.js +1 -2
- package/lib/compiler/interface/ISignConfig.js +1 -2
- package/lib/compiler/javascript/JavascriptCompiler.js +147 -154
- package/lib/compiler/javascript/JavascriptDefaultCompileOption.js +20 -16
- package/lib/compiler/javascript/android/AndroidWebpackConfigurator.js +13 -11
- package/lib/compiler/javascript/android/plugin/WrapPlugin.js +52 -48
- package/lib/compiler/javascript/interface/IJavascriptCompileOption.js +1 -2
- package/lib/compiler/javascript/interface/IWebpackConfigurator.js +4 -1
- package/lib/compiler/javascript/vela/VelaWebpackConfigurator.js +78 -75
- package/lib/compiler/javascript/vela/enum/BuildNameFormatType.js +30 -41
- package/lib/compiler/javascript/vela/enum/EntryType.js +15 -29
- package/lib/compiler/javascript/vela/interface/IChunk.js +4 -1
- package/lib/compiler/javascript/vela/interface/IManifest.js +1 -2
- package/lib/compiler/javascript/vela/interface/IQuickAppConfig.js +1 -2
- package/lib/compiler/javascript/vela/model/Package.js +80 -51
- package/lib/compiler/javascript/vela/plugin/WrapPlugin.js +30 -26
- package/lib/compiler/javascript/vela/utils/Jsc.js +30 -33
- package/lib/compiler/javascript/vela/utils/UxCompileUtil.js +152 -130
- package/lib/compiler/javascript/vela/utils/ZipUtil.js +282 -276
- package/lib/compiler/javascript/vela/utils/signature/Base64.js +65 -67
- package/lib/compiler/javascript/vela/utils/signature/CRC32.js +37 -35
- package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +755 -731
- package/lib/compiler/javascript/vela/utils/signature/Signer.js +24 -22
- package/lib/compiler/javascript/vela/utils/webpackLoader/addColSourceMap.js +47 -52
- package/lib/compiler/javascript/vela/utils/webpackLoader/extractMapData.js +21 -17
- package/lib/config/UxConfig.js +145 -173
- package/lib/config/XtsConfig.js +30 -40
- package/lib/index.js +88 -41
- package/lib/interface/ICompileOptions.js +5 -2
- package/lib/interface/IDeviceList.js +1 -2
- package/lib/loader/ux/JsLoader.js +32 -30
- package/lib/loader/ux/PngLoader.js +47 -53
- package/lib/loader/ux/android/UxLoader.js +30 -31
- package/lib/loader/ux/vela/AppUxLoader.js +23 -24
- package/lib/loader/ux/vela/HmlLoader.js +59 -55
- package/lib/loader/ux/vela/UxLoader.js +29 -35
- package/lib/loader/xts/XtsLoader.js +55 -41
- package/lib/utils/BeforeCompileUtils.js +100 -92
- package/lib/utils/PngUtils.js +42 -36
- package/lib/utils/ux/ManifestSchema.js +198 -194
- package/lib/utils/ux/UxFileUtils.js +130 -116
- package/lib/utils/ux/UxLoaderUtils.js +292 -307
- package/lib/utils/ux/android/AndroidUx.js +88 -90
- package/lib/utils/xts/XtsFileLaneUtils.js +58 -65
- package/lib/utils/xts/XtsFollowWorks.js +122 -129
- package/package.json +6 -6
|
@@ -1,59 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
15
6
|
exports.preInstall = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
encoding: 'utf-8'
|
|
39
|
-
});
|
|
7
|
+
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
|
+
var _child_process = require("child_process");
|
|
9
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const preInstall = async params => {
|
|
13
|
+
const {
|
|
14
|
+
context,
|
|
15
|
+
compilerOption
|
|
16
|
+
} = params;
|
|
17
|
+
if (compilerOption?.skip?.includes('install')) {
|
|
18
|
+
_sharedUtils.ColorConsole.info(`### skip install pre-dependencies due to --skip ${compilerOption?.skip.join(',')}`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const {
|
|
22
|
+
projectPath
|
|
23
|
+
} = context;
|
|
24
|
+
const packagePath = _path.default.resolve(projectPath, 'package.json');
|
|
25
|
+
const preContent = {
|
|
26
|
+
dependencies: {
|
|
27
|
+
'@mi/ts-framework': 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/ts-framework/-/@mi/ts-framework-1.0.9.tgz',
|
|
28
|
+
'@mi/wasmnizer-ts': 'https://pkgs.d.xiaomi.net:443/artifactory/api/npm/mi-npm/@mi/wasmnizer-ts/-/@mi/wasmnizer-ts-0.0.12.tgz'
|
|
40
29
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
fs_1.default.writeFileSync(packagePath, JSON.stringify(pckageContent), {
|
|
47
|
-
encoding: 'utf-8'
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
shared_utils_1.ColorConsole.info('### Installing pre-dependencies. The initial build may take some time, please be patient...');
|
|
52
|
-
(0, child_process_1.execSync)('npm install', {
|
|
53
|
-
cwd: projectPath
|
|
30
|
+
};
|
|
31
|
+
if (!_fs.default.existsSync(packagePath)) {
|
|
32
|
+
/** 如果没有 package.json 则创建 */
|
|
33
|
+
_fs.default.writeFileSync(packagePath, JSON.stringify(preContent, undefined, 2), {
|
|
34
|
+
encoding: 'utf-8'
|
|
54
35
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
} else {
|
|
37
|
+
const pckageContent = require(packagePath);
|
|
38
|
+
if (!pckageContent.dependencies['@mi/ts-framework'] || !pckageContent.dependencies['@mi/wasmnizer-ts']) {
|
|
39
|
+
Object.assign(pckageContent, preContent);
|
|
40
|
+
_fs.default.writeFileSync(packagePath, JSON.stringify(pckageContent), {
|
|
41
|
+
encoding: 'utf-8'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
_sharedUtils.ColorConsole.info('### Installing pre-dependencies. The initial build may take some time, please be patient...');
|
|
46
|
+
(0, _child_process.execSync)('npm install', {
|
|
47
|
+
cwd: projectPath
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// 目前ts2wasm不支持@符号
|
|
51
|
+
_fs.default.renameSync(_path.default.resolve(projectPath, 'node_modules/@mi'), _path.default.resolve(projectPath, 'node_modules/mi'));
|
|
52
|
+
_sharedUtils.ColorConsole.info('### Dependencies installation complete.');
|
|
53
|
+
};
|
|
54
|
+
exports.preInstall = preInstall;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
13
|
-
const file_lane_1 = require("file-lane");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
|
+
var _fileLane = require("file-lane");
|
|
14
9
|
class UxBeforeWorks {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
}
|
|
10
|
+
static async cleanOutput(context) {
|
|
11
|
+
const outputPath = _fileLane.FileLaneUtil.getOutputPath(context);
|
|
12
|
+
_sharedUtils.FileUtil.del(outputPath);
|
|
13
|
+
}
|
|
21
14
|
}
|
|
22
|
-
exports.default = UxBeforeWorks;
|
|
15
|
+
var _default = exports.default = UxBeforeWorks;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
3
7
|
/**
|
|
4
8
|
* 编译模式枚举
|
|
5
9
|
*/
|
|
6
|
-
var CompileMode
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
var CompileMode = /*#__PURE__*/function (CompileMode) {
|
|
11
|
+
CompileMode["DEVELOPMENT"] = "development";
|
|
12
|
+
CompileMode["PRODUCTION"] = "production";
|
|
13
|
+
return CompileMode;
|
|
14
|
+
}(CompileMode || {});
|
|
15
|
+
(function (_CompileMode) {
|
|
16
|
+
function isProductionMode(value) {
|
|
17
|
+
return value === CompileMode.PRODUCTION;
|
|
18
|
+
}
|
|
19
|
+
_CompileMode.isProductionMode = isProductionMode;
|
|
16
20
|
})(CompileMode || (CompileMode = {}));
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 判断是否为生产模式
|
|
20
|
-
* @param value
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
function isProductionMode(value) {
|
|
24
|
-
return value === CompileMode.PRODUCTION;
|
|
25
|
-
}
|
|
26
|
-
CompileMode.isProductionMode = isProductionMode;
|
|
27
|
-
})(CompileMode || (CompileMode = {}));
|
|
28
|
-
exports.default = CompileMode;
|
|
21
|
+
var _default = exports.default = CompileMode;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
@@ -1,163 +1,156 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
16
|
-
const core_1 = require("@rspack/core");
|
|
17
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
18
|
-
const path_1 = __importDefault(require("path"));
|
|
19
|
-
const AndroidWebpackConfigurator_1 = __importDefault(require("./android/AndroidWebpackConfigurator"));
|
|
20
|
-
const VelaWebpackConfigurator_1 = __importDefault(require("./vela/VelaWebpackConfigurator"));
|
|
21
|
-
const UxCompileUtil_1 = __importDefault(require("./vela/utils/UxCompileUtil"));
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
|
+
var _core = require("@rspack/core");
|
|
9
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
var _AndroidWebpackConfigurator = _interopRequireDefault(require("./android/AndroidWebpackConfigurator"));
|
|
12
|
+
var _VelaWebpackConfigurator = _interopRequireDefault(require("./vela/VelaWebpackConfigurator"));
|
|
13
|
+
var _UxCompileUtil = _interopRequireDefault(require("./vela/utils/UxCompileUtil"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
15
|
class JavascriptCompiler {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}));
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
createWebpackConfig(param) {
|
|
55
|
-
const configurator = this.getConfigurator(param);
|
|
56
|
-
if (!configurator) {
|
|
57
|
-
throw new Error(`This project is not supported`);
|
|
58
|
-
}
|
|
59
|
-
configurator.param = param;
|
|
60
|
-
// 如果configurator有 create 函数,直接返回
|
|
61
|
-
// 否则,结合configurator生成默认配置,并使用
|
|
62
|
-
if (configurator.create) {
|
|
63
|
-
return configurator.create();
|
|
64
|
-
}
|
|
65
|
-
const { projectPath, mode, devtool, outputPath } = param;
|
|
66
|
-
const buildPath = path_1.default.resolve(projectPath, outputPath);
|
|
67
|
-
const quickAppConfig = shared_utils_1.CommonUtil.requireModule(path_1.default.join(param.projectPath, this.QUICKAPP_CONFIG));
|
|
68
|
-
const result = {
|
|
69
|
-
context: projectPath,
|
|
70
|
-
mode,
|
|
71
|
-
devtool: devtool,
|
|
72
|
-
output: {
|
|
73
|
-
globalObject: 'window',
|
|
74
|
-
filename: '[name].js',
|
|
75
|
-
publicPath: './',
|
|
76
|
-
path: buildPath
|
|
77
|
-
},
|
|
78
|
-
module: {
|
|
79
|
-
rules: [
|
|
80
|
-
{
|
|
81
|
-
test: /\.ux$/, // 匹配以 .ux 结尾的文件
|
|
82
|
-
use: [
|
|
83
|
-
{
|
|
84
|
-
loader: path_1.default.join(__dirname, '../javascript/vela/utils/webpackLoader/extractMapData.js')
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
|
-
optimization: {
|
|
91
|
-
minimizer: [
|
|
92
|
-
new core_1.rspack.SwcJsMinimizerRspackPlugin({
|
|
93
|
-
minimizerOptions: {
|
|
94
|
-
module: true
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
resolve: {
|
|
100
|
-
extensions: ['.js', '.ts', '.ux']
|
|
101
|
-
},
|
|
102
|
-
stats: {
|
|
103
|
-
builtAt: false,
|
|
104
|
-
entrypoints: false,
|
|
105
|
-
children: false,
|
|
106
|
-
chunks: false,
|
|
107
|
-
chunkModules: false,
|
|
108
|
-
chunkOrigins: false,
|
|
109
|
-
modules: false,
|
|
110
|
-
version: false,
|
|
111
|
-
assets: false
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
if (configurator.createEntry) {
|
|
115
|
-
result.entry = configurator.createEntry();
|
|
116
|
-
}
|
|
117
|
-
if (configurator.createRules && result.module) {
|
|
118
|
-
const readyRules = result.module.rules;
|
|
119
|
-
const configuratorRules = configurator.createRules();
|
|
120
|
-
result.module.rules =
|
|
121
|
-
Array.isArray(readyRules) && readyRules.length > 0
|
|
122
|
-
? [...configuratorRules, ...readyRules]
|
|
123
|
-
: configuratorRules;
|
|
124
|
-
// 判断devtool类型 inline-source-map时,添加第0列关系映射
|
|
125
|
-
if (devtool === 'inline-source-map') {
|
|
126
|
-
result.module.rules.unshift({
|
|
127
|
-
test: /\.ux$/, // 匹配以 .ux 结尾的文件
|
|
128
|
-
use: [
|
|
129
|
-
{
|
|
130
|
-
loader: path_1.default.join(__dirname, '../javascript/vela/utils/webpackLoader/addColSourceMap.js')
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
});
|
|
16
|
+
QUICKAPP_CONFIG = 'quickapp.config.js';
|
|
17
|
+
async compile(param) {
|
|
18
|
+
return new Promise(async (resolve, reject) => {
|
|
19
|
+
await this.clean(param);
|
|
20
|
+
const config = this.createWebpackConfig(param);
|
|
21
|
+
(0, _core.rspack)(config, (error, stats) => {
|
|
22
|
+
if (error) {
|
|
23
|
+
reject({
|
|
24
|
+
errors: [error]
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
const statsObj = stats?.toJson({});
|
|
28
|
+
if (statsObj) {
|
|
29
|
+
const {
|
|
30
|
+
errors,
|
|
31
|
+
warnings
|
|
32
|
+
} = statsObj;
|
|
33
|
+
if (errors?.length || warnings?.length) {
|
|
34
|
+
reject({
|
|
35
|
+
errors,
|
|
36
|
+
warnings
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
resolve();
|
|
134
40
|
}
|
|
41
|
+
}
|
|
135
42
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
createWebpackConfig(param) {
|
|
47
|
+
const configurator = this.getConfigurator(param);
|
|
48
|
+
if (!configurator) {
|
|
49
|
+
throw new Error(`This project is not supported`);
|
|
143
50
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return new VelaWebpackConfigurator_1.default();
|
|
150
|
-
case shared_utils_1.ProjectType.ANDDROID_UX:
|
|
151
|
-
return new AndroidWebpackConfigurator_1.default();
|
|
152
|
-
default:
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
51
|
+
configurator.param = param;
|
|
52
|
+
// 如果configurator有 create 函数,直接返回
|
|
53
|
+
// 否则,结合configurator生成默认配置,并使用
|
|
54
|
+
if (configurator.create) {
|
|
55
|
+
return configurator.create();
|
|
155
56
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
57
|
+
const {
|
|
58
|
+
projectPath,
|
|
59
|
+
mode,
|
|
60
|
+
devtool,
|
|
61
|
+
outputPath
|
|
62
|
+
} = param;
|
|
63
|
+
const buildPath = _path.default.resolve(projectPath, outputPath);
|
|
64
|
+
const quickAppConfig = _sharedUtils.CommonUtil.requireModule(_path.default.join(param.projectPath, this.QUICKAPP_CONFIG));
|
|
65
|
+
const result = {
|
|
66
|
+
context: projectPath,
|
|
67
|
+
mode,
|
|
68
|
+
devtool: devtool,
|
|
69
|
+
output: {
|
|
70
|
+
globalObject: 'window',
|
|
71
|
+
filename: '[name].js',
|
|
72
|
+
publicPath: './',
|
|
73
|
+
path: buildPath
|
|
74
|
+
},
|
|
75
|
+
module: {
|
|
76
|
+
rules: [{
|
|
77
|
+
test: /\.ux$/,
|
|
78
|
+
// 匹配以 .ux 结尾的文件
|
|
79
|
+
use: [{
|
|
80
|
+
loader: _path.default.join(__dirname, '../javascript/vela/utils/webpackLoader/extractMapData.js')
|
|
81
|
+
}]
|
|
82
|
+
}]
|
|
83
|
+
},
|
|
84
|
+
optimization: {
|
|
85
|
+
minimizer: [new _core.rspack.SwcJsMinimizerRspackPlugin({
|
|
86
|
+
minimizerOptions: {
|
|
87
|
+
module: true
|
|
88
|
+
}
|
|
89
|
+
})]
|
|
90
|
+
},
|
|
91
|
+
resolve: {
|
|
92
|
+
extensions: ['.js', '.ts', '.ux']
|
|
93
|
+
},
|
|
94
|
+
stats: {
|
|
95
|
+
builtAt: false,
|
|
96
|
+
entrypoints: false,
|
|
97
|
+
children: false,
|
|
98
|
+
chunks: false,
|
|
99
|
+
chunkModules: false,
|
|
100
|
+
chunkOrigins: false,
|
|
101
|
+
modules: false,
|
|
102
|
+
version: false,
|
|
103
|
+
assets: false
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
if (configurator.createEntry) {
|
|
107
|
+
result.entry = configurator.createEntry();
|
|
108
|
+
}
|
|
109
|
+
if (configurator.createRules && result.module) {
|
|
110
|
+
const readyRules = result.module.rules;
|
|
111
|
+
const configuratorRules = configurator.createRules();
|
|
112
|
+
result.module.rules = Array.isArray(readyRules) && readyRules.length > 0 ? [...configuratorRules, ...readyRules] : configuratorRules;
|
|
113
|
+
// 判断devtool类型 inline-source-map时,添加第0列关系映射
|
|
114
|
+
if (devtool === 'inline-source-map') {
|
|
115
|
+
result.module.rules.unshift({
|
|
116
|
+
test: /\.ux$/,
|
|
117
|
+
// 匹配以 .ux 结尾的文件
|
|
118
|
+
use: [{
|
|
119
|
+
loader: _path.default.join(__dirname, '../javascript/vela/utils/webpackLoader/addColSourceMap.js')
|
|
120
|
+
}]
|
|
160
121
|
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (configurator.createPlugins) {
|
|
125
|
+
result.plugins = configurator.createPlugins();
|
|
126
|
+
}
|
|
127
|
+
if (configurator.hook) {
|
|
128
|
+
configurator.hook(result);
|
|
129
|
+
}
|
|
130
|
+
return _lodash.default.merge({}, result, quickAppConfig?.webpack);
|
|
131
|
+
}
|
|
132
|
+
getConfigurator(param) {
|
|
133
|
+
const {
|
|
134
|
+
projectPath,
|
|
135
|
+
sourceRoot
|
|
136
|
+
} = param;
|
|
137
|
+
const projectType = _sharedUtils.ProjectType.getProjectType(projectPath, sourceRoot);
|
|
138
|
+
switch (projectType) {
|
|
139
|
+
case _sharedUtils.ProjectType.VELA_UX:
|
|
140
|
+
return new _VelaWebpackConfigurator.default();
|
|
141
|
+
case _sharedUtils.ProjectType.ANDDROID_UX:
|
|
142
|
+
return new _AndroidWebpackConfigurator.default();
|
|
143
|
+
default:
|
|
144
|
+
break;
|
|
161
145
|
}
|
|
146
|
+
}
|
|
147
|
+
async clean(param) {
|
|
148
|
+
const {
|
|
149
|
+
outputPath,
|
|
150
|
+
releasePath,
|
|
151
|
+
projectPath
|
|
152
|
+
} = param;
|
|
153
|
+
_UxCompileUtil.default.clean([outputPath, releasePath].map(item => _path.default.resolve(projectPath, item)));
|
|
154
|
+
}
|
|
162
155
|
}
|
|
163
|
-
exports.default = JavascriptCompiler;
|
|
156
|
+
var _default = exports.default = JavascriptCompiler;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
exports.setServerPort = setServerPort;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
var _os = _interopRequireDefault(require("os"));
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const clientRecordPath = _path.default.join(_os.default.homedir(), 'hap-toolkit-client-records.json');
|
|
10
12
|
const JavascriptDefaultCompileOption = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
sourceRoot: './src',
|
|
14
|
+
signRoot: './sign',
|
|
15
|
+
releasePath: './dist',
|
|
16
|
+
outputPath: './build',
|
|
17
|
+
dataCoverage: './.nyc_output',
|
|
18
|
+
clientRecordPath,
|
|
19
|
+
server: {
|
|
20
|
+
port: 8000
|
|
21
|
+
}
|
|
18
22
|
};
|
|
19
23
|
function setServerPort(port) {
|
|
20
|
-
|
|
24
|
+
JavascriptDefaultCompileOption.server.port = port;
|
|
21
25
|
}
|
|
22
|
-
exports.default = JavascriptDefaultCompileOption;
|
|
26
|
+
var _default = exports.default = JavascriptDefaultCompileOption;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _VelaWebpackConfigurator = _interopRequireDefault(require("../vela/VelaWebpackConfigurator"));
|
|
8
|
+
var _WrapPlugin = _interopRequireDefault(require("./plugin/WrapPlugin"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
10
|
/**
|
|
9
11
|
* AndroidWebpackConfigurator
|
|
10
12
|
*/
|
|
11
|
-
class AndroidWebpackConfigurator extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
class AndroidWebpackConfigurator extends _VelaWebpackConfigurator.default {
|
|
14
|
+
createWrapPlugin() {
|
|
15
|
+
return new _WrapPlugin.default(this.param);
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
|
-
exports.default = AndroidWebpackConfigurator;
|
|
18
|
+
var _default = exports.default = AndroidWebpackConfigurator;
|