@umijs/plugins 4.0.0-canary.20230330.1 → 4.0.0-canary.20230417.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/qiankun/slave.js
CHANGED
|
@@ -48,7 +48,8 @@ function getCurrentLocalDevServerEntry(api, req) {
|
|
|
48
48
|
return `${protocol}://${hostname}${port ? ":" : ""}${port}/local-dev-server`;
|
|
49
49
|
}
|
|
50
50
|
function handleOriginalHtml(api, microAppEntry, originalHtml) {
|
|
51
|
-
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const appName = ((_b = (_a = api.config.qiankun) == null ? void 0 : _a.slave) == null ? void 0 : _b.appName) || api.pkg.name;
|
|
52
53
|
(0, import_assert.default)(
|
|
53
54
|
appName,
|
|
54
55
|
"[@umijs/plugin-qiankun]: You should have name in package.json"
|
package/dist/utils/modelUtils.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(modelUtils_exports, {
|
|
|
34
34
|
getNamespace: () => getNamespace
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(modelUtils_exports);
|
|
37
|
+
var import_bundler_utils = require("@umijs/bundler-utils");
|
|
37
38
|
var parser = __toESM(require("@umijs/bundler-utils/compiled/babel/parser"));
|
|
38
39
|
var import_traverse = __toESM(require("@umijs/bundler-utils/compiled/babel/traverse"));
|
|
39
40
|
var t = __toESM(require("@umijs/bundler-utils/compiled/babel/types"));
|
|
@@ -157,16 +158,28 @@ var _ModelUtils = class {
|
|
|
157
158
|
});
|
|
158
159
|
}
|
|
159
160
|
isModelValid(opts) {
|
|
161
|
+
var _a;
|
|
160
162
|
const { file, content } = opts;
|
|
161
163
|
if (this.opts.contentTest && this.opts.contentTest(content)) {
|
|
162
164
|
return true;
|
|
163
165
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
let result = null;
|
|
167
|
+
try {
|
|
168
|
+
const ext = (0, import_path.extname)(file).slice(1);
|
|
169
|
+
const loader = ext === "js" ? "jsx" : ext;
|
|
170
|
+
result = (0, import_esbuild.transformSync)(content, {
|
|
171
|
+
loader,
|
|
172
|
+
sourcemap: false,
|
|
173
|
+
minify: false,
|
|
174
|
+
sourcefile: file
|
|
175
|
+
});
|
|
176
|
+
} catch (e) {
|
|
177
|
+
if ((_a = e.errors) == null ? void 0 : _a.length) {
|
|
178
|
+
(0, import_bundler_utils.prettyPrintEsBuildErrors)(e.errors, { path: file, content });
|
|
179
|
+
delete e.errors;
|
|
180
|
+
}
|
|
181
|
+
throw e;
|
|
182
|
+
}
|
|
170
183
|
let ret = false;
|
|
171
184
|
const ast = parser.parse(result.code, {
|
|
172
185
|
sourceType: "module",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
__USE_MODEL__;
|
|
4
4
|
import concat from 'lodash/concat';
|
|
5
5
|
import mergeWith from 'lodash/mergeWith';
|
|
6
|
+
import isEqual from 'lodash/isEqual';
|
|
6
7
|
import noop from 'lodash/noop';
|
|
7
8
|
import {
|
|
8
9
|
FrameworkConfiguration,
|
|
@@ -64,6 +65,15 @@ function unmountMicroApp(microApp?: MicroAppType) {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
function useDeepCompare<T>(value: T): T {
|
|
69
|
+
const ref = useRef<T>(value);
|
|
70
|
+
if (!isEqual(value, ref.current)) {
|
|
71
|
+
ref.current = value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return ref.current;
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
let noneMounted = true;
|
|
68
78
|
|
|
69
79
|
export const MicroApp = forwardRef(
|
|
@@ -213,7 +223,7 @@ export const MicroApp = forwardRef(
|
|
|
213
223
|
},
|
|
214
224
|
);
|
|
215
225
|
|
|
216
|
-
return () => unmountMicroApp(microAppRef.current);
|
|
226
|
+
return () => unmountMicroApp(microAppRef.current, updatingPromise.current);
|
|
217
227
|
}, [name]);
|
|
218
228
|
|
|
219
229
|
useEffect(() => {
|
|
@@ -266,7 +276,7 @@ export const MicroApp = forwardRef(
|
|
|
266
276
|
}
|
|
267
277
|
|
|
268
278
|
return noop;
|
|
269
|
-
},
|
|
279
|
+
}, [useDeepCompare({ ...stateForSlave, ...propsFromParams })]);
|
|
270
280
|
|
|
271
281
|
// 未配置自定义 loader 且开启了 autoSetLoading 场景下,使用插件默认的 loader,否则使用自定义 loader
|
|
272
282
|
const microAppLoader =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20230417.1",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"styled-components": "6.0.0-beta.9",
|
|
43
43
|
"tslib": "^2",
|
|
44
44
|
"warning": "^4.0.3",
|
|
45
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
45
|
+
"@umijs/bundler-utils": "4.0.0-canary.20230417.1",
|
|
46
46
|
"@umijs/valtio": "1.0.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"antd": "^4.24.1",
|
|
50
|
-
"umi": "4.0.0-canary.
|
|
50
|
+
"umi": "4.0.0-canary.20230417.1"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|