ko 5.3.1 → 5.3.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.
@@ -32,7 +32,6 @@ class Dev extends creator_1.WebpackCreator {
32
32
  overlay: false,
33
33
  },
34
34
  setupExitSignals: true,
35
- open: true,
36
35
  };
37
36
  return { ...defaultDevServerConfig, ...userDefinedDevServerConfig };
38
37
  }
@@ -68,19 +67,21 @@ class Dev extends creator_1.WebpackCreator {
68
67
  return this.changePort(newPort, port);
69
68
  }
70
69
  }
71
- getUrlHost(host) {
72
- const regex = /^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*$/i;
73
- return regex.test(host) ? host : `http://${host}`;
74
- }
75
70
  async action() {
76
- const { port, host } = this.devSerConf();
71
+ const devSerConf = this.devSerConf();
72
+ const { port } = devSerConf;
77
73
  const newPort = await this.checkPort(parseInt(port));
78
- if (!newPort)
79
- return;
74
+ if (!newPort) {
75
+ process.exit(0);
76
+ }
77
+ devSerConf.port = newPort;
80
78
  const compiler = (0, webpack_1.default)(this.config());
81
- const devServer = new webpack_dev_server_1.default(this.devSerConf(), compiler);
82
- console.log(`dev server start at ${this.getUrlHost(host)}:${newPort}`);
79
+ const devServer = new webpack_dev_server_1.default(devSerConf, compiler);
83
80
  await devServer.start();
81
+ process.stdin.on('end', () => {
82
+ devServer.stop();
83
+ process.exit(0);
84
+ });
84
85
  }
85
86
  }
86
87
  exports.default = Dev;
package/lib/cli.js CHANGED
@@ -20,6 +20,7 @@ program
20
20
  .option('-t,--ts,--typescript', 'support typescript')
21
21
  .option('-e,--esbuild', 'enable esbuild')
22
22
  .action((opts) => {
23
+ process.env.NODE_ENV = 'production';
23
24
  const buildInstance = new build_1.default(opts);
24
25
  buildInstance.action();
25
26
  });
@@ -31,11 +31,12 @@ const scriptLoader = [
31
31
  require.resolve('babel-preset-ko-app'),
32
32
  {
33
33
  useAbsoluteRuntime: true,
34
- customizePlugins: config_1.default.babelPlugins,
35
34
  },
36
35
  ],
37
36
  ],
38
- plugins: [require.resolve('react-refresh/babel')],
37
+ plugins: config_1.default.isProductionEnv
38
+ ? [require.resolve('react-refresh/babel')]
39
+ : [],
39
40
  babelrc: false,
40
41
  configFile: false,
41
42
  cacheIdentifier: (0, getCacheIdentifier_1.default)(config_1.default.isProductionEnv ? 'production' : '', ['babel-preset-ko-app', 'react-dev-utils', 'ko']),
@@ -6,15 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const webpack_1 = require("webpack");
7
7
  const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
8
8
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
9
- const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
10
9
  const react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
11
10
  const webpackbar_1 = __importDefault(require("webpackbar"));
12
11
  const config_1 = __importDefault(require("../utils/config"));
13
12
  function getPlugins() {
14
- const { userConf, defaultPaths } = config_1.default;
15
- const publicPath = userConf.output && userConf.output.publicPath
16
- ? userConf.output.publicPath
17
- : '/';
13
+ const { userConf } = config_1.default;
18
14
  let plugins = [
19
15
  new webpack_1.IgnorePlugin({
20
16
  resourceRegExp: /^\.\/locale$/,
@@ -26,14 +22,6 @@ function getPlugins() {
26
22
  chunkFilename: 'css/[id].[contenthash].css',
27
23
  }),
28
24
  new case_sensitive_paths_webpack_plugin_1.default(),
29
- new html_webpack_plugin_1.default({
30
- template: defaultPaths.html,
31
- title: 'Ko App',
32
- templateParameters: {
33
- configPath: `${publicPath}config/config.js`,
34
- },
35
- inject: 'body',
36
- }),
37
25
  new react_refresh_webpack_plugin_1.default(),
38
26
  new webpackbar_1.default(),
39
27
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ko",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "build & lint library",
5
5
  "keywords": [
6
6
  "ko",
@@ -48,7 +48,6 @@
48
48
  "css-minimizer-webpack-plugin": "^3.4.1",
49
49
  "detect-port": "^1.3.0",
50
50
  "esbuild-loader": "^2.18.0",
51
- "html-webpack-plugin": "^5.5.0",
52
51
  "inquirer": "^8.2.0",
53
52
  "less": "^3.13.1",
54
53
  "less-loader": "^9.1.0",