@module-federation/devtools 0.0.0-next-20240425091022 → 0.0.0-next-20240425095041

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.
@@ -40,6 +40,7 @@ import { defaultDataItem, proxyFormField } from "../../template/constant";
40
40
  import {
41
41
  validateCustom,
42
42
  validateSemver,
43
+ validatePort,
43
44
  isObject,
44
45
  separateType
45
46
  } from "../../utils";
@@ -130,7 +131,7 @@ const FormComponent = (props) => {
130
131
  valueStatus: false
131
132
  };
132
133
  }
133
- if (validateCustom(value) || validateSemver(value)) {
134
+ if (validateCustom(value) || validateSemver(value) || validatePort(value)) {
134
135
  statusSet[index].valueStatus = true;
135
136
  flushSync(() => setFormStatus(statusSet));
136
137
  return callback();
@@ -56,7 +56,8 @@ const Layout = (props) => {
56
56
  handleSnapshot,
57
57
  versionList,
58
58
  setVersionList,
59
- getVersion
59
+ getVersion,
60
+ handleProxyAddress
60
61
  } = props;
61
62
  const { producer } = separateType(moduleInfo);
62
63
  const [condition, setCondition] = useState(statusInfo.processing);
@@ -79,6 +80,10 @@ const Layout = (props) => {
79
80
  return memo;
80
81
  }
81
82
  const duplicate = JSON.parse(JSON.stringify(current));
83
+ if (handleProxyAddress) {
84
+ const value = handleProxyAddress(duplicate.value);
85
+ duplicate.value = value;
86
+ }
82
87
  return [...memo, duplicate];
83
88
  },
84
89
  []
@@ -19,6 +19,7 @@ const validateSemver = (schema) => {
19
19
  const reg = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm;
20
20
  return reg.test(schema);
21
21
  };
22
+ const validatePort = (schema) => !isNaN(Number(schema));
22
23
  const splitModuleId = (target) => {
23
24
  const array = target.split(":");
24
25
  const { length } = array;
@@ -144,5 +145,6 @@ class DependencyGraph {
144
145
  }
145
146
  export {
146
147
  DependencyGraph,
148
+ validatePort,
147
149
  validateSemver
148
150
  };
@@ -145,7 +145,7 @@ const FormComponent = (props) => {
145
145
  valueStatus: false
146
146
  };
147
147
  }
148
- if ((0, import_utils.validateCustom)(value) || (0, import_utils.validateSemver)(value)) {
148
+ if ((0, import_utils.validateCustom)(value) || (0, import_utils.validateSemver)(value) || (0, import_utils.validatePort)(value)) {
149
149
  statusSet[index].valueStatus = true;
150
150
  (0, import_react_dom.flushSync)(() => setFormStatus(statusSet));
151
151
  return callback();
@@ -66,7 +66,8 @@ const Layout = (props) => {
66
66
  handleSnapshot,
67
67
  versionList,
68
68
  setVersionList,
69
- getVersion
69
+ getVersion,
70
+ handleProxyAddress
70
71
  } = props;
71
72
  const { producer } = (0, import_utils.separateType)(moduleInfo);
72
73
  const [condition, setCondition] = (0, import_react.useState)(import_constant.statusInfo.processing);
@@ -89,6 +90,10 @@ const Layout = (props) => {
89
90
  return memo;
90
91
  }
91
92
  const duplicate = JSON.parse(JSON.stringify(current));
93
+ if (handleProxyAddress) {
94
+ const value = handleProxyAddress(duplicate.value);
95
+ duplicate.value = value;
96
+ }
92
97
  return [...memo, duplicate];
93
98
  },
94
99
  []
@@ -33,6 +33,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
33
33
  var graph_exports = {};
34
34
  __export(graph_exports, {
35
35
  DependencyGraph: () => DependencyGraph,
36
+ validatePort: () => validatePort,
36
37
  validateSemver: () => validateSemver
37
38
  });
38
39
  module.exports = __toCommonJS(graph_exports);
@@ -41,6 +42,7 @@ const validateSemver = (schema) => {
41
42
  const reg = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm;
42
43
  return reg.test(schema);
43
44
  };
45
+ const validatePort = (schema) => !isNaN(Number(schema));
44
46
  const splitModuleId = (target) => {
45
47
  const array = target.split(":");
46
48
  const { length } = array;
@@ -167,5 +169,6 @@ class DependencyGraph {
167
169
  // Annotate the CommonJS export names for ESM import in node:
168
170
  0 && (module.exports = {
169
171
  DependencyGraph,
172
+ validatePort,
170
173
  validateSemver
171
174
  });
@@ -27,6 +27,7 @@ export interface EdgeType {
27
27
  };
28
28
  }
29
29
  export declare const validateSemver: (schema: string) => boolean;
30
+ export declare const validatePort: (schema: string) => boolean;
30
31
  export declare class DependencyGraph {
31
32
  snapshot: GlobalModuleInfo;
32
33
  initTarget: string;
@@ -11,5 +11,6 @@ export interface RootComponentProps {
11
11
  versionList?: Array<Array<string>>;
12
12
  setVersionList?: React.Dispatch<React.SetStateAction<Array<Array<string>>>>;
13
13
  getVersion?: (moduleName: string) => Promise<Array<string>>;
14
+ handleProxyAddress?: (address: string) => string;
14
15
  }
15
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/devtools",
3
- "version": "0.0.0-next-20240425091022",
3
+ "version": "0.0.0-next-20240425095041",
4
4
  "files": [
5
5
  "dist/",
6
6
  "install-deps.bash",
@@ -38,7 +38,7 @@
38
38
  "react": "~18.2.0",
39
39
  "react-dom": "~18.2.0",
40
40
  "reactflow": "11.10.4",
41
- "@module-federation/sdk": "0.0.0-next-20240425091022"
41
+ "@module-federation/sdk": "0.0.0-next-20240425095041"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/dagre": "^0.7.52",
@@ -61,7 +61,7 @@
61
61
  "vitest": "1.2.2",
62
62
  "@modern-js/storybook": "2.46.1",
63
63
  "@storybook/addon-essentials": "^7",
64
- "@module-federation/runtime": "0.0.0-next-20240425091022"
64
+ "@module-federation/runtime": "0.0.0-next-20240425095041"
65
65
  },
66
66
  "scripts": {
67
67
  "build:storybook": "storybook build",