swico 0.8.2-beta4 → 0.8.2-beta6

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-beta4",
3
+ "version": "0.8.2-beta6",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -51,8 +51,8 @@ function default_1() {
51
51
  switch (_a.label) {
52
52
  case 0:
53
53
  process.env.SWICO_ENV = 'prod';
54
- tools_1.toast.info("v".concat(package_json_1.default.version));
55
- tools_1.toast.info('Initializing production config...');
54
+ tools_1.toast.info("v".concat(package_json_1.default.version), { wrap: false });
55
+ tools_1.toast.info('Initializing production config...', { wrap: false });
56
56
  return [4, (0, tools_1.initIndexFile)()];
57
57
  case 1:
58
58
  _a.sent();
@@ -132,6 +132,22 @@ var getMockGetLogger = function (compiler) {
132
132
  return __assign(__assign({}, logger), { log: log, debug: debug, error: error, warn: warn, info: function () { } });
133
133
  };
134
134
  };
135
+ var createCompileListener = function (compiler) {
136
+ compiler.hooks.beforeCompile.tap('beforeCompile', function () {
137
+ tools_1.toast.info('Compiling...', { wrap: false });
138
+ });
139
+ compiler.hooks.done.tap('done', function (stats) {
140
+ var info = stats.toJson();
141
+ if (stats.hasErrors()) {
142
+ tools_1.toast.error(info.errors.map(function (item) { return item.stack; }));
143
+ return;
144
+ }
145
+ if (stats.hasWarnings()) {
146
+ tools_1.toast.warning(info.warnings.map(function (item) { return item.stack; }));
147
+ }
148
+ tools_1.toast.info("Compiled complete in ".concat(info.time, "ms"));
149
+ });
150
+ };
135
151
  function start() {
136
152
  return __awaiter(this, void 0, void 0, function () {
137
153
  var _a, projectConfig, projectPath, startConfig, compiler, oriLogger, devServer, e_1, strErr;
@@ -140,8 +156,8 @@ function start() {
140
156
  case 0:
141
157
  process.env.SWICO_ENV = 'dev';
142
158
  if (RESTART !== 'true') {
143
- tools_1.toast.info("v".concat(package_json_1.default.version));
144
- tools_1.toast.info('Initializing development config...');
159
+ tools_1.toast.info("v".concat(package_json_1.default.version), { wrap: false });
160
+ tools_1.toast.info('Initializing development config...', { wrap: false });
145
161
  }
146
162
  return [4, (0, tools_1.initIndexFile)()];
147
163
  case 1:
@@ -166,25 +182,16 @@ function start() {
166
182
  oriLogger = compiler.getInfrastructureLogger;
167
183
  compiler.getInfrastructureLogger = getMockGetLogger(compiler);
168
184
  devServer = new webpack_dev_server_1.default(__assign(__assign({}, startConfig.devServer), { port: availablePort }), compiler);
169
- compiler.hooks.beforeCompile.tap('beforeCompile', function () {
170
- tools_1.toast.info('Compiling...', { wrap: false });
171
- });
172
- compiler.watch({}, function (err, stats) {
173
- var info = stats.toJson();
174
- if (err || stats.hasErrors() || stats.hasWarnings()) {
175
- return;
176
- }
177
- tools_1.toast.info("Compiled successfully in ".concat(info.time, "ms"), { wrap: false });
178
- });
179
185
  _b.label = 7;
180
186
  case 7:
181
187
  _b.trys.push([7, 9, , 10]);
182
188
  return [4, devServer.start()];
183
189
  case 8:
184
190
  _b.sent();
191
+ createCompileListener(compiler);
185
192
  compiler.getInfrastructureLogger = oriLogger;
186
193
  handleWatch(projectPath, devServer);
187
- tools_1.toast.info("Project is running at\uFF1A".concat((chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort, "/")), { wrap: false })));
194
+ tools_1.toast.info("Project is running at\uFF1A".concat(chalk_1.default.hex('#29abe0')("".concat(startConfig.devServer.server, "://localhost:").concat(availablePort, "/"))), { wrap: false });
188
195
  return [3, 10];
189
196
  case 9:
190
197
  e_1 = _b.sent();
@@ -129,6 +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
  extensions: templateType === 'vue' ? ['vue', 'ts', 'js'] : ['tsx', 'ts', 'js'],
132
+ emitError: false,
133
+ emitWarning: false,
132
134
  cache: true
133
135
  })
134
136
  ], ((_e = (_d = customConfig.dev) === null || _d === void 0 ? void 0 : _d.plugins) !== null && _e !== void 0 ? _e : []), true)