@modern-js/server 1.4.22-beta.0 → 1.4.22-beta.1
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.
|
@@ -138,10 +138,10 @@ export class ModernDevServer extends ModernServer {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
async onClose() {
|
|
141
|
-
var _this$
|
|
141
|
+
var _this$socketServer;
|
|
142
142
|
|
|
143
143
|
await super.onClose();
|
|
144
|
-
await
|
|
144
|
+
await this.watcher.close();
|
|
145
145
|
await new Promise(resolve => {
|
|
146
146
|
if (this.devMiddleware) {
|
|
147
147
|
this.devMiddleware.close(() => {
|
|
@@ -349,15 +349,23 @@ export class ModernDevServer extends ModernServer {
|
|
|
349
349
|
mock
|
|
350
350
|
} = AGGRED_DIR;
|
|
351
351
|
const defaultWatched = [`${mock}/**/*`, `${SERVER_DIR}/**/*`, `${API_DIR}/**`, `${SHARED_DIR}/**/*`];
|
|
352
|
+
const defaultWatchOptions = {
|
|
353
|
+
// 初始化的时候不触发 add、addDir 事件
|
|
354
|
+
ignoreInitial: true,
|
|
355
|
+
ignored: /api\/typings\/.*/
|
|
356
|
+
};
|
|
357
|
+
const {
|
|
358
|
+
watchOptions
|
|
359
|
+
} = this.conf.server;
|
|
360
|
+
|
|
361
|
+
const finalWatchOptions = _objectSpread(_objectSpread({}, defaultWatchOptions), watchOptions);
|
|
362
|
+
|
|
352
363
|
const defaultWatchedPaths = defaultWatched.map(p => path.normalize(path.join(pwd, p)));
|
|
364
|
+
console.log('finalWatchOptions', finalWatchOptions);
|
|
353
365
|
const watcher = new Watcher();
|
|
354
366
|
watcher.createDepTree(); // 监听文件变动,如果有变动则给 client,也就是 start 启动的插件发消息
|
|
355
367
|
|
|
356
|
-
watcher.listen(defaultWatchedPaths, {
|
|
357
|
-
// 初始化的时候不触发 add、addDir 事件
|
|
358
|
-
ignoreInitial: true,
|
|
359
|
-
ignored: /api\/typings\/.*/
|
|
360
|
-
}, filepath => {
|
|
368
|
+
watcher.listen(defaultWatchedPaths, finalWatchOptions, filepath => {
|
|
361
369
|
watcher.updateDepTree();
|
|
362
370
|
watcher.cleanDepCache(filepath);
|
|
363
371
|
this.onServerChange({
|
|
@@ -159,10 +159,10 @@ class ModernDevServer extends _prodServer.ModernServer {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
async onClose() {
|
|
162
|
-
var _this$
|
|
162
|
+
var _this$socketServer;
|
|
163
163
|
|
|
164
164
|
await super.onClose();
|
|
165
|
-
await
|
|
165
|
+
await this.watcher.close();
|
|
166
166
|
await new Promise(resolve => {
|
|
167
167
|
if (this.devMiddleware) {
|
|
168
168
|
this.devMiddleware.close(() => {
|
|
@@ -372,15 +372,23 @@ class ModernDevServer extends _prodServer.ModernServer {
|
|
|
372
372
|
mock
|
|
373
373
|
} = _prodServer.AGGRED_DIR;
|
|
374
374
|
const defaultWatched = [`${mock}/**/*`, `${_utils.SERVER_DIR}/**/*`, `${_utils.API_DIR}/**`, `${_utils.SHARED_DIR}/**/*`];
|
|
375
|
+
const defaultWatchOptions = {
|
|
376
|
+
// 初始化的时候不触发 add、addDir 事件
|
|
377
|
+
ignoreInitial: true,
|
|
378
|
+
ignored: /api\/typings\/.*/
|
|
379
|
+
};
|
|
380
|
+
const {
|
|
381
|
+
watchOptions
|
|
382
|
+
} = this.conf.server;
|
|
383
|
+
|
|
384
|
+
const finalWatchOptions = _objectSpread(_objectSpread({}, defaultWatchOptions), watchOptions);
|
|
385
|
+
|
|
375
386
|
const defaultWatchedPaths = defaultWatched.map(p => _path.default.normalize(_path.default.join(pwd, p)));
|
|
387
|
+
console.log('finalWatchOptions', finalWatchOptions);
|
|
376
388
|
const watcher = new _watcher.default();
|
|
377
389
|
watcher.createDepTree(); // 监听文件变动,如果有变动则给 client,也就是 start 启动的插件发消息
|
|
378
390
|
|
|
379
|
-
watcher.listen(defaultWatchedPaths, {
|
|
380
|
-
// 初始化的时候不触发 add、addDir 事件
|
|
381
|
-
ignoreInitial: true,
|
|
382
|
-
ignored: /api\/typings\/.*/
|
|
383
|
-
}, filepath => {
|
|
391
|
+
watcher.listen(defaultWatchedPaths, finalWatchOptions, filepath => {
|
|
384
392
|
watcher.updateDepTree();
|
|
385
393
|
watcher.cleanDepCache(filepath);
|
|
386
394
|
this.onServerChange({
|
|
@@ -8,7 +8,7 @@ export declare class ModernDevServer extends ModernServer {
|
|
|
8
8
|
private readonly dev;
|
|
9
9
|
private readonly compiler?;
|
|
10
10
|
private socketServer;
|
|
11
|
-
private watcher
|
|
11
|
+
private watcher;
|
|
12
12
|
private devMiddleware;
|
|
13
13
|
constructor(options: ModernDevServerOptions);
|
|
14
14
|
private getDevOptions;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.4.22-beta.
|
|
14
|
+
"version": "1.4.22-beta.1",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"ws": "^8.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@modern-js/core": "1.12.
|
|
44
|
+
"@modern-js/core": "1.12.2-beta.0",
|
|
45
45
|
"@modern-js/server-core": "1.3.5",
|
|
46
46
|
"@modern-js/types": "1.5.4",
|
|
47
47
|
"@scripts/build": "0.0.0",
|