@modern-js/plugin-devtools 2.33.1 → 2.35.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 ADDED
@@ -0,0 +1,9 @@
1
+ import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
+ import { ClientDefinition, SetupClientOptions } from '@modern-js/devtools-kit';
3
+ import { PartialDeep } from 'type-fest';
4
+ export interface Options extends SetupClientOptions {
5
+ rpcPath?: string;
6
+ def?: PartialDeep<ClientDefinition>;
7
+ }
8
+ export declare const devtoolsPlugin: (options?: Options) => CliPlugin<AppTools>;
9
+ export default devtoolsPlugin;
package/dist/cli.js ADDED
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for (var name in all)
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ devtoolsPlugin: function() {
14
+ return devtoolsPlugin;
15
+ },
16
+ default: function() {
17
+ return _default;
18
+ }
19
+ });
20
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
+ const _lodash = /* @__PURE__ */ _interop_require_default._(require("@modern-js/utils/lodash"));
22
+ const _devtoolskit = require("@modern-js/devtools-kit");
23
+ const _rpc = require("./rpc");
24
+ const getDefaultOptions = () => ({
25
+ rpcPath: "/_modern_js/devtools/rpc",
26
+ def: new _devtoolskit.ClientDefinition()
27
+ });
28
+ const devtoolsPlugin = (options) => ({
29
+ name: "@modern-js/plugin-devtools",
30
+ usePlugins: [],
31
+ setup: async (api) => {
32
+ const opts = _lodash.default.defaultsDeep(_lodash.default.cloneDeep(options), getDefaultOptions());
33
+ const mountOpts = _lodash.default.pick(opts, [
34
+ "endpoint",
35
+ "version",
36
+ "dataSource"
37
+ ]);
38
+ const { hooks, builderPlugin, url } = await (0, _rpc.setupClientConnection)({
39
+ api,
40
+ def: opts.def
41
+ });
42
+ return {
43
+ prepare: hooks.prepare,
44
+ modifyFileSystemRoutes: hooks.modifyFileSystemRoutes,
45
+ validateSchema() {
46
+ return [
47
+ {
48
+ target: "tools.devtools",
49
+ schema: {
50
+ typeof: [
51
+ "boolean"
52
+ ]
53
+ }
54
+ }
55
+ ];
56
+ },
57
+ config() {
58
+ return {
59
+ builderPlugins: [
60
+ builderPlugin
61
+ ],
62
+ source: {
63
+ preEntry: [
64
+ require.resolve("@modern-js/plugin-devtools/runtime")
65
+ ],
66
+ globalVars: {
67
+ "process.env.__MODERN_DEVTOOLS_MOUNT_OPTIONS": mountOpts
68
+ }
69
+ },
70
+ tools: {
71
+ devServer: {
72
+ proxy: {
73
+ [opts.rpcPath]: {
74
+ target: url.href,
75
+ autoRewrite: true,
76
+ ws: true
77
+ }
78
+ }
79
+ }
80
+ }
81
+ };
82
+ }
83
+ };
84
+ }
85
+ });
86
+ const _default = devtoolsPlugin;
@@ -0,0 +1,16 @@
1
+ /// <reference types="node" />
2
+ import { URL } from 'url';
3
+ import { type ClientDefinition, type ClientFunctions, type ServerFunctions } from '@modern-js/devtools-kit';
4
+ import type { PartialDeep } from 'type-fest';
5
+ import type { BuilderPlugin } from '@modern-js/builder-shared';
6
+ import { CliPluginAPI, BuilderPluginAPI, InjectedHooks } from '../types';
7
+ export interface SetupClientConnectionOptions {
8
+ api: CliPluginAPI;
9
+ def?: PartialDeep<ClientDefinition>;
10
+ }
11
+ export declare const setupClientConnection: (options: SetupClientConnectionOptions) => Promise<{
12
+ client: import("birpc").BirpcReturn<ClientFunctions, ServerFunctions>;
13
+ hooks: InjectedHooks;
14
+ builderPlugin: BuilderPlugin<BuilderPluginAPI>;
15
+ url: URL;
16
+ }>;
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "setupClientConnection", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return setupClientConnection;
9
+ }
10
+ });
11
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
+ const _url = require("url");
13
+ const _lodash = /* @__PURE__ */ _interop_require_default._(require("@modern-js/utils/lodash"));
14
+ const _devtoolskit = require("@modern-js/devtools-kit");
15
+ const _birpc = require("birpc");
16
+ const _pdefer = /* @__PURE__ */ _interop_require_default._(require("p-defer"));
17
+ const _utils = require("@modern-js/utils");
18
+ const _socket = require("../utils/socket");
19
+ const _module = require("../utils/module");
20
+ const setupClientConnection = async (options) => {
21
+ const { api, def = {} } = options;
22
+ const port = await (0, _utils.getPort)(8782);
23
+ const server = new _socket.SocketServer({
24
+ port
25
+ });
26
+ const url = new _url.URL(`ws://localhost:${port}`);
27
+ const _fileSystemRoutesMap = {};
28
+ let handleMessage = null;
29
+ const onceConnection = new Promise((resolve) => {
30
+ server.on("connection", (ws) => {
31
+ resolve();
32
+ ws.on("message", (data, isBinary) => {
33
+ var _handleMessage;
34
+ return (_handleMessage = handleMessage) === null || _handleMessage === void 0 ? void 0 : _handleMessage(data, isBinary);
35
+ });
36
+ });
37
+ });
38
+ const deferred = {
39
+ prepare: (0, _pdefer.default)(),
40
+ builder: {
41
+ context: (0, _pdefer.default)(),
42
+ config: {
43
+ resolved: (0, _pdefer.default)(),
44
+ transformed: (0, _pdefer.default)()
45
+ }
46
+ },
47
+ bundler: {
48
+ config: {
49
+ resolved: (0, _pdefer.default)(),
50
+ transformed: (0, _pdefer.default)()
51
+ }
52
+ },
53
+ compileTimeCost: (0, _pdefer.default)()
54
+ };
55
+ const serverFunctions = {
56
+ async getFrameworkConfig() {
57
+ await deferred.prepare.promise;
58
+ return api.useConfigContext();
59
+ },
60
+ async getTransformedFrameworkConfig() {
61
+ await deferred.prepare.promise;
62
+ return api.useResolvedConfigContext();
63
+ },
64
+ async getBuilderConfig() {
65
+ return deferred.builder.config.resolved.promise;
66
+ },
67
+ async getTransformedBuilderConfig() {
68
+ return deferred.builder.config.transformed.promise;
69
+ },
70
+ async getBundlerConfigs() {
71
+ return deferred.bundler.config.resolved.promise;
72
+ },
73
+ async getTransformedBundlerConfigs() {
74
+ return deferred.bundler.config.transformed.promise;
75
+ },
76
+ async getAppContext() {
77
+ await deferred.prepare.promise;
78
+ const ctx = {
79
+ ...api.useAppContext()
80
+ };
81
+ return _lodash.default.omit(ctx, [
82
+ "builder",
83
+ "serverInternalPlugins"
84
+ ]);
85
+ },
86
+ async getFileSystemRoutes(entryName) {
87
+ var _fileSystemRoutesMap_entryName;
88
+ return (_fileSystemRoutesMap_entryName = _fileSystemRoutesMap[entryName]) !== null && _fileSystemRoutesMap_entryName !== void 0 ? _fileSystemRoutesMap_entryName : [];
89
+ },
90
+ async getBuilderContext() {
91
+ const ctx = await deferred.builder.context.promise;
92
+ return ctx;
93
+ },
94
+ async getDependencies() {
95
+ const ctx = await deferred.builder.context.promise;
96
+ const ret = {};
97
+ const resolveExprs = {
98
+ react: [
99
+ ctx.rootPath,
100
+ "react/package.json"
101
+ ],
102
+ "@modern-js/app-tools": [
103
+ ctx.rootPath,
104
+ "@modern-js/app-tools/package.json"
105
+ ],
106
+ "@edenx/app-tools": [
107
+ ctx.rootPath,
108
+ "@edenx/app-tools/package.json"
109
+ ],
110
+ webpack: [
111
+ ctx.rootPath,
112
+ "@modern-js/app-tools",
113
+ "@modern-js/builder-webpack-provider",
114
+ "webpack/package.json"
115
+ ],
116
+ "@rspack/core": [
117
+ ctx.rootPath,
118
+ "@modern-js/builder-rspack-provider",
119
+ "@rspack/core/package.json"
120
+ ]
121
+ };
122
+ for (const [name, expr] of Object.entries(resolveExprs)) {
123
+ try {
124
+ ret[name] = (0, _module.requireModule)(expr).version;
125
+ } catch {
126
+ }
127
+ }
128
+ return ret;
129
+ },
130
+ async getCompileTimeCost() {
131
+ return deferred.compileTimeCost.promise;
132
+ },
133
+ async getClientDefinition() {
134
+ const ret = {
135
+ name: new _devtoolskit.NameDefinition(),
136
+ packages: new _devtoolskit.PackageDefinition(),
137
+ assets: new _devtoolskit.AssetDefinition()
138
+ };
139
+ Object.assign(ret.name, def.name);
140
+ Object.assign(ret.packages, def.packages);
141
+ Object.assign(ret.assets, def.assets);
142
+ return ret;
143
+ },
144
+ echo(content) {
145
+ return content;
146
+ }
147
+ };
148
+ const clientRpcOptions = {
149
+ post: (data) => onceConnection.then(() => server.clients.forEach((ws) => ws.send(data))),
150
+ on: (cb) => handleMessage = cb,
151
+ serialize: (v) => JSON.stringify(v),
152
+ deserialize: (v) => JSON.parse(v.toString())
153
+ };
154
+ const clientConn = (0, _birpc.createBirpc)(serverFunctions, clientRpcOptions);
155
+ const hooks = {
156
+ prepare() {
157
+ deferred.prepare.resolve();
158
+ },
159
+ modifyFileSystemRoutes({ entrypoint, routes }) {
160
+ _fileSystemRoutesMap[entrypoint.entryName] = _lodash.default.cloneDeep(routes);
161
+ return {
162
+ entrypoint,
163
+ routes
164
+ };
165
+ }
166
+ };
167
+ const builderPlugin = {
168
+ name: "builder-plugin-devtools",
169
+ setup(api2) {
170
+ deferred.builder.context.resolve(_lodash.default.cloneDeep(api2.context));
171
+ api2.modifyBundlerChain(() => {
172
+ deferred.builder.config.resolved.resolve(_lodash.default.cloneDeep(api2.getBuilderConfig()));
173
+ deferred.builder.config.transformed.resolve(_lodash.default.cloneDeep(api2.getNormalizedConfig()));
174
+ });
175
+ const modifyBundlerConfig = "modifyWebpackConfig" in api2 ? api2.modifyWebpackConfig : api2.modifyRspackConfig;
176
+ const expectBundlerNum = _lodash.default.castArray(api2.context.target).length;
177
+ const bundlerConfigs = [];
178
+ modifyBundlerConfig((config) => {
179
+ bundlerConfigs.push(config);
180
+ if (bundlerConfigs.length >= expectBundlerNum) {
181
+ deferred.bundler.config.resolved.resolve(_lodash.default.cloneDeep(bundlerConfigs));
182
+ }
183
+ });
184
+ api2.onBeforeCreateCompiler(({ bundlerConfigs: bundlerConfigs2 }) => {
185
+ deferred.bundler.config.transformed.resolve(_lodash.default.cloneDeep(bundlerConfigs2));
186
+ });
187
+ let buildStartedAt = NaN;
188
+ api2.onAfterCreateCompiler(() => {
189
+ buildStartedAt = Date.now();
190
+ });
191
+ api2.onDevCompileDone(() => {
192
+ deferred.compileTimeCost.resolve(Date.now() - buildStartedAt);
193
+ });
194
+ api2.onAfterBuild(() => {
195
+ deferred.compileTimeCost.resolve(Date.now() - buildStartedAt);
196
+ });
197
+ }
198
+ };
199
+ return {
200
+ client: clientConn,
201
+ hooks,
202
+ builderPlugin,
203
+ url
204
+ };
205
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _devtoolsmount = require("@modern-js/devtools-mount");
6
+ const opts = process.env.__MODERN_DEVTOOLS_MOUNT_OPTIONS;
7
+ (0, _devtoolsmount.mountDevTools)(opts);
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
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
+ import type { AppTools, AppToolsHooks, CliPlugin } from '@modern-js/app-tools';
6
+ import type { ServerPlugin, ToThreads } from '@modern-js/server-core';
7
+ export type CliPluginAPI = Parameters<NonNullable<CliPlugin<AppTools>['setup']>>[0];
8
+ export type ServerPluginAPI = Parameters<NonNullable<ServerPlugin['setup']>>[0];
9
+ export type BuilderPluginAPI = WebpackBuilderAPI | RspackBuilderAPI;
10
+ export type BufferLike = string | Buffer | DataView | number | ArrayBufferView | Uint8Array | ArrayBuffer | SharedArrayBuffer | ReadonlyArray<any> | ReadonlyArray<number> | {
11
+ valueOf: () => ArrayBuffer;
12
+ } | {
13
+ valueOf: () => SharedArrayBuffer;
14
+ } | {
15
+ valueOf: () => Uint8Array;
16
+ } | {
17
+ valueOf: () => ReadonlyArray<number>;
18
+ } | {
19
+ valueOf: () => string;
20
+ } | {
21
+ [Symbol.toPrimitive]: (hint: string) => string;
22
+ };
23
+ export type Hooks = BaseHooks<any> & AppToolsHooks<any>;
24
+ export type InjectedHooks = Pick<ToThreads<Hooks>, 'prepare' | 'modifyFileSystemRoutes'>;
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" />
2
+ export declare const getRequire: () => NodeRequire;
3
+ export declare const resolveModule: (id: string[] | string) => string | null;
4
+ export declare const requireModule: (id: string[] | string) => any;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for (var name in all)
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ getRequire: function() {
14
+ return getRequire;
15
+ },
16
+ resolveModule: function() {
17
+ return resolveModule;
18
+ },
19
+ requireModule: function() {
20
+ return requireModule;
21
+ }
22
+ });
23
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
24
+ const _assert = /* @__PURE__ */ _interop_require_default._(require("assert"));
25
+ const _module = /* @__PURE__ */ _interop_require_default._(require("module"));
26
+ const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
27
+ const getRequire = () => {
28
+ var _stack_split__match, _stack;
29
+ try {
30
+ return require;
31
+ } catch {
32
+ }
33
+ const issuer = (_stack = new Error().stack) === null || _stack === void 0 ? void 0 : (_stack_split__match = _stack.split("\n")[2].match(/\s*at .+? \((.*)\)$/)) === null || _stack_split__match === void 0 ? void 0 : _stack_split__match[1];
34
+ console.log("issuer: ", issuer);
35
+ if (issuer && _path.default.isAbsolute(issuer)) {
36
+ return _module.default.createRequire(issuer);
37
+ } else {
38
+ return _module.default.createRequire(process.cwd());
39
+ }
40
+ };
41
+ const resolveModule = (id) => {
42
+ const exprs = typeof id === "string" ? id.split(">") : id;
43
+ if (!exprs.length)
44
+ return null;
45
+ const _require = getRequire();
46
+ let resolved = process.cwd();
47
+ for (const id2 of exprs) {
48
+ if (_path.default.isAbsolute(id2)) {
49
+ resolved = id2;
50
+ continue;
51
+ }
52
+ try {
53
+ resolved = _require.resolve(id2, {
54
+ paths: [
55
+ resolved
56
+ ]
57
+ });
58
+ } catch (e) {
59
+ if (e.code === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
60
+ const expr = id2.replace(/.+\/node_modules\//, "");
61
+ const pkgName = expr.startsWith("@") ? expr.split("/").slice(0, 2).join("/") : expr.split("/")[0];
62
+ const resolvedMain = resolveModule([
63
+ resolved,
64
+ pkgName
65
+ ]);
66
+ (0, _assert.default)(resolvedMain);
67
+ const resolveDir = `${resolvedMain.slice(0, resolvedMain.lastIndexOf(`/node_modules/${pkgName}`) + 1)}/node_modules/${pkgName}`;
68
+ const subpath = expr.replace(pkgName, ".");
69
+ return resolveModule(_path.default.resolve(resolveDir, subpath));
70
+ }
71
+ const stackText = JSON.stringify(exprs, null, 2);
72
+ const err = new Error(`Failed to resolve "${id2}" from "${resolved}": ${stackText}`);
73
+ err.cause = e;
74
+ throw err;
75
+ }
76
+ }
77
+ return resolved;
78
+ };
79
+ const requireModule = (id) => {
80
+ const resolved = resolveModule(id);
81
+ if (!resolved) {
82
+ throw new Error(`Can't resolve package ${id}.`);
83
+ }
84
+ const _require = getRequire();
85
+ return _require(resolved);
86
+ };
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ import { IncomingMessage } from 'http';
3
+ import WebSocket from 'ws';
4
+ import { BufferLike } from '../types';
5
+ export interface SendMessageOptions {
6
+ mask?: boolean | undefined;
7
+ binary?: boolean | undefined;
8
+ compress?: boolean | undefined;
9
+ fin?: boolean | undefined;
10
+ }
11
+ export type ServerOptions<U extends typeof WebSocket.WebSocket = typeof WebSocket.WebSocket, V extends typeof IncomingMessage = typeof IncomingMessage> = WebSocket.Server<U, V>['options'];
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
+ 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
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "SocketServer", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return SocketServer;
9
+ }
10
+ });
11
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
+ const _ws = /* @__PURE__ */ _interop_require_default._(require("ws"));
13
+ class SocketServer extends _ws.default.Server {
14
+ handleHeartbeat(timeout = 3e4) {
15
+ const aliveMapping = /* @__PURE__ */ new WeakMap();
16
+ function heartbeat() {
17
+ aliveMapping.set(this, true);
18
+ }
19
+ this.on("connection", (ws) => {
20
+ aliveMapping.delete(ws);
21
+ ws.on("error", console.error);
22
+ ws.on("pong", heartbeat);
23
+ });
24
+ const interval = setInterval(() => {
25
+ this.clients.forEach((ws) => {
26
+ const mark = aliveMapping.get(ws);
27
+ if (mark) {
28
+ aliveMapping.delete(ws);
29
+ ws.ping();
30
+ } else {
31
+ ws.terminate();
32
+ }
33
+ });
34
+ }, timeout);
35
+ this.on("close", () => {
36
+ clearInterval(interval);
37
+ });
38
+ }
39
+ broadcast(data, optsOrCb, cbOrNone) {
40
+ const opts = typeof optsOrCb === "function" ? {} : optsOrCb;
41
+ const cb = typeof optsOrCb === "function" ? optsOrCb : cbOrNone;
42
+ this.clients.forEach((client) => client.readyState === _ws.default.OPEN && client.send(data, opts !== null && opts !== void 0 ? opts : {}, cb));
43
+ }
44
+ constructor(options, callback) {
45
+ super(options, callback);
46
+ this.handleHeartbeat();
47
+ }
48
+ }
package/package.json CHANGED
@@ -15,43 +15,54 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.33.1",
18
+ "version": "2.35.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
22
- "module": "./dist/esm/index.js",
23
22
  "exports": {
24
23
  ".": {
25
24
  "node": {
26
25
  "jsnext:source": "./src/index.ts",
27
- "require": "./dist/cjs/index.js"
26
+ "require": "./dist/index.js"
28
27
  },
29
- "default": "./dist/cjs/index.js"
28
+ "default": "./dist/index.js"
30
29
  },
31
30
  "./cli": {
32
31
  "jsnext:source": "./src/cli.ts",
33
- "default": "./dist/cjs/cli.js"
32
+ "default": "./dist/cli.js"
33
+ },
34
+ "./runtime": {
35
+ "jsnext:source": "./src/runtime.ts",
36
+ "default": "./dist/runtime.js"
34
37
  }
35
38
  },
36
39
  "dependencies": {
37
- "@modern-js/devtools-client": "2.33.1",
38
- "@modern-js/devtools-mount": "2.33.1",
39
- "@modern-js/utils": "2.33.1"
40
+ "birpc": "0.2.13",
41
+ "p-defer": "^3.0.0",
42
+ "ws": "8.13.0",
43
+ "@modern-js/devtools-kit": "2.35.0",
44
+ "@modern-js/devtools-mount": "2.35.0",
45
+ "@modern-js/utils": "2.35.0"
40
46
  },
41
47
  "devDependencies": {
42
48
  "@swc/helpers": "0.5.1",
43
49
  "@types/node": "^14",
50
+ "@types/ws": "^8.5.5",
44
51
  "type-fest": "^4.1.0",
45
52
  "typescript": "^5",
46
- "@modern-js/app-tools": "2.33.1",
47
- "@modern-js/core": "2.33.1",
48
- "@modern-js/module-tools": "2.33.1",
49
- "@modern-js/runtime": "2.33.1",
50
- "@modern-js/types": "2.33.1",
51
- "@scripts/build": "2.33.1"
53
+ "@modern-js/app-tools": "2.35.0",
54
+ "@modern-js/core": "2.35.0",
55
+ "@modern-js/module-tools": "2.35.0",
56
+ "@modern-js/runtime": "2.35.0",
57
+ "@modern-js/server-core": "2.35.0",
58
+ "@modern-js/types": "2.35.0",
59
+ "@modern-js/builder-webpack-provider": "2.35.0",
60
+ "@modern-js/builder-rspack-provider": "2.35.0",
61
+ "@modern-js/builder-shared": "2.35.0",
62
+ "@scripts/build": "2.35.0"
52
63
  },
53
64
  "peerDependencies": {
54
- "@modern-js/runtime": "^2.33.1"
65
+ "@modern-js/runtime": "^2.35.0"
55
66
  },
56
67
  "peerDependenciesMeta": {
57
68
  "@modern-js/runtime": {
package/dist/cjs/cli.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- devtoolsPlugin: function() {
14
- return devtoolsPlugin;
15
- },
16
- default: function() {
17
- return _default;
18
- }
19
- });
20
- const devtoolsPlugin = () => ({
21
- name: "@modern-js/plugin-devtools",
22
- usePlugins: [],
23
- setup: async (_api) => {
24
- return {
25
- // prepare() {},
26
- validateSchema() {
27
- return [
28
- {
29
- target: "tools.devtools",
30
- schema: {
31
- typeof: [
32
- "boolean"
33
- ]
34
- }
35
- }
36
- ];
37
- },
38
- config() {
39
- const setupDevtoolsScript = require.resolve("@modern-js/devtools-mount");
40
- return {
41
- source: {
42
- preEntry: [
43
- `data:application/javascript,
44
- import { mountDevTools } from "${setupDevtoolsScript}";
45
- mountDevTools();
46
- `.replace(/\n */g, "")
47
- ]
48
- }
49
- };
50
- }
51
- };
52
- }
53
- });
54
- const _default = devtoolsPlugin;
package/dist/cjs/types.js DELETED
File without changes
package/dist/cjs/utils.js DELETED
File without changes
package/dist/esm/cli.js DELETED
@@ -1,46 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
- export var devtoolsPlugin = function() {
4
- return {
5
- name: "@modern-js/plugin-devtools",
6
- usePlugins: [],
7
- setup: function() {
8
- var _ref = _async_to_generator(function(_api) {
9
- return _ts_generator(this, function(_state) {
10
- return [
11
- 2,
12
- {
13
- // prepare() {},
14
- validateSchema: function validateSchema() {
15
- return [
16
- {
17
- target: "tools.devtools",
18
- schema: {
19
- typeof: [
20
- "boolean"
21
- ]
22
- }
23
- }
24
- ];
25
- },
26
- config: function config() {
27
- var setupDevtoolsScript = require.resolve("@modern-js/devtools-mount");
28
- return {
29
- source: {
30
- preEntry: [
31
- 'data:application/javascript,\n import { mountDevTools } from "'.concat(setupDevtoolsScript, '";\n mountDevTools();\n ').replace(/\n */g, "")
32
- ]
33
- }
34
- };
35
- }
36
- }
37
- ];
38
- });
39
- });
40
- return function(_api) {
41
- return _ref.apply(this, arguments);
42
- };
43
- }()
44
- };
45
- };
46
- export default devtoolsPlugin;
package/dist/esm/index.js DELETED
@@ -1,3 +0,0 @@
1
- import { devtoolsPlugin } from "./cli";
2
- export { devtoolsPlugin };
3
- export default devtoolsPlugin;
package/dist/esm/types.js DELETED
File without changes
package/dist/esm/utils.js DELETED
File without changes
@@ -1,35 +0,0 @@
1
- export const devtoolsPlugin = () => ({
2
- name: "@modern-js/plugin-devtools",
3
- usePlugins: [],
4
- setup: async (_api) => {
5
- return {
6
- // prepare() {},
7
- validateSchema() {
8
- return [
9
- {
10
- target: "tools.devtools",
11
- schema: {
12
- typeof: [
13
- "boolean"
14
- ]
15
- }
16
- }
17
- ];
18
- },
19
- config() {
20
- const setupDevtoolsScript = require.resolve("@modern-js/devtools-mount");
21
- return {
22
- source: {
23
- preEntry: [
24
- `data:application/javascript,
25
- import { mountDevTools } from "${setupDevtoolsScript}";
26
- mountDevTools();
27
- `.replace(/\n */g, "")
28
- ]
29
- }
30
- };
31
- }
32
- };
33
- }
34
- });
35
- export default devtoolsPlugin;
@@ -1,3 +0,0 @@
1
- import { devtoolsPlugin } from "./cli";
2
- export { devtoolsPlugin };
3
- export default devtoolsPlugin;
File without changes
File without changes
@@ -1,7 +0,0 @@
1
- import type { AppTools, CliPlugin } from '@modern-js/app-tools';
2
- export interface Options {
3
- dataSource?: string;
4
- version?: string;
5
- }
6
- export declare const devtoolsPlugin: () => CliPlugin<AppTools>;
7
- export default devtoolsPlugin;
File without changes
File without changes
File without changes
File without changes