webpack-dev-service 0.12.10 → 0.12.12
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/cjs/client/client.cjs +1 -1
- package/cjs/client/events.cjs +1 -1
- package/cjs/client/hot.cjs +1 -1
- package/cjs/client/index.cjs +1 -1
- package/cjs/client/main.cjs +1 -1
- package/cjs/client/ui/Overlay.cjs +28 -28
- package/cjs/client/ui/Progress.cjs +17 -17
- package/cjs/client/ui/utils.cjs +1 -1
- package/cjs/server/compose.cjs +1 -1
- package/cjs/server/dev/Service.cjs +20 -16
- package/cjs/server/dev/index.cjs +1 -1
- package/cjs/server/dev/middleware.cjs +1 -1
- package/cjs/server/dev/utils/fs.cjs +1 -1
- package/cjs/server/dev/utils/hash.cjs +2 -2
- package/cjs/server/dev/utils/http.cjs +3 -3
- package/cjs/server/dev/utils/path.cjs +1 -1
- package/cjs/server/dev/utils/paths.cjs +1 -1
- package/cjs/server/dev/utils/ready.cjs +1 -1
- package/cjs/server/dev/utils/setupHooks.cjs +1 -1
- package/cjs/server/dev/utils/setupOutputFileSystem.cjs +1 -1
- package/cjs/server/dev/utils/setupWatching.cjs +2 -2
- package/cjs/server/dev/utils/setupWriteToDisk.cjs +3 -3
- package/cjs/server/dev/utils/stream.cjs +57 -57
- package/cjs/server/hot/Socket.cjs +41 -36
- package/cjs/server/hot/index.cjs +1 -1
- package/cjs/server/hot/utils.cjs +1 -1
- package/cjs/server/index.cjs +1 -1
- package/cjs/server/schema.cjs +1 -1
- package/cjs/server/utils.cjs +1 -1
- package/esm/client/client.js +1 -1
- package/esm/client/events.js +1 -1
- package/esm/client/hot.js +1 -1
- package/esm/client/index.js +1 -1
- package/esm/client/main.js +1 -1
- package/esm/client/ui/Overlay.js +28 -28
- package/esm/client/ui/Progress.js +17 -17
- package/esm/client/ui/utils.js +1 -1
- package/esm/server/compose.js +1 -1
- package/esm/server/dev/Service.js +20 -16
- package/esm/server/dev/index.js +1 -1
- package/esm/server/dev/middleware.js +1 -1
- package/esm/server/dev/utils/fs.js +1 -1
- package/esm/server/dev/utils/hash.js +2 -2
- package/esm/server/dev/utils/http.js +3 -3
- package/esm/server/dev/utils/path.js +1 -1
- package/esm/server/dev/utils/paths.js +1 -1
- package/esm/server/dev/utils/ready.js +1 -1
- package/esm/server/dev/utils/setupHooks.js +1 -1
- package/esm/server/dev/utils/setupOutputFileSystem.js +1 -1
- package/esm/server/dev/utils/setupWatching.js +2 -2
- package/esm/server/dev/utils/setupWriteToDisk.js +3 -3
- package/esm/server/dev/utils/stream.js +57 -57
- package/esm/server/hot/Socket.js +41 -36
- package/esm/server/hot/index.js +1 -1
- package/esm/server/hot/utils.js +1 -1
- package/esm/server/index.js +1 -1
- package/esm/server/schema.js +1 -1
- package/esm/server/utils.js +1 -1
- package/package.json +2 -2
- package/types/client/ui/Overlay.d.ts +1 -8
- package/types/client/ui/Progress.d.ts +1 -4
- package/types/server/dev/Service.d.ts +1 -18
- package/types/server/dev/utils/fs.d.ts +2 -2
- package/types/server/dev/utils/hash.d.ts +1 -1
- package/types/server/dev/utils/stream.d.ts +1 -42
- package/types/server/hot/Socket.d.ts +1 -10
package/cjs/client/client.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
package/cjs/client/events.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
package/cjs/client/hot.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
package/cjs/client/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
package/cjs/client/main.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -175,38 +175,38 @@ const HTML = `
|
|
|
175
175
|
</div>
|
|
176
176
|
`;
|
|
177
177
|
class Overlay {
|
|
178
|
-
hidden = true;
|
|
179
|
-
name;
|
|
180
|
-
close;
|
|
181
|
-
dialog;
|
|
182
|
-
errorsList;
|
|
183
|
-
errorsTitle;
|
|
184
|
-
warningsList;
|
|
185
|
-
warningsTitle;
|
|
178
|
+
#hidden = true;
|
|
179
|
+
#name;
|
|
180
|
+
#close;
|
|
181
|
+
#dialog;
|
|
182
|
+
#errorsList;
|
|
183
|
+
#errorsTitle;
|
|
184
|
+
#warningsList;
|
|
185
|
+
#warningsTitle;
|
|
186
186
|
constructor(name) {
|
|
187
187
|
const root = utils.getRootElement(OVERLAY);
|
|
188
188
|
utils.injectCSS(CSS, root);
|
|
189
189
|
const [dialog] = utils.appendHTML(HTML, root);
|
|
190
|
-
this
|
|
191
|
-
this
|
|
192
|
-
this
|
|
193
|
-
this
|
|
194
|
-
this
|
|
195
|
-
this
|
|
196
|
-
this
|
|
197
|
-
this
|
|
198
|
-
this
|
|
190
|
+
this.#dialog = dialog;
|
|
191
|
+
this.#name = dialog.querySelector(`.${OVERLAY}-name`);
|
|
192
|
+
this.#close = dialog.querySelector(`.${OVERLAY}-close`);
|
|
193
|
+
this.#errorsList = dialog.querySelector(`.${OVERLAY}-errors`);
|
|
194
|
+
this.#warningsList = dialog.querySelector(`.${OVERLAY}-warnings`);
|
|
195
|
+
this.#errorsTitle = dialog.querySelector(`.${OVERLAY}-errors-title`);
|
|
196
|
+
this.#warningsTitle = dialog.querySelector(`.${OVERLAY}-warnings-title`);
|
|
197
|
+
this.#name.innerHTML = `⭕ ${name || DEFAULT_NAME}`;
|
|
198
|
+
this.#close.addEventListener('click', () => {
|
|
199
199
|
this.hide();
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
setIssues(type, issues) {
|
|
203
203
|
const count = issues.length;
|
|
204
204
|
const hidden = `${OVERLAY}-hidden`;
|
|
205
|
-
const
|
|
206
|
-
errors: ['Error', this
|
|
207
|
-
warnings: ['Warning', this
|
|
205
|
+
const problems = {
|
|
206
|
+
errors: ['Error', this.#errorsTitle, this.#errorsList],
|
|
207
|
+
warnings: ['Warning', this.#warningsTitle, this.#warningsList]
|
|
208
208
|
};
|
|
209
|
-
const [name, problemTitle, problemList] =
|
|
209
|
+
const [name, problemTitle, problemList] = problems[type];
|
|
210
210
|
if (count > 0) {
|
|
211
211
|
let html = '';
|
|
212
212
|
problemTitle.innerText = `${count} ${name}(s)`;
|
|
@@ -224,15 +224,15 @@ class Overlay {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
show() {
|
|
227
|
-
if (this
|
|
228
|
-
this
|
|
229
|
-
this
|
|
227
|
+
if (this.#hidden) {
|
|
228
|
+
this.#hidden = false;
|
|
229
|
+
this.#dialog.classList.add(`${OVERLAY}-show`);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
hide() {
|
|
233
|
-
if (!this
|
|
234
|
-
this
|
|
235
|
-
this
|
|
233
|
+
if (!this.#hidden) {
|
|
234
|
+
this.#hidden = true;
|
|
235
|
+
this.#dialog.classList.remove(`${OVERLAY}-show`);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -61,37 +61,37 @@ const HTML = `
|
|
|
61
61
|
</svg>
|
|
62
62
|
`;
|
|
63
63
|
class Progress {
|
|
64
|
-
timer;
|
|
65
|
-
hidden = true;
|
|
66
|
-
svg;
|
|
67
|
-
track;
|
|
64
|
+
#timer;
|
|
65
|
+
#hidden = true;
|
|
66
|
+
#svg;
|
|
67
|
+
#track;
|
|
68
68
|
constructor() {
|
|
69
69
|
const root = utils.getRootElement(PROGRESS);
|
|
70
70
|
utils.injectCSS(CSS, root);
|
|
71
|
-
[this
|
|
72
|
-
this
|
|
71
|
+
[this.#svg] = utils.appendHTML(HTML, root);
|
|
72
|
+
this.#track = this.#svg.querySelector(`.${PROGRESS}-track`);
|
|
73
73
|
}
|
|
74
74
|
update(percentage) {
|
|
75
75
|
percentage = 1 - Math.max(0, Math.min(1, percentage));
|
|
76
|
-
this
|
|
76
|
+
this.#track.style.strokeDashoffset = `${PERIMETER * percentage}`;
|
|
77
77
|
}
|
|
78
78
|
show() {
|
|
79
|
-
if (this
|
|
80
|
-
this
|
|
81
|
-
clearTimeout(this
|
|
82
|
-
this
|
|
79
|
+
if (this.#hidden) {
|
|
80
|
+
this.#hidden = false;
|
|
81
|
+
clearTimeout(this.#timer);
|
|
82
|
+
this.#svg.classList.add(`${PROGRESS}-show`);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
hide() {
|
|
86
|
-
if (this
|
|
86
|
+
if (this.#hidden) {
|
|
87
87
|
this.update(0);
|
|
88
88
|
} else {
|
|
89
|
-
this
|
|
90
|
-
this
|
|
91
|
-
this
|
|
89
|
+
this.#hidden = true;
|
|
90
|
+
this.#timer = self.setTimeout(() => {
|
|
91
|
+
this.#timer = self.setTimeout(() => {
|
|
92
92
|
this.update(0);
|
|
93
93
|
}, DURATION);
|
|
94
|
-
this
|
|
94
|
+
this.#svg.classList.remove(`${PROGRESS}-show`);
|
|
95
95
|
}, DURATION);
|
|
96
96
|
}
|
|
97
97
|
}
|
package/cjs/client/ui/utils.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
package/cjs/server/compose.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -30,8 +30,8 @@ const createETag__default = /*#__PURE__*/ _interopDefault(createETag);
|
|
|
30
30
|
* @class Service
|
|
31
31
|
*/
|
|
32
32
|
class Service {
|
|
33
|
-
root;
|
|
34
|
-
options;
|
|
33
|
+
#root;
|
|
34
|
+
#options;
|
|
35
35
|
/**
|
|
36
36
|
* @constructor
|
|
37
37
|
* @description Create file service.
|
|
@@ -39,29 +39,29 @@ class Service {
|
|
|
39
39
|
* @param options The file service options.
|
|
40
40
|
*/
|
|
41
41
|
constructor(root, options) {
|
|
42
|
-
this
|
|
43
|
-
this
|
|
42
|
+
this.#options = options;
|
|
43
|
+
this.#root = path.unixify(node_path.resolve(root));
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* @private
|
|
47
|
-
* @method isIgnore
|
|
47
|
+
* @method #isIgnore
|
|
48
48
|
* @description Check if path is ignore.
|
|
49
49
|
* @param path The path to check.
|
|
50
50
|
*/
|
|
51
|
-
isIgnore(path) {
|
|
52
|
-
const { ignore } = this
|
|
51
|
+
#isIgnore(path) {
|
|
52
|
+
const { ignore } = this.#options;
|
|
53
53
|
return (utils.isFunction(ignore) ? ignore(path) : false) === true;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* @private
|
|
57
|
-
* @method setupHeaders
|
|
57
|
+
* @method #setupHeaders
|
|
58
58
|
* @description Setup headers.
|
|
59
59
|
* @param context The koa context.
|
|
60
60
|
* @param path The file path.
|
|
61
61
|
* @param stats The file stats.
|
|
62
62
|
*/
|
|
63
|
-
setupHeaders(context, path, stats) {
|
|
64
|
-
const
|
|
63
|
+
#setupHeaders(context, path, stats) {
|
|
64
|
+
const options = this.#options;
|
|
65
65
|
const { headers, etag } = options;
|
|
66
66
|
// Set status.
|
|
67
67
|
context.status = 200;
|
|
@@ -117,7 +117,7 @@ class Service {
|
|
|
117
117
|
return false;
|
|
118
118
|
}
|
|
119
119
|
// Get root path.
|
|
120
|
-
const
|
|
120
|
+
const root = this.#root;
|
|
121
121
|
// Slice length.
|
|
122
122
|
const { length } = publicPath;
|
|
123
123
|
// Real pathname.
|
|
@@ -129,11 +129,15 @@ class Service {
|
|
|
129
129
|
return false;
|
|
130
130
|
}
|
|
131
131
|
// Is ignore path or file (403).
|
|
132
|
-
if (this
|
|
132
|
+
if (this.#isIgnore(path$1)) {
|
|
133
133
|
return false;
|
|
134
134
|
}
|
|
135
|
+
// Get options.
|
|
136
|
+
const options = this.#options;
|
|
137
|
+
// Get file system.
|
|
138
|
+
const { fs: fs$1 } = options;
|
|
135
139
|
// File stats.
|
|
136
|
-
const stats = await fs.stat(
|
|
140
|
+
const stats = await fs.stat(fs$1, path$1);
|
|
137
141
|
// Check file stats.
|
|
138
142
|
if (
|
|
139
143
|
// File not exist (404 | 500).
|
|
@@ -146,7 +150,7 @@ class Service {
|
|
|
146
150
|
return false;
|
|
147
151
|
}
|
|
148
152
|
// Setup headers.
|
|
149
|
-
this
|
|
153
|
+
this.#setupHeaders(context, path$1, stats);
|
|
150
154
|
// Conditional get support.
|
|
151
155
|
if (http.isConditionalGET(context)) {
|
|
152
156
|
// Request precondition failure.
|
|
@@ -186,7 +190,7 @@ class Service {
|
|
|
186
190
|
return context.throw(400);
|
|
187
191
|
}
|
|
188
192
|
// Get stream options.
|
|
189
|
-
const {
|
|
193
|
+
const { highWaterMark } = options;
|
|
190
194
|
// Set response body.
|
|
191
195
|
context.body = new stream.FileReadStream(path$1, ranges, { fs: fs$1, highWaterMark });
|
|
192
196
|
// File found.
|
package/cjs/server/dev/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -32,7 +32,7 @@ const CHARS = [
|
|
|
32
32
|
* @description Generate a hash.
|
|
33
33
|
* @param length The length of hash.
|
|
34
34
|
*/
|
|
35
|
-
function generate(length
|
|
35
|
+
function generate(length) {
|
|
36
36
|
let hash = '';
|
|
37
37
|
const randomValues = node_crypto.getRandomValues(new Uint8Array(length));
|
|
38
38
|
// Create hash.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -156,13 +156,13 @@ function parseRanges(context, stats) {
|
|
|
156
156
|
// Parsed entries.
|
|
157
157
|
const entries = parsed.entries();
|
|
158
158
|
// Range boundary.
|
|
159
|
-
const boundary =
|
|
159
|
+
const boundary = `${hash.generate(32)}`;
|
|
160
160
|
// Multipart Content-Type.
|
|
161
161
|
const contentType = `Content-Type: ${context.type}`;
|
|
162
162
|
// Range suffix.
|
|
163
163
|
const suffix = node_buffer.Buffer.from(`\r\n--${boundary}--\r\n`);
|
|
164
164
|
// Override Content-Type.
|
|
165
|
-
context.type = `multipart/byteranges; boundary
|
|
165
|
+
context.type = `multipart/byteranges; boundary="${boundary}"`;
|
|
166
166
|
// Map ranges.
|
|
167
167
|
for (const [index, { start, end }] of entries) {
|
|
168
168
|
const length = end - start + 1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -20,7 +20,7 @@ function getWatching({ compiler, logger }) {
|
|
|
20
20
|
return compiler.watching;
|
|
21
21
|
}
|
|
22
22
|
const errorHandler = error => {
|
|
23
|
-
if (error) {
|
|
23
|
+
if (error != null) {
|
|
24
24
|
// For example - `writeToDisk` can throw an error and right now it is ends watching.
|
|
25
25
|
// We can improve that and keep watching active, but it is require API on webpack side.
|
|
26
26
|
// Let's implement that in webpack@5 because it is rare case.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.12.
|
|
4
|
+
* @version 0.12.12
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -34,12 +34,12 @@ function setupWriteToDisk(context) {
|
|
|
34
34
|
const dir = node_path.dirname(targetPath);
|
|
35
35
|
const name = getCompilerName(compiler);
|
|
36
36
|
return node_fs.mkdir(dir, { recursive: true }, error => {
|
|
37
|
-
if (error) {
|
|
37
|
+
if (error != null) {
|
|
38
38
|
logger.error(`${name}unable to write "${dir}" directory to disk:\n${error}`);
|
|
39
39
|
return callback(error);
|
|
40
40
|
}
|
|
41
41
|
node_fs.writeFile(targetPath, content, error => {
|
|
42
|
-
if (error) {
|
|
42
|
+
if (error != null) {
|
|
43
43
|
logger.error(`${name}unable to write "${targetPath}" asset to disk:\n${error}`);
|
|
44
44
|
return callback(error);
|
|
45
45
|
}
|