@modern-js/plugin-devtools 2.45.0 → 2.46.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.
@@ -1,7 +1,7 @@
1
1
  import { ClientDefinition, type ClientFunctions, type ServerFunctions } from '@modern-js/devtools-kit';
2
2
  import type { PartialDeep } from 'type-fest';
3
- import type { BuilderPlugin } from '@modern-js/builder-shared';
4
- import { CliPluginAPI, BuilderPluginAPI, InjectedHooks } from '../types';
3
+ import type { RsbuildPlugin } from '@modern-js/uni-builder';
4
+ import { CliPluginAPI, InjectedHooks } from '../types';
5
5
  import { SocketServer } from '../utils/socket';
6
6
  export interface SetupClientConnectionOptions {
7
7
  api: CliPluginAPI;
@@ -10,6 +10,6 @@ export interface SetupClientConnectionOptions {
10
10
  export declare const setupClientConnection: (options: SetupClientConnectionOptions) => Promise<{
11
11
  client: import("birpc").BirpcReturn<ClientFunctions, ServerFunctions>;
12
12
  hooks: InjectedHooks;
13
- builderPlugin: BuilderPlugin<BuilderPluginAPI>;
13
+ builderPlugin: RsbuildPlugin;
14
14
  setDefinition: (definition: PartialDeep<ClientDefinition>) => void;
15
15
  }>;
package/dist/rpc/index.js CHANGED
@@ -125,12 +125,14 @@ const setupClientConnection = async (options) => {
125
125
  webpack: [
126
126
  ctx.rootPath,
127
127
  "@modern-js/app-tools",
128
- "@modern-js/builder-webpack-provider",
128
+ "@modern-js/uni-builder",
129
+ "@rsbuild/webpack",
129
130
  "webpack/package.json"
130
131
  ],
131
132
  "@rspack/core": [
132
133
  ctx.rootPath,
133
- "@modern-js/builder-rspack-provider",
134
+ "@modern-js/uni-builder",
135
+ "@rsbuild/core",
134
136
  "@rspack/core/package.json"
135
137
  ]
136
138
  };
@@ -181,11 +183,11 @@ const setupClientConnection = async (options) => {
181
183
  setup(api2) {
182
184
  deferred.builder.context.resolve(import_lodash.default.cloneDeep(api2.context));
183
185
  api2.modifyBundlerChain(() => {
184
- deferred.builder.config.resolved.resolve(import_lodash.default.cloneDeep(api2.getBuilderConfig()));
186
+ deferred.builder.config.resolved.resolve(import_lodash.default.cloneDeep(api2.getRsbuildConfig()));
185
187
  deferred.builder.config.transformed.resolve(import_lodash.default.cloneDeep(api2.getNormalizedConfig()));
186
188
  });
187
- const modifyBundlerConfig = "modifyWebpackConfig" in api2 ? api2.modifyWebpackConfig : api2.modifyRspackConfig;
188
- const expectBundlerNum = import_lodash.default.castArray(api2.context.target).length;
189
+ const modifyBundlerConfig = api2.context.bundlerType === "webpack" ? api2.modifyWebpackConfig : api2.modifyRspackConfig;
190
+ const expectBundlerNum = import_lodash.default.castArray(api2.context.targets).length;
189
191
  const bundlerConfigs = [];
190
192
  modifyBundlerConfig((config) => {
191
193
  bundlerConfigs.push(config);
package/dist/types.d.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { BaseHooks } from '@modern-js/core';
3
- import type { BuilderPluginAPI as WebpackBuilderAPI } from '@modern-js/builder-webpack-provider';
4
- import type { BuilderPluginAPI as RspackBuilderAPI } from '@modern-js/builder-rspack-provider';
5
3
  import type { AppTools, AppToolsHooks, CliPlugin } from '@modern-js/app-tools';
6
4
  import type { ServerPlugin, ToThreads } from '@modern-js/server-core';
7
5
  export type CliPluginAPI = Parameters<NonNullable<CliPlugin<AppTools>['setup']>>[0];
8
6
  export type ServerPluginAPI = Parameters<NonNullable<ServerPlugin['setup']>>[0];
9
- export type BuilderPluginAPI = WebpackBuilderAPI | RspackBuilderAPI;
10
7
  export type BufferLike = string | Buffer | DataView | number | ArrayBufferView | Uint8Array | ArrayBuffer | SharedArrayBuffer | ReadonlyArray<any> | ReadonlyArray<number> | {
11
8
  valueOf: () => ArrayBuffer;
12
9
  } | {
@@ -12,7 +12,6 @@ export interface SendMessageOptions {
12
12
  }
13
13
  export type ServerOptions<U extends typeof WebSocket.WebSocket = typeof WebSocket.WebSocket, V extends typeof IncomingMessage = typeof IncomingMessage> = WebSocket.Server<U, V>['options'];
14
14
  export declare class SocketServer<T extends typeof WebSocket.WebSocket = typeof WebSocket.WebSocket, U extends typeof IncomingMessage = typeof IncomingMessage> extends WebSocket.Server<T, U> {
15
- constructor(options?: ServerOptions<T, U>, callback?: () => void);
16
15
  handleHeartbeat(timeout?: number): void;
17
16
  broadcast(data: BufferLike, cb?: (err?: Error) => void): void;
18
17
  broadcast(data: BufferLike, options: SendMessageOptions, cb?: (err?: Error) => void): void;
@@ -33,6 +33,10 @@ __export(socket_exports, {
33
33
  module.exports = __toCommonJS(socket_exports);
34
34
  var import_ws = __toESM(require("ws"));
35
35
  class SocketServer extends import_ws.default.Server {
36
+ // constructor(options?: ServerOptions<T, U>, callback?: () => void) {
37
+ // super(options, callback);
38
+ // this.handleHeartbeat();
39
+ // }
36
40
  handleHeartbeat(timeout = 3e4) {
37
41
  const aliveMapping = /* @__PURE__ */ new WeakMap();
38
42
  function heartbeat() {
@@ -63,10 +67,6 @@ class SocketServer extends import_ws.default.Server {
63
67
  const cb = typeof optsOrCb === "function" ? optsOrCb : cbOrNone;
64
68
  this.clients.forEach((client) => client.readyState === import_ws.default.OPEN && client.send(data, opts !== null && opts !== void 0 ? opts : {}, cb));
65
69
  }
66
- constructor(options, callback) {
67
- super(options, callback);
68
- this.handleHeartbeat();
69
- }
70
70
  }
71
71
  // Annotate the CommonJS export names for ESM import in node:
72
72
  0 && (module.exports = {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.45.0",
18
+ "version": "2.46.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/index.d.ts",
21
21
  "main": "./dist/index.js",
@@ -45,9 +45,9 @@
45
45
  "p-defer": "^3.0.0",
46
46
  "ws": "^8.13.0",
47
47
  "ufo": "^1.3.0",
48
- "@modern-js/devtools-kit": "2.45.0",
49
- "@modern-js/utils": "2.45.0",
50
- "@modern-js/devtools-client": "2.45.0"
48
+ "@modern-js/devtools-kit": "2.46.1",
49
+ "@modern-js/devtools-client": "2.46.1",
50
+ "@modern-js/utils": "2.46.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/serve-static": "^1.13.10",
@@ -56,19 +56,17 @@
56
56
  "@types/ws": "^8.5.5",
57
57
  "type-fest": "^4.1.0",
58
58
  "typescript": "^5",
59
- "@modern-js/app-tools": "2.45.0",
60
- "@modern-js/core": "2.45.0",
61
- "@modern-js/module-tools": "2.45.0",
62
- "@modern-js/runtime": "2.45.0",
63
- "@modern-js/builder-webpack-provider": "2.45.0",
64
- "@modern-js/server-core": "2.45.0",
65
- "@modern-js/types": "2.45.0",
66
- "@modern-js/builder-rspack-provider": "2.45.0",
67
- "@modern-js/builder-shared": "2.45.0",
68
- "@scripts/build": "2.45.0"
59
+ "@modern-js/app-tools": "2.46.1",
60
+ "@modern-js/core": "2.46.1",
61
+ "@modern-js/module-tools": "2.46.1",
62
+ "@modern-js/runtime": "2.46.1",
63
+ "@modern-js/types": "2.46.1",
64
+ "@modern-js/server-core": "2.46.1",
65
+ "@modern-js/uni-builder": "2.46.1",
66
+ "@scripts/build": "2.46.1"
69
67
  },
70
68
  "peerDependencies": {
71
- "@modern-js/runtime": "^2.45.0"
69
+ "@modern-js/runtime": "^2.46.1"
72
70
  },
73
71
  "peerDependenciesMeta": {
74
72
  "@modern-js/runtime": {