@umijs/preset-umi 4.4.13-canary.20250910.1 → 4.4.13-canary.20250911.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.
@@ -110,7 +110,7 @@ var tmpFiles_default = (api) => {
110
110
  [`${api.appData.umi.importSource}/typings`]: [
111
111
  `${umiTempDir}/typings`
112
112
  ],
113
- ...api.config.vite ? {
113
+ ...api.config.vite || api.config.utoopack ? {
114
114
  "@fs/*": ["*"]
115
115
  } : {}
116
116
  }
@@ -136,9 +136,10 @@ var registerMethods_default = (api) => {
136
136
  content.trim(),
137
137
  ""
138
138
  ].filter((text) => text !== false).join("\n");
139
- if (api.appData.vite && isJsFile) {
139
+ const isUtoopack = api.appData.bundler === "utoopack";
140
+ if ((api.appData.vite || isUtoopack) && isJsFile) {
140
141
  const transformIEAR = transformModule.default;
141
- content = transformIEAR({ content, path: absPath }, api);
142
+ content = transformIEAR({ content, path: absPath }, api, isUtoopack);
142
143
  }
143
144
  if (!(0, import_fs.existsSync)(absPath)) {
144
145
  (0, import_fs.writeFileSync)(absPath, content, "utf-8");
@@ -19,4 +19,4 @@ export declare const IEAR_REG_EXP: RegExp;
19
19
  export default function transformIEAR({ content, path }: {
20
20
  content: string;
21
21
  path: string;
22
- }, api: IApi): string;
22
+ }, api: IApi, isUtoopack?: boolean): string;
@@ -24,6 +24,7 @@ __export(transformIEAR_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(transformIEAR_exports);
26
26
  var import_bundler_utils = require("@umijs/bundler-utils");
27
+ var import_bundler_utoopack = require("@umijs/bundler-utoopack");
27
28
  var import_utils = require("@umijs/utils");
28
29
  var import_path = require("path");
29
30
  var IEAR_REG_EXP = new RegExp(
@@ -89,7 +90,11 @@ var IEAR_REG_EXP = new RegExp(
89
90
  // match full-content
90
91
  "g"
91
92
  );
92
- function transformIEAR({ content, path }, api) {
93
+ function transformIEAR({ content, path }, api, isUtoopack = false) {
94
+ let rootPath = api.cwd;
95
+ if (isUtoopack) {
96
+ rootPath = (0, import_bundler_utoopack.findRootDir)(api.cwd);
97
+ }
93
98
  return content.replace(IEAR_REG_EXP, (_, prefix, quote, absPath) => {
94
99
  if (absPath.startsWith(api.paths.absTmpPath)) {
95
100
  absPath = (0, import_utils.winPath)((0, import_path.relative)((0, import_path.dirname)(path), absPath)).replace(
@@ -99,6 +104,12 @@ function transformIEAR({ content, path }, api) {
99
104
  );
100
105
  } else if ((0, import_bundler_utils.isDepPath)(absPath)) {
101
106
  absPath = `@fs/${(0, import_utils.winPath)((0, import_path.relative)(api.cwd, absPath))}`;
107
+ } else if (absPath.startsWith(rootPath) && isUtoopack) {
108
+ absPath = (0, import_utils.winPath)((0, import_path.relative)((0, import_path.dirname)(path), absPath)).replace(
109
+ // prepend ./ for same or sub level imports
110
+ /^(?!\.\.\/)/,
111
+ "./"
112
+ );
102
113
  }
103
114
  return `${prefix}${quote}${absPath}${quote}`;
104
115
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.4.13-canary.20250910.1",
3
+ "version": "4.4.13-canary.20250911.1",
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",
@@ -43,20 +43,20 @@
43
43
  "react-router": "6.3.0",
44
44
  "react-router-dom": "6.3.0",
45
45
  "regenerator-runtime": "0.13.11",
46
- "@umijs/bundler-utils": "4.4.13-canary.20250910.1",
47
- "@umijs/babel-preset-umi": "4.4.13-canary.20250910.1",
48
- "@umijs/ast": "4.4.13-canary.20250910.1",
49
- "@umijs/bundler-esbuild": "4.4.13-canary.20250910.1",
50
- "@umijs/bundler-utoopack": "4.4.13-canary.20250910.1",
51
- "@umijs/core": "4.4.13-canary.20250910.1",
52
- "@umijs/bundler-webpack": "4.4.13-canary.20250910.1",
53
- "@umijs/bundler-vite": "4.4.13-canary.20250910.1",
54
- "@umijs/mfsu": "4.4.13-canary.20250910.1",
55
- "@umijs/plugin-run": "4.4.13-canary.20250910.1",
56
- "@umijs/server": "4.4.13-canary.20250910.1",
57
- "@umijs/renderer-react": "4.4.13-canary.20250910.1",
58
- "@umijs/utils": "4.4.13-canary.20250910.1",
59
- "@umijs/zod2ts": "4.4.13-canary.20250910.1",
46
+ "@umijs/ast": "4.4.13-canary.20250911.1",
47
+ "@umijs/bundler-utils": "4.4.13-canary.20250911.1",
48
+ "@umijs/bundler-utoopack": "4.4.13-canary.20250911.1",
49
+ "@umijs/bundler-vite": "4.4.13-canary.20250911.1",
50
+ "@umijs/bundler-webpack": "4.4.13-canary.20250911.1",
51
+ "@umijs/core": "4.4.13-canary.20250911.1",
52
+ "@umijs/mfsu": "4.4.13-canary.20250911.1",
53
+ "@umijs/babel-preset-umi": "4.4.13-canary.20250911.1",
54
+ "@umijs/plugin-run": "4.4.13-canary.20250911.1",
55
+ "@umijs/renderer-react": "4.4.13-canary.20250911.1",
56
+ "@umijs/server": "4.4.13-canary.20250911.1",
57
+ "@umijs/utils": "4.4.13-canary.20250911.1",
58
+ "@umijs/zod2ts": "4.4.13-canary.20250911.1",
59
+ "@umijs/bundler-esbuild": "4.4.13-canary.20250911.1",
60
60
  "@umijs/ui": "3.0.1"
61
61
  },
62
62
  "devDependencies": {