umi 4.0.0-rc.8 → 4.0.0-rc.9
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/client/plugin.js +12 -4
- package/index.d.ts +3 -2
- package/package.json +11 -7
package/dist/client/plugin.js
CHANGED
|
@@ -55,6 +55,9 @@ class PluginManager {
|
|
|
55
55
|
if (args) {
|
|
56
56
|
(0, utils_1.assert)(typeof args === 'object', `applyPlugins failed, args must be plain object.`);
|
|
57
57
|
}
|
|
58
|
+
if (async) {
|
|
59
|
+
(0, utils_1.assert)(type === ApplyPluginsType.modify || type === ApplyPluginsType.event, `async only works with modify and event type.`);
|
|
60
|
+
}
|
|
58
61
|
switch (type) {
|
|
59
62
|
case ApplyPluginsType.modify:
|
|
60
63
|
if (async) {
|
|
@@ -97,10 +100,15 @@ class PluginManager {
|
|
|
97
100
|
}, initialValue);
|
|
98
101
|
}
|
|
99
102
|
case ApplyPluginsType.event:
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
for (const hook of hooks) {
|
|
105
|
+
(0, utils_1.assert)(typeof hook === 'function', `applyPlugins failed, all hooks for key ${key} must be function.`);
|
|
106
|
+
const ret = hook(args);
|
|
107
|
+
if (async && (0, utils_1.isPromiseLike)(ret)) {
|
|
108
|
+
yield ret;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}))();
|
|
104
112
|
case ApplyPluginsType.compose:
|
|
105
113
|
return () => {
|
|
106
114
|
return (0, utils_1.compose)({
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
export * from '@@/exports';
|
|
3
|
-
export type { IApi, webpack } from '@umijs/preset-umi';
|
|
4
3
|
export type {
|
|
4
|
+
IApi,
|
|
5
|
+
webpack,
|
|
5
6
|
IRoute,
|
|
6
7
|
UmiApiRequest,
|
|
7
8
|
UmiApiResponse,
|
|
8
|
-
} from '@umijs/preset-umi
|
|
9
|
+
} from '@umijs/preset-umi';
|
|
9
10
|
export * from './dist';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umi",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.9",
|
|
4
4
|
"description": "umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -30,14 +30,18 @@
|
|
|
30
30
|
"build": "pnpm tsc",
|
|
31
31
|
"build:client": "pnpm tsc --project ./tsconfig.client.json",
|
|
32
32
|
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
|
|
33
|
-
"dev": "pnpm build -- --watch"
|
|
33
|
+
"dev": "pnpm build -- --watch",
|
|
34
|
+
"test": "jest -c ../../jest.turbo.config.ts"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@umijs/core": "4.0.0-rc.
|
|
37
|
-
"@umijs/preset-umi": "4.0.0-rc.
|
|
38
|
-
"@umijs/renderer-react": "4.0.0-rc.
|
|
39
|
-
"@umijs/test": "4.0.0-rc.
|
|
40
|
-
"@umijs/utils": "4.0.0-rc.
|
|
37
|
+
"@umijs/core": "4.0.0-rc.9",
|
|
38
|
+
"@umijs/preset-umi": "4.0.0-rc.9",
|
|
39
|
+
"@umijs/renderer-react": "4.0.0-rc.9",
|
|
40
|
+
"@umijs/test": "4.0.0-rc.9",
|
|
41
|
+
"@umijs/utils": "4.0.0-rc.9"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=14"
|
|
41
45
|
},
|
|
42
46
|
"publishConfig": {
|
|
43
47
|
"access": "public"
|