@umijs/preset-umi 4.0.67 → 4.0.68

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.
@@ -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}.umi`;
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
- // x 1、basic config
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,
@@ -86,7 +86,8 @@ var registerMethods_default = (api) => {
86
86
  "modifyRendererPath",
87
87
  "modifyServerRendererPath",
88
88
  "modifyRoutes",
89
- "modifyBabelPresetOpts"
89
+ "modifyBabelPresetOpts",
90
+ "modifyTSConfig"
90
91
  ].forEach((name) => {
91
92
  api.registerMethod({ name });
92
93
  });
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.67",
3
+ "version": "4.0.68",
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.67",
41
- "@umijs/babel-preset-umi": "4.0.67",
42
- "@umijs/bundler-utils": "4.0.67",
43
- "@umijs/bundler-webpack": "4.0.67",
44
- "@umijs/bundler-vite": "4.0.67",
45
- "@umijs/core": "4.0.67",
46
- "@umijs/mfsu": "4.0.67",
47
- "@umijs/renderer-react": "4.0.67",
48
- "@umijs/plugin-run": "4.0.67",
49
- "@umijs/server": "4.0.67",
50
- "@umijs/utils": "4.0.67",
51
- "@umijs/zod2ts": "4.0.67",
40
+ "@umijs/ast": "4.0.68",
41
+ "@umijs/bundler-utils": "4.0.68",
42
+ "@umijs/bundler-webpack": "4.0.68",
43
+ "@umijs/bundler-vite": "4.0.68",
44
+ "@umijs/plugin-run": "4.0.68",
45
+ "@umijs/core": "4.0.68",
46
+ "@umijs/mfsu": "4.0.68",
47
+ "@umijs/renderer-react": "4.0.68",
52
48
  "@umijs/did-you-know": "1.0.3",
53
- "@umijs/ui": "3.0.0-alpha.0"
49
+ "@umijs/babel-preset-umi": "4.0.68",
50
+ "@umijs/server": "4.0.68",
51
+ "@umijs/ui": "3.0.0-alpha.0",
52
+ "@umijs/utils": "4.0.68",
53
+ "@umijs/zod2ts": "4.0.68"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@manypkg/get-packages": "1.1.3",