@umijs/plugins 4.0.0-canary.20230531.1 → 4.0.0-canary.20230531.2
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/dva.js +1 -1
- package/libs/dva.tsx +45 -0
- package/package.json +3 -3
- package/libs/dva.ts +0 -10
package/dist/dva.js
CHANGED
|
@@ -42,7 +42,7 @@ var import_plugin_utils = require("umi/plugin-utils");
|
|
|
42
42
|
var import_modelUtils = require("./utils/modelUtils");
|
|
43
43
|
var import_withTmpPath = require("./utils/withTmpPath");
|
|
44
44
|
var dva_default = (api) => {
|
|
45
|
-
const pkgPath = (0, import_path.join)(__dirname, "../libs/dva.
|
|
45
|
+
const pkgPath = (0, import_path.join)(__dirname, "../libs/dva.tsx");
|
|
46
46
|
api.describe({
|
|
47
47
|
config: {
|
|
48
48
|
schema({ zod }) {
|
package/libs/dva.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { create, saga, utils } from 'dva-core';
|
|
4
|
+
import {
|
|
5
|
+
connect,
|
|
6
|
+
Provider,
|
|
7
|
+
useDispatch,
|
|
8
|
+
useSelector,
|
|
9
|
+
useStore,
|
|
10
|
+
} from 'react-redux';
|
|
11
|
+
export { bindActionCreators } from 'redux';
|
|
12
|
+
export { create, saga, utils };
|
|
13
|
+
export { connect, Provider, useDispatch, useSelector, useStore };
|
|
14
|
+
|
|
15
|
+
export default function dva(opts: any) {
|
|
16
|
+
const app = create(opts, {
|
|
17
|
+
initialReducer: {},
|
|
18
|
+
setupApp() {},
|
|
19
|
+
});
|
|
20
|
+
const oldAppStart = app.start;
|
|
21
|
+
app.router = router;
|
|
22
|
+
app.start = start;
|
|
23
|
+
return app;
|
|
24
|
+
|
|
25
|
+
function router(router: any) {
|
|
26
|
+
app._router = router;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function start(elem: any) {
|
|
30
|
+
// old dva.start() supports passing arguments
|
|
31
|
+
if (typeof elem !== 'undefined') {
|
|
32
|
+
throw new Error('dva.start() should not be called with any arguments.');
|
|
33
|
+
}
|
|
34
|
+
if (!app._store) {
|
|
35
|
+
oldAppStart.call(app);
|
|
36
|
+
}
|
|
37
|
+
const store = app._store;
|
|
38
|
+
const router = app._router;
|
|
39
|
+
return (extraProps: any) => {
|
|
40
|
+
return (
|
|
41
|
+
<Provider store={store}>{router({ app, ...extraProps })}</Provider>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-canary.20230531.
|
|
3
|
+
"version": "4.0.0-canary.20230531.2",
|
|
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",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"styled-components": "6.0.0-rc.0",
|
|
45
45
|
"tslib": "^2",
|
|
46
46
|
"warning": "^4.0.3",
|
|
47
|
-
"@umijs/bundler-utils": "4.0.0-canary.20230531.
|
|
47
|
+
"@umijs/bundler-utils": "4.0.0-canary.20230531.2",
|
|
48
48
|
"@umijs/valtio": "1.0.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"antd": "^4.24.1",
|
|
52
|
-
"umi": "4.0.0-canary.20230531.
|
|
52
|
+
"umi": "4.0.0-canary.20230531.2"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|