@modern-js/server 2.40.0 → 2.41.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/dist/cjs/dev-tools/dev-middleware/index.js +3 -2
- package/dist/cjs/dev-tools/dev-middleware/socketServer.js +3 -2
- package/dist/cjs/dev-tools/watcher/index.js +3 -2
- package/dist/esm/dev-tools/dev-middleware/hmr-client/index.js +14 -14
- package/dist/esm/dev-tools/dev-middleware/index.js +2 -1
- package/dist/esm/dev-tools/dev-middleware/socketServer.js +2 -1
- package/dist/esm/dev-tools/watcher/index.js +2 -1
- package/dist/esm-node/dev-tools/dev-middleware/index.js +3 -2
- package/dist/esm-node/dev-tools/dev-middleware/socketServer.js +3 -2
- package/dist/esm-node/dev-tools/watcher/index.js +3 -2
- package/package.json +13 -13
|
@@ -44,7 +44,8 @@ function getHMRClientPath(client) {
|
|
|
44
44
|
const clientEntry = `${require.resolve("@modern-js/server/hmr-client")}?${host}${path}${port}${protocol}`;
|
|
45
45
|
return clientEntry;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
var DevMiddleware;
|
|
48
|
+
DevMiddleware = class DevMiddleware2 extends import_events.EventEmitter {
|
|
48
49
|
init(app) {
|
|
49
50
|
app.on("listening", () => {
|
|
50
51
|
this.socketServer.prepare(app);
|
|
@@ -91,4 +92,4 @@ class DevMiddleware extends import_events.EventEmitter {
|
|
|
91
92
|
this.middleware = this.setupDevMiddleware(devMiddleware);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
}
|
|
95
|
+
};
|
|
@@ -34,7 +34,8 @@ module.exports = __toCommonJS(socketServer_exports);
|
|
|
34
34
|
var import_define_property = require("@swc/helpers/_/_define_property");
|
|
35
35
|
var import_ws = __toESM(require("ws"));
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
-
|
|
37
|
+
var SocketServer;
|
|
38
|
+
SocketServer = class SocketServer2 {
|
|
38
39
|
// create socket, install socket handler, bind socket event
|
|
39
40
|
prepare(app) {
|
|
40
41
|
var _this_options_client;
|
|
@@ -175,4 +176,4 @@ class SocketServer {
|
|
|
175
176
|
(0, import_define_property._)(this, "timer", null);
|
|
176
177
|
this.options = options;
|
|
177
178
|
}
|
|
178
|
-
}
|
|
179
|
+
};
|
|
@@ -76,7 +76,8 @@ const mergeWatchOptions = (options) => {
|
|
|
76
76
|
};
|
|
77
77
|
return finalWatchOptions;
|
|
78
78
|
};
|
|
79
|
-
|
|
79
|
+
var Watcher;
|
|
80
|
+
Watcher = class Watcher2 {
|
|
80
81
|
listen(files, options, callback) {
|
|
81
82
|
const watched = files.filter(Boolean);
|
|
82
83
|
const filenames = watched.map((filename) => filename.replace(/\\/g, "/"));
|
|
@@ -129,7 +130,7 @@ class Watcher {
|
|
|
129
130
|
(0, import_define_property._)(this, "dependencyTree", null);
|
|
130
131
|
(0, import_define_property._)(this, "watcher", void 0);
|
|
131
132
|
}
|
|
132
|
-
}
|
|
133
|
+
};
|
|
133
134
|
// Annotate the CommonJS export names for ESM import in node:
|
|
134
135
|
0 && (module.exports = {
|
|
135
136
|
defaultWatchOptions,
|
|
@@ -40,7 +40,11 @@ var require_hmr_client = __commonJS({
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function handleWarnings(warnings) {
|
|
43
|
-
|
|
43
|
+
clearOutdatedErrors();
|
|
44
|
+
var isHotUpdate = !isFirstCompilation;
|
|
45
|
+
isFirstCompilation = false;
|
|
46
|
+
hasCompileErrors = false;
|
|
47
|
+
function printWarnings() {
|
|
44
48
|
var formatted = formatWebpackMessages({
|
|
45
49
|
warnings,
|
|
46
50
|
errors: []
|
|
@@ -54,11 +58,7 @@ var require_hmr_client = __commonJS({
|
|
|
54
58
|
console.warn(stripAnsi(formatted.warnings[i]));
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
|
-
}
|
|
58
|
-
clearOutdatedErrors();
|
|
59
|
-
var isHotUpdate = !isFirstCompilation;
|
|
60
|
-
isFirstCompilation = false;
|
|
61
|
-
hasCompileErrors = false;
|
|
61
|
+
}
|
|
62
62
|
printWarnings();
|
|
63
63
|
if (isHotUpdate) {
|
|
64
64
|
tryApplyUpdates();
|
|
@@ -127,7 +127,14 @@ var require_hmr_client = __commonJS({
|
|
|
127
127
|
return module.hot.status() === "idle";
|
|
128
128
|
}
|
|
129
129
|
function tryApplyUpdates() {
|
|
130
|
-
|
|
130
|
+
if (!module.hot) {
|
|
131
|
+
window.location.reload();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (!isUpdateAvailable() || !canApplyUpdates()) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
function handleApplyUpdates(err, updatedModules) {
|
|
131
138
|
var wantsForcedReload = err || !updatedModules || hadRuntimeError;
|
|
132
139
|
if (wantsForcedReload) {
|
|
133
140
|
window.location.reload();
|
|
@@ -136,13 +143,6 @@ var require_hmr_client = __commonJS({
|
|
|
136
143
|
if (isUpdateAvailable()) {
|
|
137
144
|
tryApplyUpdates();
|
|
138
145
|
}
|
|
139
|
-
};
|
|
140
|
-
if (!module.hot) {
|
|
141
|
-
window.location.reload();
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (!isUpdateAvailable() || !canApplyUpdates()) {
|
|
145
|
-
return;
|
|
146
146
|
}
|
|
147
147
|
var result = module.hot.check(
|
|
148
148
|
/* autoApply */
|
|
@@ -19,7 +19,8 @@ function getHMRClientPath(client) {
|
|
|
19
19
|
var clientEntry = "".concat(require.resolve("@modern-js/server/hmr-client"), "?").concat(host).concat(path).concat(port).concat(protocol);
|
|
20
20
|
return clientEntry;
|
|
21
21
|
}
|
|
22
|
-
var DevMiddleware
|
|
22
|
+
var DevMiddleware;
|
|
23
|
+
DevMiddleware = /* @__PURE__ */ function(EventEmitter2) {
|
|
23
24
|
"use strict";
|
|
24
25
|
_inherits(DevMiddleware2, EventEmitter2);
|
|
25
26
|
var _super = _create_super(DevMiddleware2);
|
|
@@ -3,7 +3,8 @@ import { _ as _create_class } from "@swc/helpers/_/_create_class";
|
|
|
3
3
|
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
4
4
|
import ws from "ws";
|
|
5
5
|
import { logger } from "@modern-js/utils";
|
|
6
|
-
var SocketServer
|
|
6
|
+
var SocketServer;
|
|
7
|
+
SocketServer = /* @__PURE__ */ function() {
|
|
7
8
|
"use strict";
|
|
8
9
|
function SocketServer2(options) {
|
|
9
10
|
_class_call_check(this, SocketServer2);
|
|
@@ -38,7 +38,8 @@ var mergeWatchOptions = function(options) {
|
|
|
38
38
|
var finalWatchOptions = _object_spread({}, defaultWatchOptions, watchOptions);
|
|
39
39
|
return finalWatchOptions;
|
|
40
40
|
};
|
|
41
|
-
var Watcher
|
|
41
|
+
var Watcher;
|
|
42
|
+
Watcher = /* @__PURE__ */ function() {
|
|
42
43
|
"use strict";
|
|
43
44
|
function Watcher2() {
|
|
44
45
|
_class_call_check(this, Watcher2);
|
|
@@ -11,7 +11,8 @@ function getHMRClientPath(client) {
|
|
|
11
11
|
const clientEntry = `${require.resolve("@modern-js/server/hmr-client")}?${host}${path}${port}${protocol}`;
|
|
12
12
|
return clientEntry;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
var DevMiddleware;
|
|
15
|
+
DevMiddleware = class DevMiddleware2 extends EventEmitter {
|
|
15
16
|
init(app) {
|
|
16
17
|
app.on("listening", () => {
|
|
17
18
|
this.socketServer.prepare(app);
|
|
@@ -58,7 +59,7 @@ class DevMiddleware extends EventEmitter {
|
|
|
58
59
|
this.middleware = this.setupDevMiddleware(devMiddleware);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
}
|
|
62
|
+
};
|
|
62
63
|
export {
|
|
63
64
|
DevMiddleware as default
|
|
64
65
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
2
|
import ws from "ws";
|
|
3
3
|
import { logger } from "@modern-js/utils";
|
|
4
|
-
|
|
4
|
+
var SocketServer;
|
|
5
|
+
SocketServer = class SocketServer2 {
|
|
5
6
|
// create socket, install socket handler, bind socket event
|
|
6
7
|
prepare(app) {
|
|
7
8
|
var _this_options_client;
|
|
@@ -142,7 +143,7 @@ class SocketServer {
|
|
|
142
143
|
_define_property(this, "timer", null);
|
|
143
144
|
this.options = options;
|
|
144
145
|
}
|
|
145
|
-
}
|
|
146
|
+
};
|
|
146
147
|
export {
|
|
147
148
|
SocketServer as default
|
|
148
149
|
};
|
|
@@ -40,7 +40,8 @@ const mergeWatchOptions = (options) => {
|
|
|
40
40
|
};
|
|
41
41
|
return finalWatchOptions;
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
var Watcher;
|
|
44
|
+
Watcher = class Watcher2 {
|
|
44
45
|
listen(files, options, callback) {
|
|
45
46
|
const watched = files.filter(Boolean);
|
|
46
47
|
const filenames = watched.map((filename) => filename.replace(/\\/g, "/"));
|
|
@@ -93,7 +94,7 @@ class Watcher {
|
|
|
93
94
|
_define_property(this, "dependencyTree", null);
|
|
94
95
|
_define_property(this, "watcher", void 0);
|
|
95
96
|
}
|
|
96
|
-
}
|
|
97
|
+
};
|
|
97
98
|
export {
|
|
98
99
|
Watcher as default,
|
|
99
100
|
defaultWatchOptions,
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.41.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -40,25 +40,25 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/core": "^7.23.2",
|
|
42
42
|
"@babel/register": "^7.22.15",
|
|
43
|
-
"@swc/helpers": "0.5.
|
|
43
|
+
"@swc/helpers": "0.5.3",
|
|
44
44
|
"connect-history-api-fallback": "^2.0.0",
|
|
45
45
|
"http-compression": "1.0.6",
|
|
46
46
|
"minimatch": "^3.0.4",
|
|
47
47
|
"path-to-regexp": "^6.2.0",
|
|
48
|
-
"ws": "^8.
|
|
49
|
-
"axios": "^1.
|
|
50
|
-
"@modern-js/prod-server": "2.
|
|
51
|
-
"@modern-js/server-utils": "2.
|
|
52
|
-
"@modern-js/types": "2.
|
|
53
|
-
"@modern-js/utils": "2.
|
|
54
|
-
"@modern-js/runtime-utils": "2.
|
|
48
|
+
"ws": "^8.13.0",
|
|
49
|
+
"axios": "^1.6.0",
|
|
50
|
+
"@modern-js/prod-server": "2.41.0",
|
|
51
|
+
"@modern-js/server-utils": "2.41.0",
|
|
52
|
+
"@modern-js/types": "2.41.0",
|
|
53
|
+
"@modern-js/utils": "2.41.0",
|
|
54
|
+
"@modern-js/runtime-utils": "2.41.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/connect-history-api-fallback": "^1.3.5",
|
|
58
58
|
"@types/jest": "^29",
|
|
59
59
|
"@types/minimatch": "^3.0.5",
|
|
60
60
|
"@types/node": "^14",
|
|
61
|
-
"@types/ws": "^
|
|
61
|
+
"@types/ws": "^8.5.5",
|
|
62
62
|
"jest": "^29",
|
|
63
63
|
"node-mocks-http": "^1.11.0",
|
|
64
64
|
"ts-node": "^10.9.1",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"typescript": "^5",
|
|
67
67
|
"webpack": "^5.88.1",
|
|
68
68
|
"websocket": "^1",
|
|
69
|
-
"@modern-js/server-core": "2.
|
|
70
|
-
"@scripts/build": "2.
|
|
71
|
-
"@scripts/jest-config": "2.
|
|
69
|
+
"@modern-js/server-core": "2.41.0",
|
|
70
|
+
"@scripts/build": "2.41.0",
|
|
71
|
+
"@scripts/jest-config": "2.41.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"devcert": "^1.0.0",
|