@modern-js/plugin-devtools 2.41.0 → 2.42.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/dist/cli.d.ts +1 -1
- package/dist/cli.js +24 -0
- package/dist/config.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/rpc/index.d.ts +7 -7
- package/dist/types.d.ts +7 -7
- package/dist/utils/module.d.ts +1 -1
- package/dist/utils/socket.d.ts +9 -9
- package/package.json +15 -15
package/dist/cli.d.ts
CHANGED
@@ -2,4 +2,4 @@ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
2
2
|
import { DevtoolsPluginOptions, DevtoolsPluginInlineOptions } from './config';
|
3
3
|
export type { DevtoolsPluginOptions, DevtoolsPluginInlineOptions };
|
4
4
|
export declare const devtoolsPlugin: (inlineOptions?: DevtoolsPluginInlineOptions) => CliPlugin<AppTools>;
|
5
|
-
export default devtoolsPlugin;
|
5
|
+
export default devtoolsPlugin;
|
package/dist/cli.js
CHANGED
@@ -64,6 +64,17 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
|
|
64
64
|
beforeRestart() {
|
65
65
|
return new Promise((resolve, reject) => httpServer.instance.close((err) => err ? reject(err) : resolve()));
|
66
66
|
},
|
67
|
+
modifyServerRoutes({ routes }) {
|
68
|
+
routes.push({
|
69
|
+
urlPath: "/sw-proxy.js",
|
70
|
+
isSPA: true,
|
71
|
+
isSSR: false,
|
72
|
+
entryPath: "public/sw-proxy.js"
|
73
|
+
});
|
74
|
+
return {
|
75
|
+
routes
|
76
|
+
};
|
77
|
+
},
|
67
78
|
config() {
|
68
79
|
var _api_useConfigContext_devtools;
|
69
80
|
const config = (_api_useConfigContext_devtools = api.useConfigContext().devtools) !== null && _api_useConfigContext_devtools !== void 0 ? _api_useConfigContext_devtools : {};
|
@@ -72,6 +83,7 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
|
|
72
83
|
});
|
73
84
|
import_utils.logger.info(`${ctx.def.name.formalName} Devtools is enabled`);
|
74
85
|
const runtimeEntry = require.resolve("@modern-js/devtools-client/mount");
|
86
|
+
const swProxyEntry = require.resolve("@modern-js/devtools-client/sw-proxy");
|
75
87
|
return {
|
76
88
|
builderPlugins: [
|
77
89
|
rpc.builderPlugin
|
@@ -79,8 +91,20 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
|
|
79
91
|
source: {
|
80
92
|
preEntry: [
|
81
93
|
(0, import_ufo.withQuery)(runtimeEntry, ctx)
|
94
|
+
],
|
95
|
+
include: [
|
96
|
+
runtimeEntry
|
97
|
+
]
|
98
|
+
},
|
99
|
+
output: {
|
100
|
+
copy: [
|
101
|
+
{
|
102
|
+
from: swProxyEntry,
|
103
|
+
to: "public"
|
104
|
+
}
|
82
105
|
]
|
83
106
|
},
|
107
|
+
html: {},
|
84
108
|
tools: {
|
85
109
|
devServer: {
|
86
110
|
proxy: {
|
package/dist/config.d.ts
CHANGED
@@ -2,10 +2,10 @@ import { ClientDefinition, SetupClientParams } from '@modern-js/devtools-kit';
|
|
2
2
|
import type { RequiredDeep } from 'type-fest';
|
3
3
|
export type DevtoolsPluginOptions = Partial<SetupClientParams>;
|
4
4
|
export interface DevtoolsPluginInlineOptions extends DevtoolsPluginOptions {
|
5
|
-
|
5
|
+
enable?: boolean;
|
6
6
|
}
|
7
7
|
export type DevtoolsContext = RequiredDeep<DevtoolsPluginInlineOptions>;
|
8
8
|
export declare const getDefaultOptions: () => {
|
9
|
-
|
9
|
+
def: ClientDefinition;
|
10
10
|
};
|
11
|
-
export declare const resolveContext: (...sources: DevtoolsPluginInlineOptions[]) => DevtoolsContext;
|
11
|
+
export declare const resolveContext: (...sources: DevtoolsPluginInlineOptions[]) => DevtoolsContext;
|
package/dist/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export { devtoolsPlugin, default } from './cli';
|
2
|
-
export type { DevtoolsPluginOptions, DevtoolsPluginInlineOptions } from './cli';
|
2
|
+
export type { DevtoolsPluginOptions, DevtoolsPluginInlineOptions } from './cli';
|
package/dist/rpc/index.d.ts
CHANGED
@@ -4,12 +4,12 @@ import type { BuilderPlugin } from '@modern-js/builder-shared';
|
|
4
4
|
import { CliPluginAPI, BuilderPluginAPI, InjectedHooks } from '../types';
|
5
5
|
import { SocketServer } from '../utils/socket';
|
6
6
|
export interface SetupClientConnectionOptions {
|
7
|
-
|
8
|
-
|
7
|
+
api: CliPluginAPI;
|
8
|
+
server: SocketServer;
|
9
9
|
}
|
10
10
|
export declare const setupClientConnection: (options: SetupClientConnectionOptions) => Promise<{
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}>;
|
11
|
+
client: import("birpc").BirpcReturn<ClientFunctions, ServerFunctions>;
|
12
|
+
hooks: InjectedHooks;
|
13
|
+
builderPlugin: BuilderPlugin<BuilderPluginAPI>;
|
14
|
+
setDefinition: (definition: PartialDeep<ClientDefinition>) => void;
|
15
|
+
}>;
|
package/dist/types.d.ts
CHANGED
@@ -8,17 +8,17 @@ export type CliPluginAPI = Parameters<NonNullable<CliPlugin<AppTools>['setup']>>
|
|
8
8
|
export type ServerPluginAPI = Parameters<NonNullable<ServerPlugin['setup']>>[0];
|
9
9
|
export type BuilderPluginAPI = WebpackBuilderAPI | RspackBuilderAPI;
|
10
10
|
export type BufferLike = string | Buffer | DataView | number | ArrayBufferView | Uint8Array | ArrayBuffer | SharedArrayBuffer | ReadonlyArray<any> | ReadonlyArray<number> | {
|
11
|
-
|
11
|
+
valueOf: () => ArrayBuffer;
|
12
12
|
} | {
|
13
|
-
|
13
|
+
valueOf: () => SharedArrayBuffer;
|
14
14
|
} | {
|
15
|
-
|
15
|
+
valueOf: () => Uint8Array;
|
16
16
|
} | {
|
17
|
-
|
17
|
+
valueOf: () => ReadonlyArray<number>;
|
18
18
|
} | {
|
19
|
-
|
19
|
+
valueOf: () => string;
|
20
20
|
} | {
|
21
|
-
|
21
|
+
[Symbol.toPrimitive]: (hint: string) => string;
|
22
22
|
};
|
23
23
|
export type Hooks = BaseHooks<any> & AppToolsHooks<any>;
|
24
|
-
export type InjectedHooks = Pick<ToThreads<Hooks>, 'prepare' | 'modifyFileSystemRoutes'>;
|
24
|
+
export type InjectedHooks = Pick<ToThreads<Hooks>, 'prepare' | 'modifyFileSystemRoutes'>;
|
package/dist/utils/module.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
export declare const getRequire: () => NodeRequire;
|
3
3
|
export declare const resolveModule: (id: string[] | string) => string | null;
|
4
|
-
export declare const requireModule: (id: string[] | string) => any;
|
4
|
+
export declare const requireModule: (id: string[] | string) => any;
|
package/dist/utils/socket.d.ts
CHANGED
@@ -3,15 +3,15 @@ import { IncomingMessage } from 'http';
|
|
3
3
|
import WebSocket from 'ws';
|
4
4
|
import { BufferLike } from '../types';
|
5
5
|
export interface SendMessageOptions {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
mask?: boolean | undefined;
|
7
|
+
binary?: boolean | undefined;
|
8
|
+
compress?: boolean | undefined;
|
9
|
+
fin?: boolean | undefined;
|
10
10
|
}
|
11
11
|
export type ServerOptions<U extends typeof WebSocket.WebSocket = typeof WebSocket.WebSocket, V extends typeof IncomingMessage = typeof IncomingMessage> = WebSocket.Server<U, V>['options'];
|
12
12
|
export declare class SocketServer<T extends typeof WebSocket.WebSocket = typeof WebSocket.WebSocket, U extends typeof IncomingMessage = typeof IncomingMessage> extends WebSocket.Server<T, U> {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}
|
13
|
+
constructor(options?: ServerOptions<T, U>, callback?: () => void);
|
14
|
+
handleHeartbeat(timeout?: number): void;
|
15
|
+
broadcast(data: BufferLike, cb?: (err?: Error) => void): void;
|
16
|
+
broadcast(data: BufferLike, options: SendMessageOptions, cb?: (err?: Error) => void): void;
|
17
|
+
}
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.42.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.
|
49
|
-
"@modern-js/devtools-client": "2.
|
50
|
-
"@modern-js/utils": "2.
|
48
|
+
"@modern-js/devtools-kit": "2.42.1",
|
49
|
+
"@modern-js/devtools-client": "2.42.1",
|
50
|
+
"@modern-js/utils": "2.42.1"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
53
|
"@types/serve-static": "^1.13.10",
|
@@ -56,19 +56,19 @@
|
|
56
56
|
"@types/ws": "^8.5.5",
|
57
57
|
"type-fest": "^4.1.0",
|
58
58
|
"typescript": "^5",
|
59
|
-
"@modern-js/
|
60
|
-
"@modern-js/
|
61
|
-
"@modern-js/
|
62
|
-
"@modern-js/runtime": "2.
|
63
|
-
"@modern-js/server-core": "2.
|
64
|
-
"@modern-js/
|
65
|
-
"@modern-js/
|
66
|
-
"@modern-js/builder-
|
67
|
-
"@modern-js/builder-shared": "2.
|
68
|
-
"@scripts/build": "2.
|
59
|
+
"@modern-js/app-tools": "2.42.1",
|
60
|
+
"@modern-js/module-tools": "2.42.1",
|
61
|
+
"@modern-js/core": "2.42.1",
|
62
|
+
"@modern-js/runtime": "2.42.1",
|
63
|
+
"@modern-js/server-core": "2.42.1",
|
64
|
+
"@modern-js/types": "2.42.1",
|
65
|
+
"@modern-js/builder-rspack-provider": "2.42.1",
|
66
|
+
"@modern-js/builder-webpack-provider": "2.42.1",
|
67
|
+
"@modern-js/builder-shared": "2.42.1",
|
68
|
+
"@scripts/build": "2.42.1"
|
69
69
|
},
|
70
70
|
"peerDependencies": {
|
71
|
-
"@modern-js/runtime": "^2.
|
71
|
+
"@modern-js/runtime": "^2.42.1"
|
72
72
|
},
|
73
73
|
"peerDependenciesMeta": {
|
74
74
|
"@modern-js/runtime": {
|