@umijs/preset-umi 4.0.67 → 4.0.69
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.
|
@@ -39,6 +39,7 @@ function getSchemas() {
|
|
|
39
39
|
return {
|
|
40
40
|
analyze: ({ zod }) => zod.object({}),
|
|
41
41
|
base: ({ zod }) => zod.string(),
|
|
42
|
+
conventionLayout: ({ zod }) => zod.boolean(),
|
|
42
43
|
conventionRoutes: ({ zod }) => zod.object({
|
|
43
44
|
base: zod.string().optional(),
|
|
44
45
|
exclude: zod.array(zod.any()).optional()
|
|
@@ -55,7 +55,7 @@ async function getApiRoutes(opts) {
|
|
|
55
55
|
return routes;
|
|
56
56
|
}
|
|
57
57
|
async function getRoutes(opts) {
|
|
58
|
-
var _a, _b, _c;
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
59
|
let routes = null;
|
|
60
60
|
if (opts.api.config.routes) {
|
|
61
61
|
routes = (0, import_core.getConfigRoutes)({
|
|
@@ -131,7 +131,7 @@ async function getRoutes(opts) {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
const absLayoutPath = (0, import_utils.tryPaths)([
|
|
134
|
+
const absLayoutPath = ((_d = opts.api.config) == null ? void 0 : _d.conventionLayout) === false ? false : (0, import_utils.tryPaths)([
|
|
135
135
|
(0, import_path.join)(opts.api.paths.absSrcPath, "layouts/index.tsx"),
|
|
136
136
|
(0, import_path.join)(opts.api.paths.absSrcPath, "layouts/index.vue"),
|
|
137
137
|
(0, import_path.join)(opts.api.paths.absSrcPath, "layouts/index.jsx"),
|
|
@@ -68,65 +68,64 @@ var tmpFiles_default = (api) => {
|
|
|
68
68
|
initialValue: (0, import_path.join)(rendererPath, "dist/server.js")
|
|
69
69
|
})
|
|
70
70
|
);
|
|
71
|
+
const frameworkName = api.service.frameworkName;
|
|
71
72
|
const srcPrefix = api.appData.hasSrcDir ? "src/" : "";
|
|
72
|
-
const umiTempDir = `${srcPrefix}
|
|
73
|
+
const umiTempDir = `${srcPrefix}.${frameworkName}`;
|
|
73
74
|
const baseUrl = api.appData.hasSrcDir ? "../../" : "../";
|
|
74
75
|
const isTs5 = (_a = api.appData.typescript.tsVersion) == null ? void 0 : _a.startsWith("5");
|
|
75
76
|
const isTslibInstalled = !!api.appData.typescript.tslibVersion;
|
|
77
|
+
let umiTsConfig = {
|
|
78
|
+
compilerOptions: {
|
|
79
|
+
target: "esnext",
|
|
80
|
+
module: "esnext",
|
|
81
|
+
lib: ["dom", "dom.iterable", "esnext"],
|
|
82
|
+
allowJs: true,
|
|
83
|
+
skipLibCheck: true,
|
|
84
|
+
moduleResolution: isTs5 ? "bundler" : "node",
|
|
85
|
+
importHelpers: isTslibInstalled,
|
|
86
|
+
noEmit: true,
|
|
87
|
+
jsx: api.appData.framework === "vue" ? "preserve" : "react-jsx",
|
|
88
|
+
esModuleInterop: true,
|
|
89
|
+
sourceMap: true,
|
|
90
|
+
baseUrl,
|
|
91
|
+
strict: true,
|
|
92
|
+
resolveJsonModule: true,
|
|
93
|
+
allowSyntheticDefaultImports: true,
|
|
94
|
+
// Supported by vue only
|
|
95
|
+
...api.appData.framework === "vue" ? {
|
|
96
|
+
// TODO Actually, it should be vite mode, but here it is written as vue only
|
|
97
|
+
// Required in Vite https://vitejs.dev/guide/features.html#typescript
|
|
98
|
+
isolatedModules: true
|
|
99
|
+
} : {},
|
|
100
|
+
paths: {
|
|
101
|
+
"@/*": [`${srcPrefix}*`],
|
|
102
|
+
"@@/*": [`${umiTempDir}/*`],
|
|
103
|
+
[`${api.appData.umi.importSource}`]: [umiDir],
|
|
104
|
+
[`${api.appData.umi.importSource}/typings`]: [
|
|
105
|
+
`${umiTempDir}/typings`
|
|
106
|
+
],
|
|
107
|
+
...api.config.vite ? {
|
|
108
|
+
"@fs/*": ["*"]
|
|
109
|
+
} : {}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
include: [
|
|
113
|
+
`${baseUrl}.${frameworkName}rc.ts`,
|
|
114
|
+
`${baseUrl}**/*.d.ts`,
|
|
115
|
+
`${baseUrl}**/*.ts`,
|
|
116
|
+
`${baseUrl}**/*.tsx`,
|
|
117
|
+
api.appData.framework === "vue" && `${baseUrl}**/*.vue`
|
|
118
|
+
].filter(Boolean)
|
|
119
|
+
};
|
|
120
|
+
umiTsConfig = await api.applyPlugins({
|
|
121
|
+
key: "modifyTSConfig",
|
|
122
|
+
type: api.ApplyPluginsType.modify,
|
|
123
|
+
initialValue: umiTsConfig
|
|
124
|
+
});
|
|
76
125
|
api.writeTmpFile({
|
|
77
126
|
noPluginDir: true,
|
|
78
127
|
path: "tsconfig.json",
|
|
79
|
-
|
|
80
|
-
// x 2、alias
|
|
81
|
-
// 3、language service platform
|
|
82
|
-
// 4、typing
|
|
83
|
-
content: JSON.stringify(
|
|
84
|
-
{
|
|
85
|
-
compilerOptions: {
|
|
86
|
-
target: "esnext",
|
|
87
|
-
module: "esnext",
|
|
88
|
-
lib: ["dom", "dom.iterable", "esnext"],
|
|
89
|
-
allowJs: true,
|
|
90
|
-
skipLibCheck: true,
|
|
91
|
-
moduleResolution: isTs5 ? "bundler" : "node",
|
|
92
|
-
importHelpers: isTslibInstalled,
|
|
93
|
-
noEmit: true,
|
|
94
|
-
jsx: api.appData.framework === "vue" ? "preserve" : "react-jsx",
|
|
95
|
-
esModuleInterop: true,
|
|
96
|
-
sourceMap: true,
|
|
97
|
-
baseUrl,
|
|
98
|
-
strict: true,
|
|
99
|
-
resolveJsonModule: true,
|
|
100
|
-
allowSyntheticDefaultImports: true,
|
|
101
|
-
// Supported by vue only
|
|
102
|
-
...api.appData.framework === "vue" ? {
|
|
103
|
-
// TODO Actually, it should be vite mode, but here it is written as vue only
|
|
104
|
-
// Required in Vite https://vitejs.dev/guide/features.html#typescript
|
|
105
|
-
isolatedModules: true
|
|
106
|
-
} : {},
|
|
107
|
-
paths: {
|
|
108
|
-
"@/*": [`${srcPrefix}*`],
|
|
109
|
-
"@@/*": [`${umiTempDir}/*`],
|
|
110
|
-
[`${api.appData.umi.importSource}`]: [umiDir],
|
|
111
|
-
[`${api.appData.umi.importSource}/typings`]: [
|
|
112
|
-
`${umiTempDir}/typings`
|
|
113
|
-
],
|
|
114
|
-
...api.config.vite ? {
|
|
115
|
-
"@fs/*": ["*"]
|
|
116
|
-
} : {}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
include: [
|
|
120
|
-
`${baseUrl}.umirc.ts`,
|
|
121
|
-
`${baseUrl}**/*.d.ts`,
|
|
122
|
-
`${baseUrl}**/*.ts`,
|
|
123
|
-
`${baseUrl}**/*.tsx`,
|
|
124
|
-
api.appData.framework === "vue" && `${baseUrl}**/*.vue`
|
|
125
|
-
].filter(Boolean)
|
|
126
|
-
},
|
|
127
|
-
null,
|
|
128
|
-
2
|
|
129
|
-
)
|
|
128
|
+
content: JSON.stringify(umiTsConfig, null, 2)
|
|
130
129
|
});
|
|
131
130
|
api.writeTmpFile({
|
|
132
131
|
noPluginDir: true,
|
package/dist/registerMethods.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ export declare type IApi = PluginAPI & IServicePluginAPI & {
|
|
|
137
137
|
modifyRendererPath: IModify<string, {}>;
|
|
138
138
|
modifyRoutes: IModify<Record<string, IRoute>, {}>;
|
|
139
139
|
modifyServerRendererPath: IModify<string, {}>;
|
|
140
|
+
modifyTSConfig: IModify<Record<string, any>, {}>;
|
|
140
141
|
modifyViteConfig: IModify<ViteInlineConfig, {
|
|
141
142
|
env: Env;
|
|
142
143
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.69",
|
|
4
4
|
"description": "@umijs/preset-umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"react-router": "6.3.0",
|
|
38
38
|
"react-router-dom": "6.3.0",
|
|
39
39
|
"regenerator-runtime": "0.13.11",
|
|
40
|
-
"@umijs/ast": "4.0.
|
|
41
|
-
"@umijs/babel-preset-umi": "4.0.
|
|
42
|
-
"@umijs/bundler-
|
|
43
|
-
"@umijs/bundler-
|
|
44
|
-
"@umijs/bundler-
|
|
45
|
-
"@umijs/core": "4.0.
|
|
46
|
-
"@umijs/mfsu": "4.0.
|
|
47
|
-
"@umijs/renderer-react": "4.0.
|
|
48
|
-
"@umijs/plugin-run": "4.0.
|
|
49
|
-
"@umijs/server": "4.0.
|
|
50
|
-
"@umijs/
|
|
51
|
-
"@umijs/
|
|
52
|
-
"@umijs/
|
|
53
|
-
"@umijs/
|
|
40
|
+
"@umijs/ast": "4.0.69",
|
|
41
|
+
"@umijs/babel-preset-umi": "4.0.69",
|
|
42
|
+
"@umijs/bundler-vite": "4.0.69",
|
|
43
|
+
"@umijs/bundler-utils": "4.0.69",
|
|
44
|
+
"@umijs/bundler-webpack": "4.0.69",
|
|
45
|
+
"@umijs/core": "4.0.69",
|
|
46
|
+
"@umijs/mfsu": "4.0.69",
|
|
47
|
+
"@umijs/renderer-react": "4.0.69",
|
|
48
|
+
"@umijs/plugin-run": "4.0.69",
|
|
49
|
+
"@umijs/server": "4.0.69",
|
|
50
|
+
"@umijs/zod2ts": "4.0.69",
|
|
51
|
+
"@umijs/utils": "4.0.69",
|
|
52
|
+
"@umijs/ui": "3.0.1",
|
|
53
|
+
"@umijs/did-you-know": "1.0.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@manypkg/get-packages": "1.1.3",
|