umi 4.0.0-canary.20220325.1 → 4.0.0-rc.11
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/client/client/plugin.js +12 -4
- package/eslint.js +7 -0
- package/package.json +13 -7
- package/prettier.js +12 -0
- package/stylelint.js +7 -0
package/client/client/plugin.js
CHANGED
|
@@ -52,6 +52,9 @@ export class PluginManager {
|
|
|
52
52
|
if (args) {
|
|
53
53
|
assert(typeof args === 'object', `applyPlugins failed, args must be plain object.`);
|
|
54
54
|
}
|
|
55
|
+
if (async) {
|
|
56
|
+
assert(type === ApplyPluginsType.modify || type === ApplyPluginsType.event, `async only works with modify and event type.`);
|
|
57
|
+
}
|
|
55
58
|
switch (type) {
|
|
56
59
|
case ApplyPluginsType.modify:
|
|
57
60
|
if (async) {
|
|
@@ -94,10 +97,15 @@ export class PluginManager {
|
|
|
94
97
|
}, initialValue);
|
|
95
98
|
}
|
|
96
99
|
case ApplyPluginsType.event:
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
for (const hook of hooks) {
|
|
102
|
+
assert(typeof hook === 'function', `applyPlugins failed, all hooks for key ${key} must be function.`);
|
|
103
|
+
const ret = hook(args);
|
|
104
|
+
if (async && isPromiseLike(ret)) {
|
|
105
|
+
yield ret;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}))();
|
|
101
109
|
case ApplyPluginsType.compose:
|
|
102
110
|
return () => {
|
|
103
111
|
return compose({
|
package/eslint.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
try {
|
|
2
|
+
require.resolve('@umijs/lint/package.json');
|
|
3
|
+
} catch (err) {
|
|
4
|
+
throw new Error('@umijs/lint is not built-in, please install it manually before run umi lint.');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports = process.env.LEGACY_ESLINT ? require('@umijs/lint/dist/config/eslint/legacy') : require('@umijs/lint/dist/config/eslint');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umi",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-rc.11",
|
|
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",
|
|
@@ -23,8 +23,11 @@
|
|
|
23
23
|
"plugin.js",
|
|
24
24
|
"plugin-utils.d.ts",
|
|
25
25
|
"plugin-utils.js",
|
|
26
|
+
"prettier.js",
|
|
26
27
|
"test.d.ts",
|
|
27
|
-
"test.js"
|
|
28
|
+
"test.js",
|
|
29
|
+
"eslint.js",
|
|
30
|
+
"stylelint.js"
|
|
28
31
|
],
|
|
29
32
|
"scripts": {
|
|
30
33
|
"build": "pnpm tsc",
|
|
@@ -34,11 +37,14 @@
|
|
|
34
37
|
"test": "jest -c ../../jest.turbo.config.ts"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
|
-
"@umijs/core": "4.0.0-
|
|
38
|
-
"@umijs/
|
|
39
|
-
"@umijs/
|
|
40
|
-
"@umijs/
|
|
41
|
-
"@umijs/
|
|
40
|
+
"@umijs/core": "4.0.0-rc.11",
|
|
41
|
+
"@umijs/lint": "4.0.0-rc.11",
|
|
42
|
+
"@umijs/preset-umi": "4.0.0-rc.11",
|
|
43
|
+
"@umijs/renderer-react": "4.0.0-rc.11",
|
|
44
|
+
"@umijs/test": "4.0.0-rc.11",
|
|
45
|
+
"@umijs/utils": "4.0.0-rc.11",
|
|
46
|
+
"prettier-plugin-organize-imports": "^2.3.4",
|
|
47
|
+
"prettier-plugin-packagejson": "^2.2.16"
|
|
42
48
|
},
|
|
43
49
|
"engines": {
|
|
44
50
|
"node": ">=14"
|
package/prettier.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
printWidth: 80,
|
|
3
|
+
singleQuote: true,
|
|
4
|
+
trailingComma: 'all',
|
|
5
|
+
proseWrap: 'never',
|
|
6
|
+
endOfLine: 'lf',
|
|
7
|
+
overrides: [{ files: '.prettierrc', options: { parser: 'json' } }],
|
|
8
|
+
plugins: [
|
|
9
|
+
require.resolve('prettier-plugin-packagejson'),
|
|
10
|
+
require.resolve('prettier-plugin-organize-imports'),
|
|
11
|
+
],
|
|
12
|
+
};
|