aiot-toolkit 1.0.13-beta.9 → 1.0.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.
- package/CHANGELOG.md +8 -0
- package/README.md +8 -0
- package/bin/index.js +7 -2
- package/lib/commands/compile.js +1 -135
- package/lib/commands/debug.js +1 -674
- package/lib/commands/init.js +1 -223
- package/lib/commands/packages.js +1 -86
- package/lib/commands/preview.js +1 -19
- package/lib/commands/report.js +1 -60
- package/lib/commands/resign.js +1 -88
- package/lib/commands/update.js +1 -358
- package/lib/commands/utils.js +1 -283
- package/lib/index.js +1 -85
- package/lib/plugins/manifest-watch-plugin.js +1 -123
- package/lib/utils.js +1 -84
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
#### [1.0.13] - 2022-06-15
|
|
4
|
+
|
|
5
|
+
- 支持 `vela` 项目的全局样式
|
|
6
|
+
- 支持 `vela` 项目 --enable-ops-wrap、--enable-export-function 参数
|
|
7
|
+
- 重构 `vela` 项目的编译时函数
|
|
8
|
+
- 修复 `vela` 项目 for、if 属性丢失等问题
|
|
9
|
+
- 增加 `vela` 项目 jsc 转译功能
|
|
10
|
+
|
|
3
11
|
#### [1.0.12] - 2022-03-23
|
|
4
12
|
|
|
5
13
|
- 支持 `vela` 项目中事件参数可以加上{{}}
|
package/README.md
CHANGED
|
@@ -41,6 +41,14 @@ npm run release
|
|
|
41
41
|
|
|
42
42
|
### 版本日志(详情请在 node_modules 中查看 CHANGELOG)
|
|
43
43
|
|
|
44
|
+
#### [1.0.13] - 2022-06-15
|
|
45
|
+
|
|
46
|
+
- 支持 `vela` 项目的全局样式
|
|
47
|
+
- 支持 `vela` 项目 --enable-ops-wrap、--enable-export-function 参数
|
|
48
|
+
- 重构 `vela` 项目的编译时函数
|
|
49
|
+
- 修复 `vela` 项目 for、if 属性丢失等问题
|
|
50
|
+
- 增加 `vela` 项目 jsc 转译功能
|
|
51
|
+
|
|
44
52
|
#### [1.0.12] - 2022-03-23
|
|
45
53
|
|
|
46
54
|
- 支持 `vela` 项目中事件参数可以加上{{}}
|
package/bin/index.js
CHANGED
|
@@ -65,8 +65,9 @@ program
|
|
|
65
65
|
.option('--include-static-resources', 'bundle static resources to rpk')
|
|
66
66
|
.option('--match-sourcemap', 'match sourcemap')
|
|
67
67
|
.option('--enable-extract-css', 'extract css to json')
|
|
68
|
-
.option('--enable-wrap', 'wrap attribute')
|
|
68
|
+
.option('--enable-ops-wrap', 'wrap attribute')
|
|
69
69
|
.option('--enable-export-function', 'explort entrys by function')
|
|
70
|
+
.option('--enable-jsc', 'bundle to jsc if the projectType is vela')
|
|
70
71
|
.option(
|
|
71
72
|
'--split-chunks-mode <value>',
|
|
72
73
|
'extract js module to single files',
|
|
@@ -120,8 +121,9 @@ program
|
|
|
120
121
|
.option('--include-dsl-from-lib', 'bundle dsl to rpk')
|
|
121
122
|
.option('--include-static-resources', 'bundle static resources to rpk')
|
|
122
123
|
.option('--enable-performance-check', 'inject performance log in code')
|
|
123
|
-
.option('--enable-wrap', 'wrap attribute')
|
|
124
|
+
.option('--enable-ops-wrap', 'wrap attribute')
|
|
124
125
|
.option('--enable-export-function', 'explort entrys by function')
|
|
126
|
+
.option('--enable-jsc', 'bundle to jsc if the projectType is vela')
|
|
125
127
|
.option(
|
|
126
128
|
'--build-name-format <build-name-format>',
|
|
127
129
|
'custom output rpk file name',
|
|
@@ -200,6 +202,7 @@ program
|
|
|
200
202
|
.option('--include-static-resources', 'bundle static resources to rpk')
|
|
201
203
|
.option('--match-sourcemap', 'match sourcemap')
|
|
202
204
|
.option('--enable-extract-css', 'extract css to json')
|
|
205
|
+
.option('--enable-jsc', 'bundle to jsc if the projectType is vela')
|
|
203
206
|
.option(
|
|
204
207
|
'--split-chunks-mode <value>',
|
|
205
208
|
'extract js module to single files',
|
|
@@ -217,6 +220,8 @@ program
|
|
|
217
220
|
'custom output rpk file name',
|
|
218
221
|
validateBuildNameFormat
|
|
219
222
|
)
|
|
223
|
+
.option('--enable-ops-wrap', 'wrap attribute')
|
|
224
|
+
.option('--enable-export-function', 'explort entrys by function')
|
|
220
225
|
.action(options => {
|
|
221
226
|
// 必备参数:当开发者不传递该参数时,要解析为默认
|
|
222
227
|
const signModeTmp = options.disableSign && compileOptionsMeta.signModeEnum.NULL
|
package/lib/commands/compile.js
CHANGED
|
@@ -1,136 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (C) 2017, hapjs.org. All rights reserved.
|
|
5
|
-
*/
|
|
6
|
-
const webpack = require('webpack');
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
setCustomConfig,
|
|
10
|
-
colorconsole
|
|
11
|
-
} = require('@aiot-toolkit/shared-utils');
|
|
12
|
-
|
|
13
|
-
const genWebpackConf = require('../../gen-webpack-conf');
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
summaryErrors,
|
|
17
|
-
summaryWarnings
|
|
18
|
-
} = require('./utils'); // webpack watch 模式返回的watching实例
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let watching = null;
|
|
22
|
-
|
|
23
|
-
function showVersion() {
|
|
24
|
-
const toolkitVer = require('../../package.json').version;
|
|
25
|
-
|
|
26
|
-
const babelVer = require('@babel/core/package.json').version;
|
|
27
|
-
|
|
28
|
-
const webpackVer = require('webpack/package.json').version;
|
|
29
|
-
|
|
30
|
-
colorconsole.info(`aiot-toolkit: ${toolkitVer}; babel: ${babelVer}; webpack: ${webpackVer};`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
showVersion();
|
|
34
|
-
/**
|
|
35
|
-
* 调用 webpack 进行编译
|
|
36
|
-
*
|
|
37
|
-
* @module compile
|
|
38
|
-
* @param {String} platform - 目标平台: native
|
|
39
|
-
* @param {dev|prod} mode - 编译模式: dev、prod
|
|
40
|
-
* @param {Boolean} watch - 是否监听
|
|
41
|
-
* @param {Object} [options={}] - 动态生成 webpack 配置项的参数对象
|
|
42
|
-
* @param {String} [options.cwd] - 工作目录
|
|
43
|
-
* @param {Writable} [options.log] - 日志输出流
|
|
44
|
-
* @param {String} [options.originType] - 打包来源,ide|cmd
|
|
45
|
-
* @param {Function} [options.onerror] - 错误回调函数
|
|
46
|
-
* @param {String} [options.setPreviewPkgPath] - 预览包保存路径,由IDE传入
|
|
47
|
-
* @returns {Promise} - 返回成功与否的信息
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
module.exports.compile = function compile(platform, mode, watch, options = {}) {
|
|
51
|
-
const errCb = options.onerror;
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
colorconsole.attach(options.log);
|
|
54
|
-
setCustomConfig(options.cwd); // IMPORTANT: set env variables before generating webpack config
|
|
55
|
-
|
|
56
|
-
process.env.NODE_PLATFORM = platform;
|
|
57
|
-
process.env.NODE_PHASE = mode;
|
|
58
|
-
|
|
59
|
-
function compilationCallback(err, stats) {
|
|
60
|
-
if (err) {
|
|
61
|
-
errCb && errCb(err);
|
|
62
|
-
colorconsole.error(err);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (stats) {
|
|
66
|
-
if (stats.hasErrors() || stats.hasWarnings()) {
|
|
67
|
-
const message = summaryErrors(stats);
|
|
68
|
-
const warningMsg = summaryWarnings(stats);
|
|
69
|
-
errCb && errCb(message);
|
|
70
|
-
colorconsole.error(message);
|
|
71
|
-
colorconsole.warn(warningMsg);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (stats.hasErrors()) {
|
|
75
|
-
process.exitCode = 1;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const webpackMode = mode === 'prod' ? 'production' : 'development';
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
const webpackConfig = genWebpackConf(options, webpackMode);
|
|
84
|
-
|
|
85
|
-
if (watch) {
|
|
86
|
-
const compiler = webpack(webpackConfig);
|
|
87
|
-
watching = compiler.watch({
|
|
88
|
-
aggregateTimeout: 300
|
|
89
|
-
}, (err, stats) => {
|
|
90
|
-
compilationCallback(err, stats);
|
|
91
|
-
resolve({
|
|
92
|
-
compileError: err,
|
|
93
|
-
stats,
|
|
94
|
-
watching
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
} else {
|
|
98
|
-
webpack(webpackConfig, (err, stats) => {
|
|
99
|
-
compilationCallback(err, stats);
|
|
100
|
-
resolve({
|
|
101
|
-
compileError: err,
|
|
102
|
-
stats
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
} catch (err) {
|
|
107
|
-
reject(err);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* 停止 webpack watch监听
|
|
113
|
-
*
|
|
114
|
-
* @module stopWatch
|
|
115
|
-
* @returns {Promise} - 返回成功与否的信息
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
module.exports.stopWatch = function () {
|
|
120
|
-
return new Promise(resolve => {
|
|
121
|
-
if (watching) {
|
|
122
|
-
watching.close(() => {
|
|
123
|
-
watching = null;
|
|
124
|
-
resolve({
|
|
125
|
-
stopWatchError: null
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
resolve({
|
|
132
|
-
stopWatchError: 'no watching'
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
};
|
|
1
|
+
"use strict";const webpack=require("webpack"),{setCustomConfig:setCustomConfig,colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),genWebpackConf=require("../../gen-webpack-conf"),{summaryErrors:summaryErrors,summaryWarnings:summaryWarnings}=require("./utils");let watching=null;function showVersion(){const o=require("../../package.json").version,r=require("@babel/core/package.json").version,e=require("webpack/package.json").version;colorconsole.info(`aiot-toolkit: ${o}; babel: ${r}; webpack: ${e};`)}showVersion(),module.exports.compile=function(o,r,e,s={}){const n=s.onerror;return new Promise(((c,t)=>{function a(o,r){if(o&&(n&&n(o),colorconsole.error(o)),r){if(r.hasErrors()||r.hasWarnings()){const o=summaryErrors(r),e=summaryWarnings(r);n&&n(o),colorconsole.error(o),colorconsole.warn(e)}r.hasErrors()&&(process.exitCode=1)}}colorconsole.attach(s.log),setCustomConfig(s.cwd),process.env.NODE_PLATFORM=o,process.env.NODE_PHASE=r;const i="prod"===r?"production":"development";try{const o=genWebpackConf(s,i);if(e){const r=webpack(o);watching=r.watch({aggregateTimeout:300},((o,r)=>{a(o,r),c({compileError:o,stats:r,watching:watching})}))}else webpack(o,((o,r)=>{a(o,r),c({compileError:o,stats:r})}))}catch(o){t(o)}}))},module.exports.stopWatch=function(){return new Promise((o=>{watching?watching.close((()=>{watching=null,o({stopWatchError:null})})):o({stopWatchError:"no watching"})}))};
|
|
136
2
|
//# sourceMappingURL=compile.js.map
|