@umijs/plugins 4.0.0-canary.20231204.1 → 4.0.0-canary.20231221.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/antd.js +50 -11
- package/dist/react-query.js +1 -0
- package/dist/styled-components.js +1 -0
- package/package.json +4 -4
package/dist/antd.js
CHANGED
|
@@ -61,22 +61,61 @@ var antd_default = (api) => {
|
|
|
61
61
|
api.describe({
|
|
62
62
|
config: {
|
|
63
63
|
schema({ zod }) {
|
|
64
|
-
|
|
65
|
-
configProvider: zod.record(zod.any()),
|
|
66
|
-
// themes
|
|
64
|
+
const commonSchema = {
|
|
67
65
|
dark: zod.boolean(),
|
|
68
66
|
compact: zod.boolean(),
|
|
69
67
|
// babel-plugin-import
|
|
70
68
|
import: zod.boolean(),
|
|
71
69
|
// less or css, default less
|
|
72
|
-
style: zod.enum(["less", "css"]).describe("less or css, default less")
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
style: zod.enum(["less", "css"]).describe("less or css, default less")
|
|
71
|
+
};
|
|
72
|
+
const createZodRecordWithSpecifiedPartial = (partial) => {
|
|
73
|
+
const keys = Object.keys(partial);
|
|
74
|
+
return zod.union([
|
|
75
|
+
zod.object(partial),
|
|
76
|
+
zod.record(zod.any()).refine((obj) => {
|
|
77
|
+
return !keys.some((key) => key in obj);
|
|
78
|
+
})
|
|
79
|
+
]);
|
|
80
|
+
};
|
|
81
|
+
const createV5Schema = () => {
|
|
82
|
+
const componentNameSchema = zod.string().refine(
|
|
83
|
+
(value) => {
|
|
84
|
+
const firstLetter = value.slice(0, 1);
|
|
85
|
+
return firstLetter === firstLetter.toUpperCase();
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
message: "theme.components.[componentName] needs to be in PascalCase, e.g. theme.components.Button"
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
const themeSchema = createZodRecordWithSpecifiedPartial({
|
|
92
|
+
components: zod.record(componentNameSchema, zod.record(zod.any()))
|
|
93
|
+
});
|
|
94
|
+
const configProvider = createZodRecordWithSpecifiedPartial({
|
|
95
|
+
theme: themeSchema
|
|
96
|
+
});
|
|
97
|
+
return zod.object({
|
|
98
|
+
...commonSchema,
|
|
99
|
+
theme: themeSchema.describe("Shortcut of `configProvider.theme`"),
|
|
100
|
+
appConfig: zod.record(zod.any()).describe("Only >= antd@5.1.0 is supported"),
|
|
101
|
+
momentPicker: zod.boolean().describe("DatePicker & Calendar use moment version"),
|
|
102
|
+
styleProvider: zod.record(zod.any()),
|
|
103
|
+
configProvider
|
|
104
|
+
}).deepPartial();
|
|
105
|
+
};
|
|
106
|
+
const createV4Schema = () => {
|
|
107
|
+
return zod.object({
|
|
108
|
+
...commonSchema,
|
|
109
|
+
configProvider: zod.record(zod.any())
|
|
110
|
+
}).deepPartial();
|
|
111
|
+
};
|
|
112
|
+
if (isV5) {
|
|
113
|
+
return createV5Schema();
|
|
114
|
+
}
|
|
115
|
+
if (isV4) {
|
|
116
|
+
return createV4Schema();
|
|
117
|
+
}
|
|
118
|
+
return zod.object({});
|
|
80
119
|
}
|
|
81
120
|
},
|
|
82
121
|
enableBy({ userConfig }) {
|
package/dist/react-query.js
CHANGED
|
@@ -87,6 +87,7 @@ var react_query_default = (api) => {
|
|
|
87
87
|
api.writeTmpFile({
|
|
88
88
|
path: "runtime.tsx",
|
|
89
89
|
content: enableQueryClient ? `
|
|
90
|
+
import React from 'react';
|
|
90
91
|
import { defaultContext, QueryClient, QueryClientProvider } from '${pkgPath}';
|
|
91
92
|
import { ReactQueryDevtools } from '${devtoolPkgPath}';
|
|
92
93
|
${reactQueryRuntimeCode}
|
|
@@ -120,6 +120,7 @@ export { styled, ThemeProvider, createGlobalStyle, css, keyframes, StyleSheetMan
|
|
|
120
120
|
api.writeTmpFile({
|
|
121
121
|
path: "runtime.tsx",
|
|
122
122
|
content: `
|
|
123
|
+
import React from 'react';
|
|
123
124
|
${hasProvider ? `import { StyleSheetManager } from '${(0, import_utils.winPath)(libPath)}';` : ``}
|
|
124
125
|
|
|
125
126
|
${styledComponentsRuntimeCode}
|
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.20231221.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",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"styled-components": "6.1.1",
|
|
46
46
|
"tslib": "^2",
|
|
47
47
|
"warning": "^4.0.3",
|
|
48
|
-
"@umijs/
|
|
49
|
-
"@umijs/
|
|
48
|
+
"@umijs/valtio": "1.0.4",
|
|
49
|
+
"@umijs/bundler-utils": "4.0.0-canary.20231221.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.0.0-canary.
|
|
53
|
+
"umi": "4.0.0-canary.20231221.1"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|