@umijs/preset-umi 4.3.4 → 4.3.6

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.
@@ -326,10 +326,14 @@ interface IUmiIconProps extends React.SVGAttributes<SVGElement> {
326
326
  flip?: 'vertical' | 'horizontal' | 'horizontal,vertical' | 'vertical,horizontal';
327
327
  }
328
328
 
329
+ export const getIconComponent = (icon: Pick<IUmiIconProps, 'icon'>) => {
330
+ const iconName = normalizeIconName(alias[icon] || icon);
331
+ return iconsMap[iconName];
332
+ }
333
+
329
334
  export const Icon = React.forwardRef<HTMLSpanElement, IUmiIconProps>((props, ref) => {
330
335
  const { icon, hover, style, className = '' , rotate, spin, flip, ...extraProps } = props;
331
- const iconName = normalizeIconName(alias[icon] || icon);
332
- const Component = iconsMap[iconName];
336
+ const Component = getIconComponent(icon);
333
337
  if (!Component) {
334
338
  // TODO: give a error icon when dev, to help developer find the error
335
339
  return null;
@@ -53,6 +53,7 @@ var tmpFiles_default = (api) => {
53
53
  }
54
54
  }
55
55
  });
56
+ const TSCONFIG_FILE_NAME = "tsconfig.json";
56
57
  api.onGenerateFiles(async (opts) => {
57
58
  var _a, _b, _c, _d;
58
59
  const rendererPath = (0, import_utils.winPath)(
@@ -75,6 +76,10 @@ var tmpFiles_default = (api) => {
75
76
  const baseUrl = api.appData.hasSrcDir ? "../../" : "../";
76
77
  const isTs5 = (_a = api.appData.typescript.tsVersion) == null ? void 0 : _a.startsWith("5");
77
78
  const isTslibInstalled = !!api.appData.typescript.tslibVersion;
79
+ const tsconfigFilePath = (0, import_path.join)(api.paths.absTmpPath, TSCONFIG_FILE_NAME);
80
+ const relativeUmiDirPath = (0, import_utils.winPath)(
81
+ (0, import_path.relative)((0, import_path.dirname)(tsconfigFilePath), umiDir)
82
+ );
78
83
  let umiTsConfig = {
79
84
  compilerOptions: {
80
85
  target: "esnext",
@@ -101,7 +106,7 @@ var tmpFiles_default = (api) => {
101
106
  paths: {
102
107
  "@/*": [`${srcPrefix}*`],
103
108
  "@@/*": [`${umiTempDir}/*`],
104
- [`${api.appData.umi.importSource}`]: [umiDir],
109
+ [`${api.appData.umi.importSource}`]: [relativeUmiDirPath],
105
110
  [`${api.appData.umi.importSource}/typings`]: [
106
111
  `${umiTempDir}/typings`
107
112
  ],
@@ -126,7 +131,7 @@ var tmpFiles_default = (api) => {
126
131
  });
127
132
  api.writeTmpFile({
128
133
  noPluginDir: true,
129
- path: "tsconfig.json",
134
+ path: TSCONFIG_FILE_NAME,
130
135
  content: JSON.stringify(umiTsConfig, null, 2)
131
136
  });
132
137
  api.writeTmpFile({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.3.4",
3
+ "version": "4.3.6",
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",
@@ -41,21 +41,21 @@
41
41
  "react-router": "6.3.0",
42
42
  "react-router-dom": "6.3.0",
43
43
  "regenerator-runtime": "0.13.11",
44
- "@umijs/ast": "4.3.4",
45
- "@umijs/bundler-esbuild": "4.3.4",
46
- "@umijs/babel-preset-umi": "4.3.4",
47
- "@umijs/bundler-utils": "4.3.4",
48
- "@umijs/bundler-vite": "4.3.4",
49
- "@umijs/bundler-webpack": "4.3.4",
50
- "@umijs/core": "4.3.4",
44
+ "@umijs/ast": "4.3.6",
45
+ "@umijs/babel-preset-umi": "4.3.6",
46
+ "@umijs/bundler-vite": "4.3.6",
47
+ "@umijs/bundler-utils": "4.3.6",
48
+ "@umijs/bundler-esbuild": "4.3.6",
49
+ "@umijs/bundler-webpack": "4.3.6",
50
+ "@umijs/core": "4.3.6",
51
51
  "@umijs/did-you-know": "1.0.3",
52
- "@umijs/mfsu": "4.3.4",
53
- "@umijs/plugin-run": "4.3.4",
54
- "@umijs/renderer-react": "4.3.4",
55
- "@umijs/server": "4.3.4",
52
+ "@umijs/server": "4.3.6",
53
+ "@umijs/mfsu": "4.3.6",
54
+ "@umijs/renderer-react": "4.3.6",
56
55
  "@umijs/ui": "3.0.1",
57
- "@umijs/utils": "4.3.4",
58
- "@umijs/zod2ts": "4.3.4"
56
+ "@umijs/plugin-run": "4.3.6",
57
+ "@umijs/utils": "4.3.6",
58
+ "@umijs/zod2ts": "4.3.6"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@manypkg/get-packages": "1.1.3",