@modern-js/server 2.1.0 → 2.3.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,38 @@
1
1
  # @modern-js/server
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ff48fc2: fix(server): hmr protocol set error
8
+
9
+ fix(server): 修复 hmr protocol 配置错误问题
10
+
11
+ - Updated dependencies [fd5a3ed]
12
+ - Updated dependencies [6ca1c0b]
13
+ - Updated dependencies [89b6739]
14
+ - @modern-js/utils@2.3.0
15
+ - @modern-js/prod-server@2.3.0
16
+ - @modern-js/server-utils@2.3.0
17
+ - @modern-js/types@2.3.0
18
+
19
+ ## 2.2.0
20
+
21
+ ### Patch Changes
22
+
23
+ - 9fc6de9: chore(devServer): make hmr client protocol configurable
24
+
25
+ chore(devServer): 支持配置 hmr client protocol
26
+
27
+ - Updated dependencies [cb12ee7]
28
+ - Updated dependencies [49eff0c]
29
+ - Updated dependencies [2d3e3df]
30
+ - Updated dependencies [19bb384]
31
+ - @modern-js/server-utils@2.2.0
32
+ - @modern-js/utils@2.2.0
33
+ - @modern-js/prod-server@2.2.0
34
+ - @modern-js/types@2.2.0
35
+
3
36
  ## 2.1.0
4
37
 
5
38
  ### Patch Changes
@@ -29,7 +29,7 @@ function formatURL({
29
29
  function getSocketUrl(urlParts, location) {
30
30
  const { host, port, path, protocol } = urlParts;
31
31
  return formatURL({
32
- protocol: protocol || location.protocol === "https:" ? "wss" : "ws",
32
+ protocol: protocol || (location.protocol === "https:" ? "wss" : "ws"),
33
33
  hostname: host || location.hostname,
34
34
  port: port || location.port,
35
35
  pathname: path || HMR_SOCK_PATH
@@ -39,10 +39,11 @@ import SocketServer from "./socket-server";
39
39
  const noop = () => {
40
40
  };
41
41
  function getHMRClientPath(client) {
42
+ const protocol = (client == null ? void 0 : client.protocol) ? `&protocol=${client.protocol}` : "";
42
43
  const host = (client == null ? void 0 : client.host) ? `&host=${client.host}` : "";
43
44
  const path = (client == null ? void 0 : client.path) ? `&path=${client.path}` : "";
44
45
  const port = (client == null ? void 0 : client.port) ? `&port=${client.port}` : "";
45
- const clientEntry = `${require.resolve("./hmr-client")}?${host}${path}${port}`;
46
+ const clientEntry = `${require.resolve("./hmr-client")}?${host}${path}${port}${protocol}`;
46
47
  return clientEntry;
47
48
  }
48
49
  class DevMiddleware extends EventEmitter {
@@ -52,7 +52,7 @@ function formatURL({
52
52
  function getSocketUrl(urlParts, location) {
53
53
  const { host, port, path, protocol } = urlParts;
54
54
  return formatURL({
55
- protocol: protocol || location.protocol === "https:" ? "wss" : "ws",
55
+ protocol: protocol || (location.protocol === "https:" ? "wss" : "ws"),
56
56
  hostname: host || location.hostname,
57
57
  port: port || location.port,
58
58
  pathname: path || import_constants.HMR_SOCK_PATH
@@ -65,10 +65,11 @@ var import_socket_server = __toESM(require("./socket-server"));
65
65
  const noop = () => {
66
66
  };
67
67
  function getHMRClientPath(client) {
68
+ const protocol = (client == null ? void 0 : client.protocol) ? `&protocol=${client.protocol}` : "";
68
69
  const host = (client == null ? void 0 : client.host) ? `&host=${client.host}` : "";
69
70
  const path = (client == null ? void 0 : client.path) ? `&path=${client.path}` : "";
70
71
  const port = (client == null ? void 0 : client.port) ? `&port=${client.port}` : "";
71
- const clientEntry = `${require.resolve("./hmr-client")}?${host}${path}${port}`;
72
+ const clientEntry = `${require.resolve("./hmr-client")}?${host}${path}${port}${protocol}`;
72
73
  return clientEntry;
73
74
  }
74
75
  class DevMiddleware extends import_events.EventEmitter {
@@ -42,7 +42,7 @@ function formatURL(param) {
42
42
  function getSocketUrl(urlParts, location) {
43
43
  var host = urlParts.host, port = urlParts.port, path = urlParts.path, protocol = urlParts.protocol;
44
44
  return formatURL({
45
- protocol: protocol || location.protocol === "https:" ? "wss" : "ws",
45
+ protocol: protocol || (location.protocol === "https:" ? "wss" : "ws"),
46
46
  hostname: host || location.hostname,
47
47
  port: port || location.port,
48
48
  pathname: path || HMR_SOCK_PATH
@@ -239,10 +239,11 @@ import { EventEmitter } from "events";
239
239
  import SocketServer from "./socket-server";
240
240
  var noop = function() {};
241
241
  function getHMRClientPath(client) {
242
+ var protocol = (client === null || client === void 0 ? void 0 : client.protocol) ? "&protocol=".concat(client.protocol) : "";
242
243
  var host = (client === null || client === void 0 ? void 0 : client.host) ? "&host=".concat(client.host) : "";
243
244
  var path = (client === null || client === void 0 ? void 0 : client.path) ? "&path=".concat(client.path) : "";
244
245
  var port = (client === null || client === void 0 ? void 0 : client.port) ? "&port=".concat(client.port) : "";
245
- var clientEntry = "".concat(require.resolve("./hmr-client"), "?").concat(host).concat(path).concat(port);
246
+ var clientEntry = "".concat(require.resolve("./hmr-client"), "?").concat(host).concat(path).concat(port).concat(protocol);
246
247
  return clientEntry;
247
248
  }
248
249
  var DevMiddleware = /*#__PURE__*/ function(EventEmitter) {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.1.0",
14
+ "version": "2.3.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -34,10 +34,10 @@
34
34
  "minimatch": "^3.0.4",
35
35
  "path-to-regexp": "^6.2.0",
36
36
  "ws": "^8.2.0",
37
- "@modern-js/prod-server": "2.1.0",
38
- "@modern-js/server-utils": "2.1.0",
39
- "@modern-js/types": "2.1.0",
40
- "@modern-js/utils": "2.1.0"
37
+ "@modern-js/prod-server": "2.3.0",
38
+ "@modern-js/server-utils": "2.3.0",
39
+ "@modern-js/types": "2.3.0",
40
+ "@modern-js/utils": "2.3.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/connect-history-api-fallback": "^1.3.5",
@@ -52,9 +52,9 @@
52
52
  "typescript": "^4",
53
53
  "webpack": "^5.75.0",
54
54
  "websocket": "^1",
55
- "@modern-js/server-core": "2.1.0",
56
- "@scripts/build": "2.1.0",
57
- "@scripts/jest-config": "2.1.0"
55
+ "@modern-js/server-core": "2.3.0",
56
+ "@scripts/jest-config": "2.3.0",
57
+ "@scripts/build": "2.3.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "devcert": "^1.0.0",
File without changes
File without changes
@@ -1 +0,0 @@
1
- "use strict";