@modern-js/server 1.16.0 → 1.17.0

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,25 @@
1
1
  # @modern-js/server
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 151329d: chore(dev-server): no longer depend on @modern-js/webpack
8
+
9
+ chore(dev-server): 不再依赖 @modern-js/webpack
10
+
11
+ - Updated dependencies [1b9176f]
12
+ - Updated dependencies [77d3a38]
13
+ - Updated dependencies [151329d]
14
+ - Updated dependencies [5af9472]
15
+ - Updated dependencies [6b6a534]
16
+ - Updated dependencies [6b43a2b]
17
+ - Updated dependencies [a7be124]
18
+ - Updated dependencies [31547b4]
19
+ - @modern-js/utils@1.17.0
20
+ - @modern-js/prod-server@1.17.0
21
+ - @modern-js/server-utils@1.17.0
22
+
3
23
  ## 1.16.0
4
24
 
5
25
  ### Patch Changes
@@ -1,9 +1,5 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
- import { webpack } from '@modern-js/webpack';
4
- const {
5
- EntryPlugin
6
- } = webpack;
7
3
  export default class DevServerPlugin {
8
4
  constructor(options) {
9
5
  _defineProperty(this, "options", void 0);
@@ -20,7 +16,7 @@ export default class DevServerPlugin {
20
16
  const port = client.port ? `&port=${client.port}` : '';
21
17
  const clientEntry = `${require.resolve("../hmr-client")}?${host}${path}${port}`; // use a hook to add entries if available
22
18
 
23
- new EntryPlugin(compiler.context, clientEntry, {
19
+ new compiler.webpack.EntryPlugin(compiler.context, clientEntry, {
24
20
  name: undefined
25
21
  }).apply(compiler);
26
22
  }
@@ -32,11 +28,14 @@ export default class DevServerPlugin {
32
28
 
33
29
 
34
30
  const compilerOptions = compiler.options;
31
+ const {
32
+ HotModuleReplacementPlugin
33
+ } = compiler.webpack;
35
34
  compilerOptions.plugins = compilerOptions.plugins || [];
36
35
 
37
- if (!compilerOptions.plugins.find(p => p.constructor === webpack.HotModuleReplacementPlugin)) {
36
+ if (!compilerOptions.plugins.find(p => p.constructor === HotModuleReplacementPlugin)) {
38
37
  // apply the HMR plugin, if it didn't exist before.
39
- const plugin = new webpack.HotModuleReplacementPlugin();
38
+ const plugin = new HotModuleReplacementPlugin();
40
39
  plugin.apply(compiler);
41
40
  }
42
41
  }
@@ -8,7 +8,7 @@ import { createServer } from 'http';
8
8
  import path from 'path';
9
9
  import { createServer as createHttpsServer } from 'https';
10
10
  import { API_DIR, SERVER_DIR, SHARED_DIR } from '@modern-js/utils';
11
- import webpackDevMiddleware from '@modern-js/webpack/webpack-dev-middleware';
11
+ import webpackDevMiddleware from '@modern-js/utils/webpack-dev-middleware';
12
12
  import { createProxyHandler, ModernServer, AGGRED_DIR } from '@modern-js/prod-server';
13
13
  import { getDefaultDevOptions } from "../constants";
14
14
  import { createMockHandler } from "../dev-tools/mock";
@@ -1 +0,0 @@
1
- export {};
@@ -5,14 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _webpack = require("@modern-js/webpack");
9
-
10
8
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
9
 
12
- const {
13
- EntryPlugin
14
- } = _webpack.webpack;
15
-
16
10
  class DevServerPlugin {
17
11
  constructor(options) {
18
12
  _defineProperty(this, "options", void 0);
@@ -29,7 +23,7 @@ class DevServerPlugin {
29
23
  const port = client.port ? `&port=${client.port}` : '';
30
24
  const clientEntry = `${require.resolve("../hmr-client")}?${host}${path}${port}`; // use a hook to add entries if available
31
25
 
32
- new EntryPlugin(compiler.context, clientEntry, {
26
+ new compiler.webpack.EntryPlugin(compiler.context, clientEntry, {
33
27
  name: undefined
34
28
  }).apply(compiler);
35
29
  }
@@ -41,11 +35,14 @@ class DevServerPlugin {
41
35
 
42
36
 
43
37
  const compilerOptions = compiler.options;
38
+ const {
39
+ HotModuleReplacementPlugin
40
+ } = compiler.webpack;
44
41
  compilerOptions.plugins = compilerOptions.plugins || [];
45
42
 
46
- if (!compilerOptions.plugins.find(p => p.constructor === _webpack.webpack.HotModuleReplacementPlugin)) {
43
+ if (!compilerOptions.plugins.find(p => p.constructor === HotModuleReplacementPlugin)) {
47
44
  // apply the HMR plugin, if it didn't exist before.
48
- const plugin = new _webpack.webpack.HotModuleReplacementPlugin();
45
+ const plugin = new HotModuleReplacementPlugin();
49
46
  plugin.apply(compiler);
50
47
  }
51
48
  }
@@ -13,7 +13,7 @@ var _https = require("https");
13
13
 
14
14
  var _utils = require("@modern-js/utils");
15
15
 
16
- var _webpackDevMiddleware = _interopRequireDefault(require("@modern-js/webpack/webpack-dev-middleware"));
16
+ var _webpackDevMiddleware = _interopRequireDefault(require("@modern-js/utils/webpack-dev-middleware"));
17
17
 
18
18
  var _prodServer = require("@modern-js/prod-server");
19
19
 
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,5 +1,5 @@
1
- import { webpack } from '@modern-js/webpack';
2
- import { DevServerOptions } from '../types';
1
+ import type webpack from 'webpack';
2
+ import type { DevServerOptions } from '../types';
3
3
  export default class DevServerPlugin {
4
4
  private readonly options;
5
5
  constructor(options: DevServerOptions);
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import { Server } from 'http';
3
3
  import ws from 'ws';
4
- import type { webpack } from '@modern-js/webpack';
5
- import { DevServerOptions } from '../types';
4
+ import type webpack from 'webpack';
5
+ import type { DevServerOptions } from '../types';
6
6
  export default class SocketServer {
7
7
  private wsServer;
8
8
  private readonly sockets;
@@ -1,5 +1,5 @@
1
- import { ModernServerOptions } from '@modern-js/prod-server';
2
- import type { webpack } from '@modern-js/webpack';
1
+ import type webpack from 'webpack';
2
+ import type { ModernServerOptions } from '@modern-js/prod-server';
3
3
  export declare type DevServerOptions = {
4
4
  client: {
5
5
  path?: string;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.16.0",
14
+ "version": "1.17.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -30,21 +30,20 @@
30
30
  "dependencies": {
31
31
  "@babel/core": "^7.18.0",
32
32
  "@babel/register": "^7.17.7",
33
- "@modern-js/prod-server": "1.16.0",
34
- "@modern-js/server-utils": "1.16.0",
35
- "@modern-js/webpack": "1.16.0",
36
- "@modern-js/utils": "1.16.0",
33
+ "@modern-js/prod-server": "1.17.0",
34
+ "@modern-js/server-utils": "1.17.0",
35
+ "@modern-js/utils": "1.17.0",
37
36
  "devcert": "^1.2.2",
38
37
  "minimatch": "^3.0.4",
39
38
  "path-to-regexp": "^6.2.0",
40
39
  "ws": "^8.2.0"
41
40
  },
42
41
  "devDependencies": {
43
- "@modern-js/core": "1.16.0",
44
- "@modern-js/server-core": "1.16.0",
45
- "@modern-js/types": "1.16.0",
46
- "@scripts/build": "1.15.0",
47
- "@scripts/jest-config": "1.15.0",
42
+ "@modern-js/core": "1.17.0",
43
+ "@modern-js/server-core": "1.17.0",
44
+ "@modern-js/types": "1.17.0",
45
+ "@scripts/build": "1.17.0",
46
+ "@scripts/jest-config": "1.17.0",
48
47
  "@types/jest": "^27",
49
48
  "@types/minimatch": "^3.0.5",
50
49
  "@types/node": "^14",