ko 6.3.4 → 6.4.1

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.
@@ -32,6 +32,10 @@ class Build extends factory_1.ActionFactory {
32
32
  context: ret.plugins,
33
33
  });
34
34
  ret.plugins = plugins;
35
+ await this.service.apply({
36
+ key: this.service.hookKeySet.MODIFY_WEBPACK,
37
+ context: ret,
38
+ });
35
39
  return ret;
36
40
  }
37
41
  registerCommand() {
@@ -12,7 +12,7 @@ class Dev extends factory_1.default {
12
12
  super(service);
13
13
  }
14
14
  get devServerConfig() {
15
- const { serve, publicPath } = this.service.config;
15
+ const { serve, publicPath, logLevel } = this.service.config;
16
16
  const { host, port, proxy, staticPath } = serve;
17
17
  return {
18
18
  port,
@@ -28,7 +28,7 @@ class Dev extends factory_1.default {
28
28
  allowedHosts: 'all',
29
29
  client: {
30
30
  overlay: false,
31
- logging: 'none',
31
+ logging: logLevel,
32
32
  },
33
33
  };
34
34
  }
@@ -56,6 +56,10 @@ class Dev extends factory_1.default {
56
56
  }
57
57
  : speedUp,
58
58
  };
59
+ await this.service.apply({
60
+ key: this.service.hookKeySet.MODIFY_WEBPACK,
61
+ context: ret,
62
+ });
59
63
  return ret;
60
64
  }
61
65
  registerCommand() {
@@ -52,6 +52,7 @@ class Config {
52
52
  disableLazyImports: false,
53
53
  },
54
54
  autoPolyfills: false,
55
+ logLevel: 'error',
55
56
  };
56
57
  }
57
58
  }
package/lib/core/hooks.js CHANGED
@@ -2,13 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tapable_1 = require("tapable");
4
4
  const types_1 = require("../types");
5
- var HOOK_KEY_SET;
6
- (function (HOOK_KEY_SET) {
7
- HOOK_KEY_SET["WEBPACK_PLUGIN"] = "WebpackPlugin";
8
- })(HOOK_KEY_SET || (HOOK_KEY_SET = {}));
9
5
  class Hooks {
10
6
  constructor() {
11
- this.hookKeySet = HOOK_KEY_SET;
7
+ this.hookKeySet = types_1.HOOK_KEY_SET;
12
8
  this.hooks = {};
13
9
  }
14
10
  register({ key, action, opts }) {
@@ -21,6 +17,8 @@ class Hooks {
21
17
  }
22
18
  apply(opts) {
23
19
  const hooks = this.hooks[opts.key];
20
+ if (!hooks)
21
+ return Promise.resolve(opts.context);
24
22
  const tapInstance = new tapable_1.AsyncSeriesWaterfallHook(['ctx']);
25
23
  hooks[types_1.ACTION.ADD].forEach(hook => {
26
24
  tapInstance.tapPromise({ name: hook.name, stage: hook.stage, before: hook.before }, async (ctx) => {
@@ -6,12 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const commander_1 = __importDefault(require("./commander"));
7
7
  const hooks_1 = __importDefault(require("./hooks"));
8
8
  const config_1 = __importDefault(require("./config"));
9
+ const types_1 = require("../types");
9
10
  class Service extends hooks_1.default {
10
11
  constructor() {
11
12
  super();
12
13
  this.commander = new commander_1.default();
13
14
  this.config = new config_1.default().generate();
14
- this.config.plugins && this.config.plugins.forEach(p => this.register(p));
15
+ this.config.plugins &&
16
+ this.config.plugins.forEach(p => {
17
+ // MODIFY_WEBPACK only support UPDATE
18
+ if (p.key === types_1.HOOK_KEY_SET.MODIFY_WEBPACK) {
19
+ p.action = types_1.ACTION.UPDATE;
20
+ }
21
+ this.register(p);
22
+ });
15
23
  }
16
24
  freezeCliOptsWith(cliOpts) {
17
25
  this.cliOpts = Object.freeze(cliOpts);
package/lib/types.js CHANGED
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ACTION = void 0;
3
+ exports.HOOK_KEY_SET = exports.ACTION = void 0;
4
4
  var ACTION;
5
5
  (function (ACTION) {
6
6
  ACTION["ADD"] = "add";
7
7
  ACTION["UPDATE"] = "update";
8
8
  })(ACTION = exports.ACTION || (exports.ACTION = {}));
9
+ var HOOK_KEY_SET;
10
+ (function (HOOK_KEY_SET) {
11
+ HOOK_KEY_SET["WEBPACK_PLUGIN"] = "WebpackPlugin";
12
+ HOOK_KEY_SET["MODIFY_WEBPACK"] = "ModifyWebpack";
13
+ })(HOOK_KEY_SET = exports.HOOK_KEY_SET || (exports.HOOK_KEY_SET = {}));
@@ -54,6 +54,16 @@ class WebpackConfig {
54
54
  (0, utils_1.assert)((0, fs_1.existsSync)(pkgPath), 'project package.json file not found');
55
55
  return require(pkgPath).version;
56
56
  }
57
+ get stats() {
58
+ const mapping = {
59
+ info: 'normal',
60
+ error: 'errors-only',
61
+ warn: 'errors-warnings',
62
+ none: 'none',
63
+ };
64
+ const { logLevel } = this.opts;
65
+ return mapping[logLevel];
66
+ }
57
67
  get base() {
58
68
  const { cwd, publicPath, entry, outputPath, alias, hash, analyzer } = this.opts;
59
69
  const webpackBaseConf = {
@@ -101,8 +111,9 @@ class WebpackConfig {
101
111
  hints: false,
102
112
  },
103
113
  cache: this.cache,
104
- stats: {
105
- cachedModules: false,
114
+ stats: this.stats,
115
+ infrastructureLogging: {
116
+ level: 'error',
106
117
  },
107
118
  };
108
119
  return webpackBaseConf;
@@ -17,6 +17,7 @@ class Script {
17
17
  {
18
18
  test: /\.worker.[jt]s$/,
19
19
  loader: this.WORKER_LOADER,
20
+ include: (input) => input.includes('dt-react-monaco-editor/lib/languages'),
20
21
  options: {
21
22
  inline: 'fallback',
22
23
  },
@@ -11,6 +11,7 @@ const postCssUrl = require('postcss-url');
11
11
  const utils_1 = require("../../utils");
12
12
  class Style {
13
13
  constructor(opts) {
14
+ this.STYLE_LOADER = (0, utils_1.getResolvePath)('style-loader');
14
15
  this.CSS_LOADER = (0, utils_1.getResolvePath)('css-loader');
15
16
  this.SASS_LOADER = (0, utils_1.getResolvePath)('sass-loader');
16
17
  this.LESS_LOADER = (0, utils_1.getResolvePath)('less-loader');
@@ -95,7 +96,7 @@ class Style {
95
96
  }
96
97
  get styleLoader() {
97
98
  return {
98
- loader: mini_css_extract_plugin_1.loader,
99
+ loader: this.opts.isProd ? mini_css_extract_plugin_1.loader : this.STYLE_LOADER,
99
100
  };
100
101
  }
101
102
  get cssLoader() {
@@ -57,10 +57,11 @@ function getPlugins(opts) {
57
57
  },
58
58
  },
59
59
  }),
60
- new mini_css_extract_plugin_1.default({
61
- filename: isProd ? 'css/[name].[contenthash].css' : 'css/[name].css',
62
- chunkFilename: isProd ? 'css/[id].[contenthash].css' : 'css/[id].css',
63
- }),
60
+ isProd &&
61
+ new mini_css_extract_plugin_1.default({
62
+ filename: 'css/[name].[contenthash].css',
63
+ chunkFilename: 'css/[id].[contenthash].css',
64
+ }),
64
65
  new case_sensitive_paths_webpack_plugin_1.default(),
65
66
  new html_webpack_plugin_1.default({
66
67
  template: htmlTemplate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ko",
3
- "version": "6.3.4",
3
+ "version": "6.4.1",
4
4
  "description": "build & lint library",
5
5
  "keywords": [
6
6
  "ko",