@modern-js/server 1.5.1-beta.0 → 1.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @modern-js/server
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - a27ab8d: feat: add onApiChange hook for bff hot reload
8
+ feat: 为 BFF 热更新优化,添加 onApiChange 钩子
9
+ - Updated dependencies [b74b0b6]
10
+ - Updated dependencies [7b902b3]
11
+ - Updated dependencies [3d64b2f]
12
+ - Updated dependencies [8b2aa56]
13
+ - Updated dependencies [3e4a34f]
14
+ - Updated dependencies [33cebd2]
15
+ - @modern-js/webpack@1.12.0
16
+ - @modern-js/prod-server@1.2.0
17
+ - @modern-js/server-utils@1.2.11
18
+ - @modern-js/utils@1.7.12
19
+
3
20
  ## 1.5.0
4
21
 
5
22
  ### Minor Changes
@@ -216,9 +216,12 @@ export class ModernDevServer extends ModernServer {
216
216
  const success = this.runner.onApiChange([{
217
217
  filename: filepath,
218
218
  event
219
- }]);
219
+ }]); // onApiChange 钩子被调用,且返回 true,则表示无需重新编译
220
+ // onApiChange 的类型是 WaterFall,WaterFall 钩子的返回值类型目前有问题
221
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
222
+ // @ts-expect-error
220
223
 
221
- if (!success) {
224
+ if (success !== true) {
222
225
  super.onServerChange({
223
226
  filepath
224
227
  });
@@ -243,9 +243,12 @@ class ModernDevServer extends _prodServer.ModernServer {
243
243
  const success = this.runner.onApiChange([{
244
244
  filename: filepath,
245
245
  event
246
- }]);
246
+ }]); // onApiChange 钩子被调用,且返回 true,则表示无需重新编译
247
+ // onApiChange 的类型是 WaterFall,WaterFall 钩子的返回值类型目前有问题
248
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
249
+ // @ts-expect-error
247
250
 
248
- if (!success) {
251
+ if (success !== true) {
249
252
  super.onServerChange({
250
253
  filepath
251
254
  });
@@ -1,4 +1,5 @@
1
1
  import { FSWatcher, WatchOptions } from '@modern-js/utils';
2
+ export declare type WatchEvent = 'add' | 'change' | 'unlink';
2
3
  export declare const defaultWatchOptions: {
3
4
  ignoreInitial: boolean;
4
5
  ignored: RegExp;
@@ -24,7 +25,7 @@ export declare const mergeWatchOptions: (options?: WatchOptions) => {
24
25
  export default class Watcher {
25
26
  private dependencyTree;
26
27
  private watcher;
27
- listen(files: string[], options: WatchOptions, callback: (changed: string, event: 'add' | 'change' | 'unlink') => void): void;
28
+ listen(files: string[], options: WatchOptions, callback: (changed: string, event: WatchEvent) => void): void;
28
29
  createDepTree(): void;
29
30
  updateDepTree(): void;
30
31
  cleanDepCache(filepath: string): void;
@@ -2,6 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  import http, { Server, IncomingMessage, ServerResponse } from 'http';
4
4
  import { ServerHookRunner, ModernServer, BuildOptions } from '@modern-js/prod-server';
5
+ import { WatchEvent } from '../dev-tools/watcher';
5
6
  import { ModernDevServerOptions } from '../types';
6
7
  export declare class ModernDevServer extends ModernServer {
7
8
  private mockHandler;
@@ -23,7 +24,7 @@ export declare class ModernDevServer extends ModernServer {
23
24
  event
24
25
  }: {
25
26
  filepath: string;
26
- event: 'add' | 'unlink' | 'change';
27
+ event: WatchEvent;
27
28
  }): void;
28
29
  private setupCompiler;
29
30
  private setupDevServerPlugin;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.5.1-beta.0",
14
+ "version": "1.5.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -31,9 +31,9 @@
31
31
  "@babel/core": "^7.18.0",
32
32
  "@babel/register": "^7.17.7",
33
33
  "@modern-js/hmr-client": "^1.2.8",
34
- "@modern-js/prod-server": "^1.1.9",
34
+ "@modern-js/prod-server": "^1.2.0",
35
35
  "@modern-js/server-utils": "^1.2.11",
36
- "@modern-js/webpack": "^1.11.5",
36
+ "@modern-js/webpack": "^1.12.0",
37
37
  "@modern-js/utils": "^1.7.12",
38
38
  "devcert": "^1.2.2",
39
39
  "minimatch": "^3.0.4",
@@ -41,9 +41,9 @@
41
41
  "ws": "^8.2.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@modern-js/core": "1.12.4",
45
- "@modern-js/server-core": "1.4.0",
46
- "@modern-js/types": "1.5.6",
44
+ "@modern-js/core": "1.13.0",
45
+ "@modern-js/server-core": "1.4.1",
46
+ "@modern-js/types": "1.6.0",
47
47
  "@scripts/build": "0.0.0",
48
48
  "@scripts/jest-config": "0.0.0",
49
49
  "@types/jest": "^27",
@@ -62,8 +62,7 @@
62
62
  },
63
63
  "publishConfig": {
64
64
  "registry": "https://registry.npmjs.org/",
65
- "access": "public",
66
- "types": "./dist/types/index.d.ts"
65
+ "access": "public"
67
66
  },
68
67
  "wireit": {
69
68
  "build": {