swico 0.8.2-beta9 → 0.8.3-beta1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "0.8.2-beta9",
3
+ "version": "0.8.3-beta1",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -77,11 +77,11 @@ function default_1() {
77
77
  }
78
78
  var info = stats.toJson();
79
79
  if (stats.hasErrors()) {
80
- tools_1.toast.error(info.errors.map(function (item) { return item.stack; }));
80
+ tools_1.toast.error(info.errors.map(function (item) { return item.stack || item.message; }));
81
81
  return;
82
82
  }
83
83
  if (stats.hasWarnings()) {
84
- tools_1.toast.warning(info.warnings.map(function (item) { return item.stack; }));
84
+ tools_1.toast.warning(info.warnings.map(function (item) { return item.stack || item.message; }));
85
85
  }
86
86
  tools_1.toast.success('Building complete');
87
87
  });
@@ -136,26 +136,16 @@ var createCompileListener = function (compiler) {
136
136
  compiler.hooks.beforeCompile.tap('beforeCompile', function () {
137
137
  tools_1.toast.info('Compiling...', { wrap: false });
138
138
  });
139
- compiler.hooks;
140
139
  compiler.hooks.done.tap('done', function (stats) {
141
- console.log('done');
142
- var info = stats.toJson();
143
- if (stats.hasErrors()) {
144
- tools_1.toast.error(info.errors.map(function (item) { return item.stack; }));
140
+ var info = stats === null || stats === void 0 ? void 0 : stats.toJson();
141
+ if (stats === null || stats === void 0 ? void 0 : stats.hasErrors()) {
142
+ tools_1.toast.error(info === null || info === void 0 ? void 0 : info.errors.map(function (item) { return item.message || item.stack; }));
145
143
  return;
146
144
  }
147
- if (stats.hasWarnings()) {
148
- tools_1.toast.warning(info.warnings.map(function (item) { return item.stack; }));
145
+ if (stats === null || stats === void 0 ? void 0 : stats.hasWarnings()) {
146
+ tools_1.toast.warning(info === null || info === void 0 ? void 0 : info.warnings.map(function (item) { return item.message || item.stack; }));
149
147
  }
150
- tools_1.toast.info("Compiled complete in ".concat(info.time, "ms"));
151
- });
152
- compiler.watch({}, function (err, stats) {
153
- console.log('watch');
154
- var info = stats.toJson();
155
- if (err || stats.hasErrors() || stats.hasWarnings()) {
156
- return;
157
- }
158
- tools_1.toast.info("Compiled successfully in ".concat(info.time, "ms"), { wrap: false });
148
+ tools_1.toast.info("Compiled complete in ".concat(info === null || info === void 0 ? void 0 : info.time, "ms"));
159
149
  });
160
150
  };
161
151
  function start() {
@@ -129,9 +129,8 @@ function default_1(options) {
129
129
  new eslint_webpack_plugin_1.default({
130
130
  context: path_1.default.join(projectPath, '/src'),
131
131
  failOnError: false,
132
- failOnWarning: false,
132
+ failOnWarning: true,
133
133
  extensions: templateType === 'vue' ? ['vue', 'ts', 'js'] : ['tsx', 'ts', 'js'],
134
- emitError: false,
135
134
  emitWarning: false,
136
135
  cache: true
137
136
  })
@@ -9,8 +9,8 @@ interface ToastOptions {
9
9
  export declare const toast: {
10
10
  info: (message: string, options?: ToastOptions) => void;
11
11
  success: (message: string, options?: ToastOptions) => void;
12
- error: (message: string | string[]) => void;
13
- warning: (message: string | string[]) => void;
12
+ error: (message: string | string[], title?: string) => void;
13
+ warning: (message: string | string[], title?: string) => void;
14
14
  };
15
15
  export declare const initIndexFile: () => Promise<void>;
16
16
  export {};
@@ -214,27 +214,29 @@ exports.toast = {
214
214
  var _a = (options || {}).wrap, wrap = _a === void 0 ? true : _a;
215
215
  console.log("".concat(chalk_1.default.hex('#32f264').bold('swico'), " - ").concat(message).concat(wrap ? '\n' : ''));
216
216
  },
217
- error: function (message) {
218
- console.log("".concat(chalk_1.default.red.bold('error'), " - There are some errors about Swico\uFF1A \n"));
217
+ error: function (message, title) {
218
+ console.log("".concat(chalk_1.default.red.bold('error'), " - ").concat(title || 'There are some errors about Swico', "\uFF1A \n"));
219
219
  if (Array.isArray(message)) {
220
220
  message.forEach(function (item) {
221
- console.log(" > ".concat(chalk_1.default.red.bold(item), " \n"));
221
+ console.log(" > ".concat(chalk_1.default.red.bold(item)));
222
222
  });
223
223
  }
224
224
  else if (message) {
225
- console.log(" > ".concat(chalk_1.default.red.bold(message), " \n"));
225
+ console.log(" > ".concat(chalk_1.default.red.bold(message)));
226
226
  }
227
+ console.log('\n');
227
228
  },
228
- warning: function (message) {
229
- console.log("".concat(chalk_1.default.red.bold('#fb8918'), " - There are some errors about Swico\uFF1A \n"));
229
+ warning: function (message, title) {
230
+ console.log("".concat(chalk_1.default.hex('#fb8918').bold('warning'), " - ").concat(title || 'There are some warnings about Swico', "\uFF1A \n"));
230
231
  if (Array.isArray(message)) {
231
232
  message.forEach(function (item) {
232
- console.log(" > ".concat(chalk_1.default.hex('#fb8918').bold(item), " \n"));
233
+ console.log(" > ".concat(chalk_1.default.hex('#fb8918').bold(item)));
233
234
  });
234
235
  }
235
236
  else if (message) {
236
- console.log(" > ".concat(chalk_1.default.hex('#fb8918').bold(message), " \n"));
237
+ console.log(" > ".concat(chalk_1.default.hex('#fb8918').bold(message)));
237
238
  }
239
+ console.log('\n');
238
240
  }
239
241
  };
240
242
  var initIndexFile = function () { return __awaiter(void 0, void 0, void 0, function () {