aiot-toolkit 1.0.20 → 1.0.21-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ #### [1.0.20] - 2024-01-02
4
+
5
+ - 支持 `services` 配置数组格式
6
+ - 支持媒体查询 `designWidth` 字符串值
7
+ - 支持媒体查询 `device-type` 属性
8
+ - 修复合并用户的 `webpack` 配置使用深层合并的问题
9
+ - 修复 `feature` 未定义时报错的问题
10
+ - 修复分包时 `$app_evaluate$` 未执行的问题
11
+ - 优化 `MEDIA` 放到样式的最后以便生效
12
+ - 优化 `app_require` 使用包裹函数的方式
13
+
3
14
  #### [1.0.19] - 2023-10-24
4
15
 
5
16
  - 支持 `protobuf` 二进制版本 css 添加 `object` 值
package/README.md CHANGED
@@ -41,6 +41,17 @@ npm run release
41
41
 
42
42
  ### 版本日志(详情请在 node_modules 中查看 CHANGELOG)
43
43
 
44
+ #### [1.0.20] - 2024-01-02
45
+
46
+ - 支持 `services` 配置数组格式
47
+ - 支持媒体查询 `designWidth` 字符串值
48
+ - 支持媒体查询 `device-type` 属性
49
+ - 修复合并用户的 `webpack` 配置使用深层合并的问题
50
+ - 修复 `feature` 未定义时报错的问题
51
+ - 修复分包时 `$app_evaluate$` 未执行的问题
52
+ - 优化 `MEDIA` 放到样式的最后以便生效
53
+ - 优化 `app_require` 使用包裹函数的方式
54
+
44
55
  #### [1.0.19] - 2023-10-24
45
56
 
46
57
  - 支持 `protobuf` 二进制版本 css 添加 `object` 值
@@ -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