@modern-js/plugin-devtools 2.37.2 → 2.39.0

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
- import { Options } from './config';
3
- export type { Options };
4
- export declare const devtoolsPlugin: (options?: Options) => CliPlugin<AppTools>;
2
+ import { DevtoolsPluginOptions, DevtoolsPluginInlineOptions } from './config';
3
+ export type { DevtoolsPluginOptions, DevtoolsPluginInlineOptions };
4
+ export declare const devtoolsPlugin: (options?: DevtoolsPluginInlineOptions) => CliPlugin<AppTools>;
5
5
  export default devtoolsPlugin;
package/dist/cli.js CHANGED
@@ -45,6 +45,11 @@ const devtoolsPlugin = (options) => ({
45
45
  name: "@modern-js/plugin-devtools",
46
46
  usePlugins: [],
47
47
  setup: async (api) => {
48
+ var _options_enable;
49
+ const enablePlugin = (_options_enable = options === null || options === void 0 ? void 0 : options.enable) !== null && _options_enable !== void 0 ? _options_enable : process.env.NODE_ENV === "development";
50
+ if (!enablePlugin) {
51
+ return {};
52
+ }
48
53
  const port = await (0, import_utils.getPort)(8782, {
49
54
  slient: true
50
55
  });
@@ -92,6 +97,7 @@ const devtoolsPlugin = (options) => ({
92
97
  },
93
98
  config() {
94
99
  const opts = (0, import_config.resolveOptions)(api, options);
100
+ import_utils.logger.info(`${opts.def.name.formalName} Devtools is enabled`);
95
101
  opts.def && rpc.setDefinition(opts.def);
96
102
  const mountOpts = {
97
103
  dataSource: `${import_devtools_kit.ROUTE_BASENAME}/rpc`,
package/dist/config.d.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  import { ClientDefinition } from '@modern-js/devtools-kit';
2
2
  import { PartialDeep } from 'type-fest';
3
3
  import { CliPluginAPI } from './types';
4
- export interface Options {
4
+ export interface DevtoolsPluginOptions {
5
5
  def?: PartialDeep<ClientDefinition>;
6
6
  }
7
+ export interface DevtoolsPluginInlineOptions extends DevtoolsPluginOptions {
8
+ enable?: boolean;
9
+ }
7
10
  export declare const getDefaultOptions: () => {
8
11
  def: ClientDefinition;
9
12
  };
10
- export declare const resolveOptions: (api: CliPluginAPI, options?: Options) => Options & {
13
+ export declare const resolveOptions: (api: CliPluginAPI, options?: DevtoolsPluginOptions) => DevtoolsPluginOptions & {
11
14
  def: ClientDefinition;
12
15
  };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { devtoolsPlugin, default } from './cli';
2
- export type { Options } from './cli';
2
+ export type { DevtoolsPluginOptions, DevtoolsPluginInlineOptions } from './cli';
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.37.2",
18
+ "version": "2.39.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/index.d.ts",
21
21
  "main": "./dist/index.js",
@@ -43,12 +43,12 @@
43
43
  "birpc": "0.2.13",
44
44
  "serve-static": "^1.14.1",
45
45
  "p-defer": "^3.0.0",
46
- "ws": "8.13.0",
46
+ "ws": "^8.13.0",
47
47
  "ufo": "^1.3.0",
48
- "@modern-js/devtools-kit": "2.37.2",
49
- "@modern-js/devtools-mount": "2.37.2",
50
- "@modern-js/devtools-client": "2.37.2",
51
- "@modern-js/utils": "2.37.2"
48
+ "@modern-js/devtools-kit": "2.39.0",
49
+ "@modern-js/devtools-mount": "2.39.0",
50
+ "@modern-js/devtools-client": "2.39.0",
51
+ "@modern-js/utils": "2.39.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/serve-static": "^1.13.10",
@@ -57,19 +57,19 @@
57
57
  "@types/ws": "^8.5.5",
58
58
  "type-fest": "^4.1.0",
59
59
  "typescript": "^5",
60
- "@modern-js/app-tools": "2.37.2",
61
- "@modern-js/core": "2.37.2",
62
- "@modern-js/module-tools": "2.37.2",
63
- "@modern-js/runtime": "2.37.2",
64
- "@modern-js/server-core": "2.37.2",
65
- "@modern-js/types": "2.37.2",
66
- "@modern-js/builder-webpack-provider": "2.37.2",
67
- "@modern-js/builder-rspack-provider": "2.37.2",
68
- "@modern-js/builder-shared": "2.37.2",
69
- "@scripts/build": "2.37.2"
60
+ "@modern-js/app-tools": "2.39.0",
61
+ "@modern-js/core": "2.39.0",
62
+ "@modern-js/module-tools": "2.39.0",
63
+ "@modern-js/runtime": "2.39.0",
64
+ "@modern-js/server-core": "2.39.0",
65
+ "@modern-js/types": "2.39.0",
66
+ "@modern-js/builder-webpack-provider": "2.39.0",
67
+ "@modern-js/builder-rspack-provider": "2.39.0",
68
+ "@modern-js/builder-shared": "2.39.0",
69
+ "@scripts/build": "2.39.0"
70
70
  },
71
71
  "peerDependencies": {
72
- "@modern-js/runtime": "^2.37.2"
72
+ "@modern-js/runtime": "^2.39.0"
73
73
  },
74
74
  "peerDependenciesMeta": {
75
75
  "@modern-js/runtime": {