@module-federation/devtools 0.0.0-next-20240425091022

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.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dist/es/App.js +31 -0
  4. package/dist/es/App.module.js +5 -0
  5. package/dist/es/App_module.css +19 -0
  6. package/dist/es/component/Form/index.js +283 -0
  7. package/dist/es/component/Form/index.module.js +5 -0
  8. package/dist/es/component/Form/index_module.css +43 -0
  9. package/dist/es/component/Graph/index.js +127 -0
  10. package/dist/es/component/Graph/index.module.js +5 -0
  11. package/dist/es/component/Graph/index_module.css +12 -0
  12. package/dist/es/component/GraphItem/index.js +73 -0
  13. package/dist/es/component/GraphItem/index.module.js +5 -0
  14. package/dist/es/component/GraphItem/index_module.css +56 -0
  15. package/dist/es/component/Layout/index.js +207 -0
  16. package/dist/es/component/Layout/index.module.js +5 -0
  17. package/dist/es/component/Layout/index_module.css +48 -0
  18. package/dist/es/init.js +8 -0
  19. package/dist/es/template/constant.js +65 -0
  20. package/dist/es/template/index.js +1 -0
  21. package/dist/es/utils/chrome/fast-refresh-init.js +5 -0
  22. package/dist/es/utils/chrome/fast-refresh.js +113 -0
  23. package/dist/es/utils/chrome/index.js +211 -0
  24. package/dist/es/utils/chrome/post-message-init.js +5 -0
  25. package/dist/es/utils/chrome/post-message-listener.js +20 -0
  26. package/dist/es/utils/chrome/post-message-start.js +8 -0
  27. package/dist/es/utils/chrome/post-message.js +62 -0
  28. package/dist/es/utils/chrome/snapshot-plugin-init.js +5 -0
  29. package/dist/es/utils/chrome/snapshot-plugin.js +36 -0
  30. package/dist/es/utils/chrome/storage.js +45 -0
  31. package/dist/es/utils/data/index.js +79 -0
  32. package/dist/es/utils/data/snapshot.js +82 -0
  33. package/dist/es/utils/index.js +4 -0
  34. package/dist/es/utils/sdk/graph.js +148 -0
  35. package/dist/es/utils/sdk/index.js +55 -0
  36. package/dist/es/utils/types/common.js +0 -0
  37. package/dist/es/utils/types/index.js +1 -0
  38. package/dist/es/worker/index.js +1 -0
  39. package/dist/lib/App.js +61 -0
  40. package/dist/lib/App.module.js +25 -0
  41. package/dist/lib/App_module.css +19 -0
  42. package/dist/lib/component/Form/index.js +295 -0
  43. package/dist/lib/component/Form/index.module.js +25 -0
  44. package/dist/lib/component/Form/index_module.css +43 -0
  45. package/dist/lib/component/Graph/index.js +149 -0
  46. package/dist/lib/component/Graph/index.module.js +25 -0
  47. package/dist/lib/component/Graph/index_module.css +12 -0
  48. package/dist/lib/component/GraphItem/index.js +103 -0
  49. package/dist/lib/component/GraphItem/index.module.js +25 -0
  50. package/dist/lib/component/GraphItem/index_module.css +56 -0
  51. package/dist/lib/component/Layout/index.js +214 -0
  52. package/dist/lib/component/Layout/index.module.js +25 -0
  53. package/dist/lib/component/Layout/index_module.css +48 -0
  54. package/dist/lib/init.js +9 -0
  55. package/dist/lib/template/constant.js +95 -0
  56. package/dist/lib/template/index.js +22 -0
  57. package/dist/lib/utils/chrome/fast-refresh-init.js +6 -0
  58. package/dist/lib/utils/chrome/fast-refresh.js +114 -0
  59. package/dist/lib/utils/chrome/index.js +245 -0
  60. package/dist/lib/utils/chrome/post-message-init.js +6 -0
  61. package/dist/lib/utils/chrome/post-message-listener.js +21 -0
  62. package/dist/lib/utils/chrome/post-message-start.js +9 -0
  63. package/dist/lib/utils/chrome/post-message.js +83 -0
  64. package/dist/lib/utils/chrome/snapshot-plugin-init.js +6 -0
  65. package/dist/lib/utils/chrome/snapshot-plugin.js +59 -0
  66. package/dist/lib/utils/chrome/storage.js +67 -0
  67. package/dist/lib/utils/data/index.js +106 -0
  68. package/dist/lib/utils/data/snapshot.js +107 -0
  69. package/dist/lib/utils/index.js +28 -0
  70. package/dist/lib/utils/sdk/graph.js +171 -0
  71. package/dist/lib/utils/sdk/index.js +89 -0
  72. package/dist/lib/utils/types/common.js +16 -0
  73. package/dist/lib/utils/types/index.js +22 -0
  74. package/dist/lib/worker/index.js +2 -0
  75. package/dist/types/src/App.d.ts +6 -0
  76. package/dist/types/src/component/Form/index.d.ts +18 -0
  77. package/dist/types/src/component/Graph/index.d.ts +7 -0
  78. package/dist/types/src/component/GraphItem/index.d.ts +10 -0
  79. package/dist/types/src/component/Layout/index.d.ts +7 -0
  80. package/dist/types/src/index.d.ts +1 -0
  81. package/dist/types/src/init.d.ts +13 -0
  82. package/dist/types/src/template/constant.d.ts +23 -0
  83. package/dist/types/src/template/index.d.ts +1 -0
  84. package/dist/types/src/utils/chrome/fast-refresh-init.d.ts +1 -0
  85. package/dist/types/src/utils/chrome/fast-refresh.d.ts +1 -0
  86. package/dist/types/src/utils/chrome/index.d.ts +16 -0
  87. package/dist/types/src/utils/chrome/post-message-init.d.ts +1 -0
  88. package/dist/types/src/utils/chrome/post-message-listener.d.ts +0 -0
  89. package/dist/types/src/utils/chrome/post-message-start.d.ts +1 -0
  90. package/dist/types/src/utils/chrome/post-message.d.ts +1 -0
  91. package/dist/types/src/utils/chrome/snapshot-plugin-init.d.ts +1 -0
  92. package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +4 -0
  93. package/dist/types/src/utils/chrome/storage.d.ts +4 -0
  94. package/dist/types/src/utils/data/index.d.ts +11 -0
  95. package/dist/types/src/utils/data/snapshot.d.ts +3 -0
  96. package/dist/types/src/utils/index.d.ts +4 -0
  97. package/dist/types/src/utils/sdk/graph.d.ts +44 -0
  98. package/dist/types/src/utils/sdk/index.d.ts +10 -0
  99. package/dist/types/src/utils/types/common.d.ts +15 -0
  100. package/dist/types/src/utils/types/index.d.ts +1 -0
  101. package/dist/types/src/worker/index.d.ts +0 -0
  102. package/dist/types/stories/index.stories.d.ts +9 -0
  103. package/install-deps.bash +8 -0
  104. package/package.json +85 -0
@@ -0,0 +1,13 @@
1
+ /// <reference types="chrome" />
2
+ import { GlobalModuleInfo } from '@module-federation/sdk';
3
+ declare global {
4
+ interface Window {
5
+ targetTab: chrome.tabs.Tab;
6
+ moduleHandler: (...args: Array<any>) => void;
7
+ }
8
+ }
9
+ declare module '@module-federation/runtime' {
10
+ interface Federation {
11
+ originModuleInfo: GlobalModuleInfo;
12
+ }
13
+ }
@@ -0,0 +1,23 @@
1
+ export declare const FormID = "FormID";
2
+ export declare const ENABLEHMR = "enableHMR";
3
+ export declare const proxyFormField = "proxyFormField";
4
+ export declare const defaultDataItem: {
5
+ key: string;
6
+ value: string;
7
+ checked: boolean;
8
+ };
9
+ export declare const defaultModuleData: {
10
+ proxyFormField: {
11
+ key: string;
12
+ value: string;
13
+ checked: boolean;
14
+ }[];
15
+ };
16
+ export declare const statusInfo: Record<string, {
17
+ status: string;
18
+ message: string;
19
+ color: string;
20
+ }>;
21
+ export declare const __ENABLE_FAST_REFRESH__ = "enableFastRefresh";
22
+ export declare const BROWSER_ENV_KEY = "MF_ENV";
23
+ export declare const __FEDERATION_DEVTOOLS__ = "__MF_DEVTOOLS__";
@@ -0,0 +1 @@
1
+ export * from './constant';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /// <reference types="chrome" />
2
+ import { GlobalModuleInfo } from '@module-federation/sdk';
3
+ export * from './storage';
4
+ export declare const injectPostMessage: (postMessageUrl: string) => void;
5
+ export declare const TabInfo: {
6
+ currentTabId: number;
7
+ };
8
+ export declare function getCurrentTabId(): number;
9
+ export declare function getInspectWindowTabId(): Promise<unknown>;
10
+ export declare const getGlobalModuleInfo: (callback: React.Dispatch<React.SetStateAction<GlobalModuleInfo>>) => Promise<void>;
11
+ export declare const getTabs: (queryOptions?: {}) => Promise<chrome.tabs.Tab[]>;
12
+ export declare const getScope: () => Promise<string>;
13
+ export declare const injectScript: (excuteScript: (...args: Array<any>) => any, world?: boolean, ...args: any) => Promise<void>;
14
+ export declare const getUrl: (file: string) => string;
15
+ export declare const injectToast: (toastUtilUrl: string, e2eFlag: string) => void;
16
+ export declare const setChromeStorage: (formData: Record<string, any>) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ declare const moduleInfo: import("@module-federation/sdk/.").GlobalModuleInfo;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ declare global {
2
+ var __INIT_VMOK_CHROME_DEVTOOL_PLUGIN__: boolean | undefined;
3
+ }
4
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const mergeStorage: (...args: any[]) => Promise<void>;
2
+ export declare const removeStorageKey: (...args: any[]) => Promise<void>;
3
+ export declare const removeStorage: (...args: any[]) => Promise<void>;
4
+ export declare const setStorage: (...args: any[]) => Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { GlobalModuleInfo } from '@module-federation/sdk';
2
+ export declare const separateType: (moduleInfo: GlobalModuleInfo) => {
3
+ consumers: Record<string, import("@module-federation/sdk").ModuleInfo | import("@module-federation/sdk").ManifestProvider | import("@module-federation/sdk").PureEntryProvider | undefined>;
4
+ producer: string[];
5
+ };
6
+ export declare const getModuleInfo: (proxyRules: Array<any>) => Promise<{
7
+ status: string;
8
+ moduleInfo: GlobalModuleInfo;
9
+ overrides: Record<string, string>;
10
+ }>;
11
+ export * from './snapshot';
@@ -0,0 +1,3 @@
1
+ import { GlobalModuleInfo } from '@module-federation/sdk';
2
+ export declare const calculateSnapshot: (originSnapshot: GlobalModuleInfo, overrides: Record<string, string>) => any;
3
+ export declare const calculateMicroAppSnapshot: (originSnapshot: GlobalModuleInfo, overrides: Record<string, string>) => any;
@@ -0,0 +1,4 @@
1
+ export * from './chrome';
2
+ export * from './sdk';
3
+ export * from './data';
4
+ export * from './types';
@@ -0,0 +1,44 @@
1
+ import { GlobalModuleInfo } from '@module-federation/sdk';
2
+ import { MarkerType } from 'reactflow';
3
+ export interface NodeCustomData {
4
+ info: string;
5
+ color: string;
6
+ [key: string]: any;
7
+ }
8
+ export interface NodeType {
9
+ id: string;
10
+ type: string;
11
+ position: {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ data: NodeCustomData;
16
+ }
17
+ export type Edge = 'default' | 'straight' | 'step' | 'smoothstep' | 'bezier';
18
+ export interface EdgeType {
19
+ id: string;
20
+ source: string;
21
+ target: string;
22
+ type: Edge;
23
+ markerEnd: {
24
+ type: MarkerType;
25
+ width: number;
26
+ height: number;
27
+ };
28
+ }
29
+ export declare const validateSemver: (schema: string) => boolean;
30
+ export declare class DependencyGraph {
31
+ snapshot: GlobalModuleInfo;
32
+ initTarget: string;
33
+ node: Array<NodeType>;
34
+ edge: Array<EdgeType>;
35
+ graph: any;
36
+ identifyMap: Map<string, string>;
37
+ handledModuleMap: Map<string, boolean>;
38
+ constructor(snapshot: GlobalModuleInfo, initTarget: string);
39
+ createGraph(target?: string): void;
40
+ addNode(id: string, type: string, x: number, y: number, nodeData: NodeCustomData): void;
41
+ addEdge(id: string, source: string, target: string, type?: Edge): void;
42
+ run(targetGraph: any, target: string | undefined, type: string, id?: string): void;
43
+ identify(): string;
44
+ }
@@ -0,0 +1,10 @@
1
+ export * from './graph';
2
+ export declare const setLocalStorage: (key: string, value: any) => void;
3
+ export declare const removeLocalStorage: (key: string) => void;
4
+ export declare const mergeLocalStorage: (target: string, key: string, value: any) => void;
5
+ export declare const removeLocalStorageKey: (target: string, key: string) => void;
6
+ export declare const isObject: (target: any) => boolean;
7
+ export declare const reloadPage: () => void;
8
+ export declare const validateCustom: (schema: string) => boolean;
9
+ export declare const getUnpkgUrl: (pkg: string, version: string) => string | undefined;
10
+ export declare const definePropertyGlobalVal: (target: Record<string, any>, key: string, val: any) => void;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { getModuleInfo } from '../index';
3
+ export interface FormItemStatus {
4
+ keyStatus: boolean;
5
+ valueStatus: boolean;
6
+ }
7
+ type ParametersTypeOfRoot = Parameters<typeof getModuleInfo>;
8
+ type ReturnTypeOfRoot = ReturnType<typeof getModuleInfo>;
9
+ export interface RootComponentProps {
10
+ handleSnapshot?: (...args: ParametersTypeOfRoot) => Promise<ReturnTypeOfRoot>;
11
+ versionList?: Array<Array<string>>;
12
+ setVersionList?: React.Dispatch<React.SetStateAction<Array<Array<string>>>>;
13
+ getVersion?: (moduleName: string) => Promise<Array<string>>;
14
+ }
15
+ export {};
@@ -0,0 +1 @@
1
+ export * from './common';
File without changes
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import '../src/init';
3
+ import '../mock';
4
+ declare const _default: {
5
+ title: string;
6
+ component: () => React.JSX.Element;
7
+ };
8
+ export default _default;
9
+ export declare const Primary: {};
@@ -0,0 +1,8 @@
1
+ if [ "$GITHUB_ACTIONS" = "true" ]; then
2
+ echo "Running in GitHub Actions environment."
3
+ npx playwright install-deps && npx playwright install
4
+ # 在这里放置你想要执行的命令
5
+ else
6
+ echo "Not running in GitHub Actions environment."
7
+ # 在这里放置不在 GitHub Actions 环境时要执行的命令
8
+ fi
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@module-federation/devtools",
3
+ "version": "0.0.0-next-20240425091022",
4
+ "files": [
5
+ "dist/",
6
+ "install-deps.bash",
7
+ "README.md"
8
+ ],
9
+ "exports": {
10
+ ".": {
11
+ "require": "./dist/lib/App.js",
12
+ "import": "./dist/es/App.js",
13
+ "types": "./dist/types/App.d.ts"
14
+ },
15
+ "./App": {
16
+ "require": "./dist/lib/App.js",
17
+ "import": "./dist/es/App.js",
18
+ "types": "./dist/types/App.d.ts"
19
+ }
20
+ },
21
+ "lint-staged": {
22
+ "*.{js,jsx,ts,tsx,mjs,cjs}": [
23
+ "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"
24
+ ]
25
+ },
26
+ "eslintIgnore": [
27
+ "node_modules/",
28
+ "dist/"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "dependencies": {
34
+ "@arco-design/web-react": "^2.59.1",
35
+ "@modern-js/runtime": "2.46.1",
36
+ "ahooks": "^3.7.10",
37
+ "dagre": "^0.8.5",
38
+ "react": "~18.2.0",
39
+ "react-dom": "~18.2.0",
40
+ "reactflow": "11.10.4",
41
+ "@module-federation/sdk": "0.0.0-next-20240425091022"
42
+ },
43
+ "devDependencies": {
44
+ "@types/dagre": "^0.7.52",
45
+ "@modern-js-app/eslint-config": "2.46.1",
46
+ "@modern-js/app-tools": "2.46.1",
47
+ "@modern-js/eslint-config": "2.46.1",
48
+ "@modern-js/tsconfig": "2.46.1",
49
+ "@modern-js/module-tools": "2.46.1",
50
+ "@modern-js/builder-webpack-provider": "2.46.1",
51
+ "@playwright/test": "1.36.1",
52
+ "@types/chrome": "^0.0.260",
53
+ "@types/jest": "~29.2.4",
54
+ "@types/node": "~16.11.7",
55
+ "@types/react": "~18.2.0",
56
+ "@types/react-dom": "~18.2.0",
57
+ "lint-staged": "~13.1.0",
58
+ "prettier": "~2.8.1",
59
+ "rimraf": "~3.0.2",
60
+ "typescript": "~5.0.4",
61
+ "vitest": "1.2.2",
62
+ "@modern-js/storybook": "2.46.1",
63
+ "@storybook/addon-essentials": "^7",
64
+ "@module-federation/runtime": "0.0.0-next-20240425091022"
65
+ },
66
+ "scripts": {
67
+ "build:storybook": "storybook build",
68
+ "storybook": "storybook dev -p 6006",
69
+ "reset": "npx rimraf ./**/node_modules",
70
+ "dev": "modern dev",
71
+ "build": "modern build && node postpack.js",
72
+ "build:debug": "DEBUG=true modern build && node postpack.js",
73
+ "build:lib": "rm -rf dist && modern-module build -c modern.lib.config.ts",
74
+ "release": "npm publish --tag canary",
75
+ "test": "vitest run",
76
+ "test:e2e": "E2ETEST=true pnpm build && playwright test",
77
+ "test:e2e:ui": "E2ETEST=true pnpm build && playwright test --ui",
78
+ "start": "modern start",
79
+ "serve": "modern serve",
80
+ "new": "modern new",
81
+ "upgrade": "modern upgrade",
82
+ "postinstall": "bash install-deps.bash"
83
+ },
84
+ "types": "./dist/index.d.ts"
85
+ }