@modern-js/devtools-kit 2.47.1 → 2.48.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/client.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ComponentType, ReactElement } from 'react';
1
2
  import type { Entrypoint } from '@modern-js/types';
2
3
  import { FileSystemRoutes } from './server';
3
4
  export interface ClientFunctions {
@@ -36,15 +37,23 @@ export declare class ClientDefinition {
36
37
  assets: AssetDefinition;
37
38
  doctor: DoctorDefinition;
38
39
  announcement: AnnouncementDefinition;
40
+ plugins: string[];
39
41
  }
40
42
  export interface IframeTabView {
41
43
  type: 'iframe';
42
44
  src: string;
43
45
  }
44
- export type CustomTabView = IframeTabView;
45
- export interface CustomTab {
46
+ export interface BuiltinTabView {
47
+ type: 'builtin';
48
+ src: string;
49
+ }
50
+ export interface ExternalTabView {
51
+ type: 'external';
52
+ component: ComponentType;
53
+ }
54
+ export interface Tab {
46
55
  name: string;
47
56
  title: string;
48
- view: CustomTabView;
49
- icon?: string;
57
+ view: BuiltinTabView | ExternalTabView | IframeTabView;
58
+ icon?: string | ReactElement;
50
59
  }
package/dist/client.js CHANGED
@@ -73,6 +73,7 @@ class ClientDefinition {
73
73
  this.assets = new AssetDefinition();
74
74
  this.doctor = new DoctorDefinition();
75
75
  this.announcement = new AnnouncementDefinition();
76
+ this.plugins = [];
76
77
  }
77
78
  }
78
79
  // Annotate the CommonJS export names for ESM import in node:
package/dist/node.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './utils';
5
5
  export * from './constants';
6
6
  export * from './channel';
7
7
  export * from './rsdoctor';
8
+ export * from './runtime-globals';
package/dist/node.js CHANGED
@@ -22,6 +22,7 @@ __reExport(node_exports, require("./utils"), module.exports);
22
22
  __reExport(node_exports, require("./constants"), module.exports);
23
23
  __reExport(node_exports, require("./channel"), module.exports);
24
24
  __reExport(node_exports, require("./rsdoctor"), module.exports);
25
+ __reExport(node_exports, require("./runtime-globals"), module.exports);
25
26
  // Annotate the CommonJS export names for ESM import in node:
26
27
  0 && (module.exports = {
27
28
  ...require("./server"),
@@ -30,5 +31,6 @@ __reExport(node_exports, require("./rsdoctor"), module.exports);
30
31
  ...require("./utils"),
31
32
  ...require("./constants"),
32
33
  ...require("./channel"),
33
- ...require("./rsdoctor")
34
+ ...require("./rsdoctor"),
35
+ ...require("./runtime-globals")
34
36
  });
@@ -0,0 +1,13 @@
1
+ import { Hookable } from 'hookable';
2
+ import { Tab } from './node';
3
+ declare global {
4
+ interface Window {
5
+ [RUNTIME_GLOBALS]?: RuntimeGlobals;
6
+ }
7
+ }
8
+ export declare const RUNTIME_GLOBALS = "__modern_js_global";
9
+ export interface GlobalHooks {
10
+ 'tab:list': (tabs: Tab[]) => void;
11
+ }
12
+ export type RuntimeGlobals = Hookable<GlobalHooks>;
13
+ export declare const getRuntimeGlobals: () => RuntimeGlobals;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var runtime_globals_exports = {};
20
+ __export(runtime_globals_exports, {
21
+ RUNTIME_GLOBALS: () => RUNTIME_GLOBALS,
22
+ getRuntimeGlobals: () => getRuntimeGlobals
23
+ });
24
+ module.exports = __toCommonJS(runtime_globals_exports);
25
+ const RUNTIME_GLOBALS = "__modern_js_global";
26
+ const getRuntimeGlobals = () => {
27
+ const globals = window[RUNTIME_GLOBALS];
28
+ if (!globals || typeof globals !== "object") {
29
+ throw TypeError("RuntimeGlobals is not initialized");
30
+ }
31
+ return globals;
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ RUNTIME_GLOBALS,
36
+ getRuntimeGlobals
37
+ });
package/dist/runtime.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './utils';
5
5
  export * from './constants';
6
6
  export * from './channel';
7
7
  export type * from './rsdoctor';
8
+ export * from './runtime-globals';
package/dist/runtime.js CHANGED
@@ -20,11 +20,13 @@ __reExport(runtime_exports, require("./mount-point"), module.exports);
20
20
  __reExport(runtime_exports, require("./utils"), module.exports);
21
21
  __reExport(runtime_exports, require("./constants"), module.exports);
22
22
  __reExport(runtime_exports, require("./channel"), module.exports);
23
+ __reExport(runtime_exports, require("./runtime-globals"), module.exports);
23
24
  // Annotate the CommonJS export names for ESM import in node:
24
25
  0 && (module.exports = {
25
26
  ...require("./client"),
26
27
  ...require("./mount-point"),
27
28
  ...require("./utils"),
28
29
  ...require("./constants"),
29
- ...require("./channel")
30
+ ...require("./channel"),
31
+ ...require("./runtime-globals")
30
32
  });
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "modern",
22
22
  "modern.js"
23
23
  ],
24
- "version": "2.47.1",
24
+ "version": "2.48.1",
25
25
  "jsnext:source": "./src/index.ts",
26
26
  "types": "./dist/index.d.ts",
27
27
  "main": "./dist/index.js",
@@ -63,8 +63,8 @@
63
63
  "ws": "^8.13.0",
64
64
  "@rsdoctor/types": "^0.1.3",
65
65
  "@rsdoctor/utils": "^0.1.3",
66
- "@modern-js/types": "2.47.1",
67
- "@modern-js/utils": "2.47.1"
66
+ "@modern-js/utils": "2.48.1",
67
+ "@modern-js/types": "2.48.1"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@babel/core": "^7.23.2",
@@ -79,13 +79,13 @@
79
79
  "react": "~18.2.0",
80
80
  "type-fest": "^4.1.0",
81
81
  "typescript": "^5",
82
- "@modern-js/app-tools": "2.47.1",
83
- "@modern-js/core": "2.47.1",
84
- "@modern-js/module-tools": "2.47.1",
85
- "@modern-js/types": "2.47.1",
86
- "@modern-js/uni-builder": "2.47.1",
87
- "@scripts/build": "2.47.1",
88
- "@scripts/jest-config": "2.47.1"
82
+ "@modern-js/core": "2.48.1",
83
+ "@modern-js/app-tools": "2.48.1",
84
+ "@modern-js/module-tools": "2.48.1",
85
+ "@modern-js/uni-builder": "2.48.1",
86
+ "@modern-js/types": "2.48.1",
87
+ "@scripts/build": "2.48.1",
88
+ "@scripts/jest-config": "2.48.1"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "~18.2.0"