@module-federation/devtools 0.1.18 → 0.1.20

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.
@@ -1,3 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
1
29
  var __async = (__this, __arguments, generator) => {
2
30
  return new Promise((resolve, reject) => {
3
31
  var fulfilled = (value) => {
@@ -26,8 +54,10 @@ import { __FEDERATION_DEVTOOLS__ } from "../../template";
26
54
  const fastRefreshPlugin = () => {
27
55
  return {
28
56
  name: "mf-fast-refresh-plugin",
29
- // @ts-expect-error
30
- beforeInit({ origin, userOptions, options, shareInfo }) {
57
+ beforeInit(_a2) {
58
+ var _b = _a2, { userOptions } = _b, args = __objRest(_b, ["userOptions"]);
59
+ const shareInfo = userOptions.shared;
60
+ const twinsShareInfo = args.shareInfo;
31
61
  let enableFastRefresh;
32
62
  let devtoolsMessage;
33
63
  const devtoolsMessageStr = localStorage.getItem(__FEDERATION_DEVTOOLS__);
@@ -39,14 +69,18 @@ const fastRefreshPlugin = () => {
39
69
  console.debug("Fast Refresh Plugin Error: ", e);
40
70
  }
41
71
  }
42
- if (isObject(shareInfo)) {
72
+ if (shareInfo && isObject(shareInfo)) {
43
73
  let orderResolve;
44
74
  const orderPromise = new Promise((resolve) => {
45
75
  orderResolve = resolve;
46
76
  });
47
77
  Object.keys(shareInfo).forEach((share) => __async(this, null, function* () {
48
78
  const sharedArr = Array.isArray(shareInfo[share]) ? shareInfo[share] : [shareInfo[share]];
49
- sharedArr.forEach((shared) => {
79
+ let twinsSharedArr;
80
+ if (twinsShareInfo) {
81
+ twinsSharedArr = Array.isArray(twinsShareInfo[share]) ? twinsShareInfo[share] : [twinsShareInfo[share]];
82
+ }
83
+ sharedArr.forEach((shared, idx) => {
50
84
  let get;
51
85
  if (share === "react") {
52
86
  get = () => loadScript(getUnpkgUrl(share, shared.version), {
@@ -84,21 +118,19 @@ const fastRefreshPlugin = () => {
84
118
  return () => window.ReactDOM;
85
119
  });
86
120
  }
121
+ if (twinsShareInfo) {
122
+ twinsSharedArr[idx].get = shared.get;
123
+ }
87
124
  }
88
125
  });
89
126
  }));
90
- return {
91
- origin,
92
- userOptions,
93
- options,
94
- shareInfo
95
- };
127
+ return __spreadValues({
128
+ userOptions
129
+ }, args);
96
130
  } else {
97
- return {
98
- origin,
99
- userOptions,
100
- options
101
- };
131
+ return __spreadValues({
132
+ userOptions
133
+ }, args);
102
134
  }
103
135
  }
104
136
  };
@@ -1,4 +1,32 @@
1
1
  "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __spreadValues = (a, b) => {
8
+ for (var prop in b || (b = {}))
9
+ if (__hasOwnProp.call(b, prop))
10
+ __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b)) {
13
+ if (__propIsEnum.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ var __objRest = (source, exclude) => {
19
+ var target = {};
20
+ for (var prop in source)
21
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
22
+ target[prop] = source[prop];
23
+ if (source != null && __getOwnPropSymbols)
24
+ for (var prop of __getOwnPropSymbols(source)) {
25
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
26
+ target[prop] = source[prop];
27
+ }
28
+ return target;
29
+ };
2
30
  var __async = (__this, __arguments, generator) => {
3
31
  return new Promise((resolve, reject) => {
4
32
  var fulfilled = (value) => {
@@ -27,8 +55,10 @@ var _a;
27
55
  const fastRefreshPlugin = () => {
28
56
  return {
29
57
  name: "mf-fast-refresh-plugin",
30
- // @ts-expect-error
31
- beforeInit({ origin, userOptions, options, shareInfo }) {
58
+ beforeInit(_a2) {
59
+ var _b = _a2, { userOptions } = _b, args = __objRest(_b, ["userOptions"]);
60
+ const shareInfo = userOptions.shared;
61
+ const twinsShareInfo = args.shareInfo;
32
62
  let enableFastRefresh;
33
63
  let devtoolsMessage;
34
64
  const devtoolsMessageStr = localStorage.getItem(import_template.__FEDERATION_DEVTOOLS__);
@@ -40,14 +70,18 @@ const fastRefreshPlugin = () => {
40
70
  console.debug("Fast Refresh Plugin Error: ", e);
41
71
  }
42
72
  }
43
- if ((0, import__.isObject)(shareInfo)) {
73
+ if (shareInfo && (0, import__.isObject)(shareInfo)) {
44
74
  let orderResolve;
45
75
  const orderPromise = new Promise((resolve) => {
46
76
  orderResolve = resolve;
47
77
  });
48
78
  Object.keys(shareInfo).forEach((share) => __async(this, null, function* () {
49
79
  const sharedArr = Array.isArray(shareInfo[share]) ? shareInfo[share] : [shareInfo[share]];
50
- sharedArr.forEach((shared) => {
80
+ let twinsSharedArr;
81
+ if (twinsShareInfo) {
82
+ twinsSharedArr = Array.isArray(twinsShareInfo[share]) ? twinsShareInfo[share] : [twinsShareInfo[share]];
83
+ }
84
+ sharedArr.forEach((shared, idx) => {
51
85
  let get;
52
86
  if (share === "react") {
53
87
  get = () => (0, import_sdk.loadScript)((0, import__.getUnpkgUrl)(share, shared.version), {
@@ -85,21 +119,19 @@ const fastRefreshPlugin = () => {
85
119
  return () => window.ReactDOM;
86
120
  });
87
121
  }
122
+ if (twinsShareInfo) {
123
+ twinsSharedArr[idx].get = shared.get;
124
+ }
88
125
  }
89
126
  });
90
127
  }));
91
- return {
92
- origin,
93
- userOptions,
94
- options,
95
- shareInfo
96
- };
128
+ return __spreadValues({
129
+ userOptions
130
+ }, args);
97
131
  } else {
98
- return {
99
- origin,
100
- userOptions,
101
- options
102
- };
132
+ return __spreadValues({
133
+ userOptions
134
+ }, args);
103
135
  }
104
136
  }
105
137
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/devtools",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
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.1.18"
41
+ "@module-federation/sdk": "0.1.20"
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.1.18"
64
+ "@module-federation/runtime": "0.1.20"
65
65
  },
66
66
  "scripts": {
67
67
  "build:storybook": "storybook build",