@umijs/preset-umi 4.6.66 → 4.6.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.
Files changed (148) hide show
  1. package/dist/commands/build.d.ts +1 -1
  2. package/dist/commands/config/config.d.ts +1 -1
  3. package/dist/commands/config/list.d.ts +1 -1
  4. package/dist/commands/config/remove.js +2 -1
  5. package/dist/commands/config/set.js +2 -1
  6. package/dist/commands/deadcode.d.ts +1 -1
  7. package/dist/commands/deadcode.js +2 -1
  8. package/dist/commands/dev/createRouteMiddleware.js +2 -1
  9. package/dist/commands/dev/depBuildWorker/depBuildWorker.js +3 -3
  10. package/dist/commands/dev/depBuildWorker/depBuilder.d.ts +1 -1
  11. package/dist/commands/dev/depBuildWorker/depBuilder.js +6 -5
  12. package/dist/commands/dev/depBuildWorker/dev-config.d.ts +1 -1
  13. package/dist/commands/dev/depBuildWorker/getConfig.js +2 -2
  14. package/dist/commands/dev/depBuildWorker/workerPreset.d.ts +2 -2
  15. package/dist/commands/dev/dev.d.ts +1 -1
  16. package/dist/commands/dev/dev.js +2 -1
  17. package/dist/commands/generators/api.d.ts +1 -1
  18. package/dist/commands/generators/component.d.ts +1 -1
  19. package/dist/commands/generators/component.js +0 -2
  20. package/dist/commands/generators/cypress.d.ts +1 -1
  21. package/dist/commands/generators/dva.d.ts +1 -1
  22. package/dist/commands/generators/jest.d.ts +1 -1
  23. package/dist/commands/generators/mock.d.ts +1 -1
  24. package/dist/commands/generators/page.d.ts +1 -1
  25. package/dist/commands/generators/page.js +9 -8
  26. package/dist/commands/generators/precommit.d.ts +1 -1
  27. package/dist/commands/generators/prettier.d.ts +1 -1
  28. package/dist/commands/generators/tailwindcss.d.ts +1 -1
  29. package/dist/commands/generators/tsconfig.d.ts +1 -1
  30. package/dist/commands/generators/utils.js +0 -2
  31. package/dist/commands/help.d.ts +1 -1
  32. package/dist/commands/lint.d.ts +1 -1
  33. package/dist/commands/mfsu/mfsu.d.ts +1 -1
  34. package/dist/commands/mfsu/util.js +0 -2
  35. package/dist/commands/plugin.d.ts +1 -1
  36. package/dist/commands/preview.d.ts +1 -1
  37. package/dist/commands/setup.d.ts +1 -1
  38. package/dist/commands/verify-commit.d.ts +1 -1
  39. package/dist/commands/version.d.ts +1 -1
  40. package/dist/constants.d.ts +1 -0
  41. package/dist/constants.js +3 -0
  42. package/dist/features/404/404.d.ts +2 -2
  43. package/dist/features/__sample.d.ts +1 -1
  44. package/dist/features/aiDev/aiDev.d.ts +1 -1
  45. package/dist/features/aiDev/aiDev.js +2 -1
  46. package/dist/features/apiRoute/apiRoute.d.ts +1 -1
  47. package/dist/features/apiRoute/apiRoute.js +2 -1
  48. package/dist/features/apiRoute/dev-server/esbuild.js +2 -1
  49. package/dist/features/apiRoute/request.d.ts +0 -2
  50. package/dist/features/apiRoute/request.js +6 -5
  51. package/dist/features/apiRoute/response.d.ts +0 -1
  52. package/dist/features/apiRoute/response.js +0 -1
  53. package/dist/features/apiRoute/utils.js +18 -9
  54. package/dist/features/appData/appData.d.ts +1 -1
  55. package/dist/features/appData/appData.js +2 -2
  56. package/dist/features/appData/umiInfo.d.ts +1 -1
  57. package/dist/features/bundler/bundler.d.ts +1 -1
  58. package/dist/features/check/babel722.d.ts +1 -1
  59. package/dist/features/check/check.d.ts +1 -1
  60. package/dist/features/classPropertiesLoose/classPropertiesLoose.d.ts +1 -1
  61. package/dist/features/clickToComponent/clickToComponent.d.ts +1 -1
  62. package/dist/features/clientLoader/clientLoader.d.ts +1 -1
  63. package/dist/features/codeSplitting/codeSplitting.d.ts +1 -1
  64. package/dist/features/codeSplitting/codeSplitting.js +4 -2
  65. package/dist/features/configPlugins/configPlugins.d.ts +1 -1
  66. package/dist/features/crossorigin/crossorigin.d.ts +1 -1
  67. package/dist/features/depsOnDemand/depsOnDemand.d.ts +1 -1
  68. package/dist/features/devTool/devTool.d.ts +1 -1
  69. package/dist/features/esbuildHelperChecker/esbuildHelperChecker.d.ts +1 -1
  70. package/dist/features/esbuildHelperChecker/esbuildHelperChecker.js +10 -5
  71. package/dist/features/esmi/Service.js +5 -5
  72. package/dist/features/esmi/esmi.d.ts +1 -1
  73. package/dist/features/exportStatic/exportStatic.d.ts +1 -1
  74. package/dist/features/favicons/favicons.d.ts +1 -1
  75. package/dist/features/favicons/favicons.js +4 -2
  76. package/dist/features/helmet/helmet.d.ts +2 -2
  77. package/dist/features/icons/icons.d.ts +1 -1
  78. package/dist/features/icons/svgr.js +4 -2
  79. package/dist/features/legacy/legacy.d.ts +1 -1
  80. package/dist/features/legacy/legacy.js +6 -6
  81. package/dist/features/lowImport/lowImport.d.ts +1 -1
  82. package/dist/features/mako/mako.d.ts +1 -1
  83. package/dist/features/mock/createMockMiddleware.js +2 -1
  84. package/dist/features/monorepo/redirect.d.ts +1 -1
  85. package/dist/features/monorepo/redirect.js +4 -2
  86. package/dist/features/mpa/mpa.d.ts +1 -1
  87. package/dist/features/mpa/mpa.js +10 -5
  88. package/dist/features/okam/okam.d.ts +1 -1
  89. package/dist/features/overrides/overrides.d.ts +1 -1
  90. package/dist/features/overrides/overrides.js +2 -1
  91. package/dist/features/overrides/transform.js +4 -2
  92. package/dist/features/phantomDependency/phantomDependency.d.ts +1 -1
  93. package/dist/features/phantomDependency/phantomDependency.js +30 -15
  94. package/dist/features/polyfill/polyfill.d.ts +1 -1
  95. package/dist/features/polyfill/publicPathPolyfill.d.ts +1 -1
  96. package/dist/features/prepare/esbuildPlugins/esbuildAliasPlugin.js +8 -4
  97. package/dist/features/prepare/prepare.d.ts +1 -1
  98. package/dist/features/prepare/prepare.js +2 -1
  99. package/dist/features/reactCompiler/forget.d.ts +1 -1
  100. package/dist/features/reactCompiler/reactCompiler.d.ts +1 -1
  101. package/dist/features/reactCompiler/reactCompiler.js +4 -7
  102. package/dist/features/routePrefetch/routePrefetch.d.ts +1 -1
  103. package/dist/features/routePreloadOnLoad/routePreloadOnLoad.d.ts +1 -1
  104. package/dist/features/routePreloadOnLoad/routePreloadOnLoad.js +4 -2
  105. package/dist/features/routeProps/routeProps.d.ts +1 -1
  106. package/dist/features/ssr/builder/css-loader.js +2 -2
  107. package/dist/features/ssr/mako/mako.d.ts +1 -0
  108. package/dist/features/ssr/mako/mako.js +2 -2
  109. package/dist/features/ssr/ssr.d.ts +1 -1
  110. package/dist/features/ssr/ssr.js +4 -3
  111. package/dist/features/ssr/utils.js +4 -2
  112. package/dist/features/ssr/utoopack/utoopack.js +3 -3
  113. package/dist/features/ssr/webpack/webpack.js +2 -2
  114. package/dist/features/stagewise/stagewise.d.ts +1 -1
  115. package/dist/features/swc/swc.d.ts +1 -1
  116. package/dist/features/terminal/terminal.d.ts +1 -1
  117. package/dist/features/test/test.d.ts +1 -1
  118. package/dist/features/tmpFiles/configTypes.d.ts +1 -1
  119. package/dist/features/tmpFiles/getModuleExports.js +2 -2
  120. package/dist/features/tmpFiles/routes.js +7 -6
  121. package/dist/features/tmpFiles/tmpFiles.d.ts +1 -1
  122. package/dist/features/tmpFiles/tmpFiles.js +15 -15
  123. package/dist/features/transform/CodeFrameError.js +0 -1
  124. package/dist/features/transform/transform.d.ts +1 -1
  125. package/dist/features/ui/ui.d.ts +1 -1
  126. package/dist/features/ui/ui.js +2 -1
  127. package/dist/features/utoopack/utoopack.d.ts +1 -1
  128. package/dist/features/vite/vite.d.ts +1 -1
  129. package/dist/features/webpack/webpack.d.ts +1 -1
  130. package/dist/index.d.ts +2 -2
  131. package/dist/libs/folderCache/AutoUpdateFolderCache.js +3 -9
  132. package/dist/libs/folderCache/AutoUpdateSourceCodeCache.d.ts +2 -2
  133. package/dist/libs/folderCache/AutoUpdateSourceCodeCache.js +2 -5
  134. package/dist/libs/folderCache/FolderWatch.js +2 -5
  135. package/dist/libs/folderCache/LazySourceCodeCache.d.ts +2 -2
  136. package/dist/libs/folderCache/LazySourceCodeCache.js +6 -10
  137. package/dist/libs/folderCache/constant.d.ts +28 -28
  138. package/dist/libs/folderCache/types.d.ts +5 -5
  139. package/dist/libs/scan.d.ts +1 -1
  140. package/dist/libs/scan.js +4 -2
  141. package/dist/registerMethods.d.ts +1 -1
  142. package/dist/types.d.ts +12 -13
  143. package/dist/utils/extractEntryAssets.d.ts +1 -1
  144. package/dist/utils/routeExportExtractor.d.ts +1 -1
  145. package/dist/utils/routeExportExtractor.js +2 -1
  146. package/dist/utils/serializeAppData.js +2 -1
  147. package/package.json +15 -15
  148. package/templates/defineApp.tpl +1 -0
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -49,7 +49,8 @@ var codeSplitting_default = (api) => {
49
49
  enableBy: api.EnableBy.config
50
50
  });
51
51
  api.chainWebpack((memo) => {
52
- if (api.env !== "production") return;
52
+ if (api.env !== "production")
53
+ return;
53
54
  const { jsStrategy, jsStrategyOptions, cssStrategy } = api.config.codeSplitting;
54
55
  if (jsStrategy === "bigVendors") {
55
56
  memo.optimization.splitChunks({
@@ -74,7 +75,8 @@ var codeSplitting_default = (api) => {
74
75
  name(module2) {
75
76
  const path = module2.context.replace(/.pnpm[\\/]/, "");
76
77
  const match = path.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/);
77
- if (!match) return "npm.unknown";
78
+ if (!match)
79
+ return "npm.unknown";
78
80
  const packageName = match[1];
79
81
  return `npm.${packageName.replace(/@/g, "_at_").replace(/\+/g, "_")}`;
80
82
  }
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -9,8 +9,8 @@ export interface IOnDemandInstallDep {
9
9
  */
10
10
  dev?: boolean;
11
11
  }
12
- declare const _default: (api: IApi) => void;
13
12
  export default _default;
13
+ declare function _default(api: IApi): void;
14
14
  export declare function addDeps(opts: {
15
15
  pkgPath: string;
16
16
  deps: IOnDemandInstallDep[];
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -3,5 +3,5 @@ export declare function getGlobalVars(opts: {
3
3
  content: string;
4
4
  fileName: string;
5
5
  }): Promise<string[]>;
6
- declare const _default: (api: IApi) => void;
7
6
  export default _default;
7
+ declare function _default(api: IApi): void;
@@ -109,12 +109,17 @@ var esbuildHelperChecker_default = (api) => {
109
109
  }
110
110
  });
111
111
  api.onBuildComplete(async ({ err }) => {
112
- if (api.config.vite || api.config.mako || api.config.utoopack) return;
113
- if (err) return;
112
+ if (api.config.vite || api.config.mako || api.config.utoopack)
113
+ return;
114
+ if (err)
115
+ return;
114
116
  const jsMinifier = api.config.jsMinifier || "esbuild";
115
- if (jsMinifier !== "esbuild") return;
116
- if (api.config.esbuildMinifyIIFE) return;
117
- if (process.env.COMPRESS === "none") return;
117
+ if (jsMinifier !== "esbuild")
118
+ return;
119
+ if (api.config.esbuildMinifyIIFE)
120
+ return;
121
+ if (process.env.COMPRESS === "none")
122
+ return;
118
123
  try {
119
124
  await checkDir({
120
125
  dir: api.paths.absOutputPath
@@ -36,11 +36,11 @@ var import_utils = require("@umijs/utils");
36
36
  var import_crypto = require("crypto");
37
37
  var import_fs = __toESM(require("fs"));
38
38
  var import_path = __toESM(require("path"));
39
- var ESMIService = class _ESMIService {
40
- cdnOrigin = "";
41
- cacheDir = "";
42
- cache = {};
39
+ var ESMIService = class {
43
40
  constructor(opts) {
41
+ this.cdnOrigin = "";
42
+ this.cacheDir = "";
43
+ this.cache = {};
44
44
  this.cdnOrigin = opts.cdnOrigin;
45
45
  this.cacheDir = opts.cacheDir;
46
46
  const cacheFilePath = import_path.default.join(this.cacheDir, "importmap.json");
@@ -102,7 +102,7 @@ var ESMIService = class _ESMIService {
102
102
  * @returns importmap
103
103
  */
104
104
  async getImportmap(data) {
105
- const cacheKey = _ESMIService.getCacheKey(data);
105
+ const cacheKey = ESMIService.getCacheKey(data);
106
106
  const cache = this.getCache(cacheKey);
107
107
  const stamp = +/* @__PURE__ */ new Date();
108
108
  if (cache) {
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -44,7 +44,8 @@ var favicons_default = (api) => {
44
44
  }
45
45
  });
46
46
  api.modifyAppData(async (memo) => {
47
- if (api.config.favicons) return memo;
47
+ if (api.config.favicons)
48
+ return memo;
48
49
  const faviconFiles = getFaviconFiles(api.paths.absSrcPath);
49
50
  if (faviconFiles) {
50
51
  memo.faviconFiles = faviconFiles;
@@ -64,7 +65,8 @@ var favicons_default = (api) => {
64
65
  }
65
66
  ]);
66
67
  api.onBuildComplete(({ err }) => {
67
- if (err) return;
68
+ if (err)
69
+ return;
68
70
  if (api.appData.faviconFiles) {
69
71
  api.appData.faviconFiles.forEach((e) => {
70
72
  (0, import_fs.copyFileSync)(
@@ -1,6 +1,6 @@
1
1
  import type { IApi } from '../../types';
2
+ export default _default;
2
3
  /**
3
4
  * plugin for built-in react-helmet-async
4
5
  */
5
- declare const _default: (api: IApi) => void;
6
- export default _default;
6
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -74,8 +74,10 @@ function loadLocalIcon(icon, localIconDir) {
74
74
  }
75
75
  function normalizeSvgr(str) {
76
76
  return str.split("\n").filter((line) => {
77
- if (line.startsWith('import * as React from "react";')) return false;
78
- if (line.startsWith("export default ")) return false;
77
+ if (line.startsWith('import * as React from "react";'))
78
+ return false;
79
+ if (line.startsWith("export default "))
80
+ return false;
79
81
  return true;
80
82
  }).join("\n");
81
83
  }
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -32,7 +32,7 @@ __export(legacy_exports, {
32
32
  default: () => legacy_default
33
33
  });
34
34
  module.exports = __toCommonJS(legacy_exports);
35
- var import_types = require("@umijs/bundler-webpack/dist/types");
35
+ var import_bundler_webpack = require("@umijs/bundler-webpack");
36
36
  var import_utils = require("@umijs/utils");
37
37
  var import_path = require("path");
38
38
  var legacy_default = (api) => {
@@ -52,7 +52,7 @@ var legacy_default = (api) => {
52
52
  const legacyModeLabel = import_utils.chalk.bold.bgBlue(" LEGACY MODE ");
53
53
  const pluginConfig = api.config.legacy || api.userConfig.legacy || {};
54
54
  const enableEsCheck = pluginConfig == null ? void 0 : pluginConfig.checkOutput;
55
- if (api.env === import_types.Env.production && enableEsCheck) {
55
+ if (api.env === import_bundler_webpack.Env.production && enableEsCheck) {
56
56
  api.addOnDemandDeps(() => {
57
57
  return [
58
58
  {
@@ -89,7 +89,7 @@ var legacy_default = (api) => {
89
89
  var _a, _b;
90
90
  const { userConfig } = api;
91
91
  const { buildOnly = true, nodeModulesTransform = true } = pluginConfig;
92
- if (api.env === import_types.Env.development) {
92
+ if (api.env === import_bundler_webpack.Env.development) {
93
93
  if (buildOnly) {
94
94
  return memo;
95
95
  }
@@ -114,9 +114,9 @@ var legacy_default = (api) => {
114
114
  "Manual configuration of legacy mode is not supported."
115
115
  );
116
116
  }
117
- memo.srcTranspiler = import_types.Transpiler.babel;
118
- memo.jsMinifier = import_types.JSMinifier.terser;
119
- memo.cssMinifier = import_types.CSSMinifier.cssnano;
117
+ memo.srcTranspiler = import_bundler_webpack.Transpiler.babel;
118
+ memo.jsMinifier = import_bundler_webpack.JSMinifier.terser;
119
+ memo.cssMinifier = import_bundler_webpack.CSSMinifier.cssnano;
120
120
  const ieTarget = ((_a = userConfig.targets) == null ? void 0 : _a.ie) || ((_b = api.config.targets) == null ? void 0 : _b.ie) || 11;
121
121
  memo.targets = {
122
122
  ...userConfig.targets,
@@ -5,5 +5,5 @@ export interface IOpts {
5
5
  defaultToLib: Record<string, string>;
6
6
  namespaceToLib: Record<string, string>;
7
7
  }
8
- declare const _default: (api: IApi) => void;
9
8
  export default _default;
9
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -40,7 +40,8 @@ function createMockMiddleware(opts) {
40
40
  const method = req.method.toUpperCase();
41
41
  for (const key of Object.keys(opts.context.mockData)) {
42
42
  const mock = opts.context.mockData[key];
43
- if (mock.method !== method) continue;
43
+ if (mock.method !== method)
44
+ continue;
44
45
  const { keys, re } = getPathReAndKeys(mock.path);
45
46
  const m = re.exec(req.path);
46
47
  if (m) {
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -68,7 +68,8 @@ var redirect_default = (api) => {
68
68
  // APP_ROOT: https://github.com/umijs/umi/issues/9461
69
69
  cwd: useRootProject ? currentProjectRoot : (0, import_path.dirname)(currentProjectRoot)
70
70
  });
71
- if (!rootPkg) return memo;
71
+ if (!rootPkg)
72
+ return memo;
72
73
  const root = (0, import_path.dirname)(rootPkg);
73
74
  (0, import_assert.default)(
74
75
  (0, import_utils.isMonorepo)({ root }),
@@ -83,7 +84,8 @@ var redirect_default = (api) => {
83
84
  const usingDeps = collectPkgDeps(api.pkg).filter((name) => {
84
85
  return !exclude.some((reg) => reg.test(name));
85
86
  });
86
- if (!usingDeps.length) return memo;
87
+ if (!usingDeps.length)
88
+ return memo;
87
89
  const projects = await collectAllProjects({ root });
88
90
  const alias = usingDeps.reduce((obj, name) => {
89
91
  const pkgInfo = projects[name];
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -107,7 +107,8 @@ ${renderer}
107
107
  });
108
108
  });
109
109
  api.modifyEntry((memo) => {
110
- if ("umi" in memo) delete memo["umi"];
110
+ if ("umi" in memo)
111
+ delete memo["umi"];
111
112
  api.appData.mpa.entry.forEach((entry) => {
112
113
  memo[entry.name] = (0, import_path.join)(api.paths.absTmpPath, entry.tmpFilePath);
113
114
  });
@@ -176,10 +177,14 @@ async function collectEntry(root, opts, mountElementId) {
176
177
  );
177
178
  }
178
179
  function getIndexFile(dir) {
179
- if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.tsx"))) return (0, import_path.join)(dir, "index.tsx");
180
- if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.ts"))) return (0, import_path.join)(dir, "index.ts");
181
- if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.jsx"))) return (0, import_path.join)(dir, "index.jsx");
182
- if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.js"))) return (0, import_path.join)(dir, "index.js");
180
+ if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.tsx")))
181
+ return (0, import_path.join)(dir, "index.tsx");
182
+ if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.ts")))
183
+ return (0, import_path.join)(dir, "index.ts");
184
+ if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.jsx")))
185
+ return (0, import_path.join)(dir, "index.jsx");
186
+ if ((0, import_fs.existsSync)((0, import_path.join)(dir, "index.js")))
187
+ return (0, import_path.join)(dir, "index.js");
183
188
  return null;
184
189
  }
185
190
  async function getConfig(indexFile) {
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,4 +1,4 @@
1
1
  import type { IApi } from '../../types';
2
2
  export declare function getOverridesCSS(absSrcPath: string): string | undefined;
3
- declare const _default: (api: IApi) => void;
4
3
  export default _default;
4
+ declare function _default(api: IApi): void;
@@ -38,7 +38,8 @@ var overrides_default = (api) => {
38
38
  if (api.appData.overridesCSS.length) {
39
39
  const filePath = api.appData.overridesCSS[0];
40
40
  let content = (0, import_fs.readFileSync)(filePath, "utf-8");
41
- if (content === cachedContent) return;
41
+ if (content === cachedContent)
42
+ return;
42
43
  const subPath = "core/overrides.css";
43
44
  const targetPath = (0, import_path.join)(api.paths.absTmpPath, subPath);
44
45
  const isLess = filePath.endsWith(".less");
@@ -43,8 +43,10 @@ async function transform(cssContent, filePath) {
43
43
  let origin = atRule.params;
44
44
  origin = origin.replace(/^url\((.+)\)$/g, "$1");
45
45
  origin = origin.replace(/^'(.+)'$/g, "$1").replace(/^"(.+)"$/g, "$1");
46
- if (origin.startsWith("~")) return;
47
- if (origin.startsWith("/")) return;
46
+ if (origin.startsWith("~"))
47
+ return;
48
+ if (origin.startsWith("/"))
49
+ return;
48
50
  function getResolvedPath(origin2) {
49
51
  return (0, import_utils.winPath)(import_path.default.resolve(import_path.default.dirname(filePath), origin2));
50
52
  }
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -57,10 +57,14 @@ var phantomDependency_default = (api) => {
57
57
  const importsBySource = /* @__PURE__ */ new Map();
58
58
  for (const file of files) {
59
59
  const winP = (0, import_utils.winPath)(file);
60
- if (winP.includes(".umi/")) continue;
61
- if (winP.includes("/node_modules/")) continue;
62
- if (winP.startsWith("../")) continue;
63
- if (import_path.default.isAbsolute(file)) continue;
60
+ if (winP.includes(".umi/"))
61
+ continue;
62
+ if (winP.includes("/node_modules/"))
63
+ continue;
64
+ if (winP.startsWith("../"))
65
+ continue;
66
+ if (import_path.default.isAbsolute(file))
67
+ continue;
64
68
  const { imports } = result.metafile.inputs[file];
65
69
  for (const imp of imports) {
66
70
  if (imp.kind === "import-statement" && imp.external) {
@@ -73,17 +77,27 @@ var phantomDependency_default = (api) => {
73
77
  }
74
78
  const phantomDeps = [];
75
79
  for (const [source, files2] of importsBySource) {
76
- if (source.startsWith("<")) continue;
77
- if (source.startsWith(".")) continue;
78
- if (source.startsWith("/")) continue;
79
- if (source.startsWith("@/") || source.startsWith("@@/")) continue;
80
+ if (source.startsWith("<"))
81
+ continue;
82
+ if (source.startsWith("."))
83
+ continue;
84
+ if (source.startsWith("/"))
85
+ continue;
86
+ if (source.startsWith("@/") || source.startsWith("@@/"))
87
+ continue;
80
88
  const pkgName = getPkgName(source);
81
- if ((_a = api.config.phantomDependency.exclude) == null ? void 0 : _a.includes(pkgName)) continue;
82
- if ((_b = api.pkg.dependencies) == null ? void 0 : _b[pkgName]) continue;
83
- if ((_c = api.pkg.devDependencies) == null ? void 0 : _c[pkgName]) continue;
84
- if ((_d = api.pkg.clientDependencies) == null ? void 0 : _d[pkgName]) continue;
85
- if (matchAlias(source, api.config.alias || {})) continue;
86
- if (matchExternals(source, api.config.externals || {})) continue;
89
+ if ((_a = api.config.phantomDependency.exclude) == null ? void 0 : _a.includes(pkgName))
90
+ continue;
91
+ if ((_b = api.pkg.dependencies) == null ? void 0 : _b[pkgName])
92
+ continue;
93
+ if ((_c = api.pkg.devDependencies) == null ? void 0 : _c[pkgName])
94
+ continue;
95
+ if ((_d = api.pkg.clientDependencies) == null ? void 0 : _d[pkgName])
96
+ continue;
97
+ if (matchAlias(source, api.config.alias || {}))
98
+ continue;
99
+ if (matchExternals(source, api.config.externals || {}))
100
+ continue;
87
101
  phantomDeps.push(source);
88
102
  import_utils.logger.error(
89
103
  `[phantomDependency] ${import_utils.chalk.red(
@@ -104,7 +118,8 @@ var phantomDependency_default = (api) => {
104
118
  });
105
119
  function getPkgName(source) {
106
120
  const arr = source.split("/");
107
- if (source.startsWith("@")) return arr[0] + "/" + arr[1];
121
+ if (source.startsWith("@"))
122
+ return arr[0] + "/" + arr[1];
108
123
  return arr[0];
109
124
  }
110
125
  function matchAlias(source, alias) {
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -53,10 +53,14 @@ async function resolve(context, path2) {
53
53
  }
54
54
  function sortByAffix(opts) {
55
55
  return opts.keys.sort((a, b) => {
56
- if (a.endsWith(opts.affix) && b.endsWith(opts.affix)) return 0;
57
- if (a.endsWith(opts.affix)) return -1;
58
- if (b.endsWith(opts.affix)) return 1;
59
- else return 0;
56
+ if (a.endsWith(opts.affix) && b.endsWith(opts.affix))
57
+ return 0;
58
+ if (a.endsWith(opts.affix))
59
+ return -1;
60
+ if (b.endsWith(opts.affix))
61
+ return 1;
62
+ else
63
+ return 0;
60
64
  });
61
65
  }
62
66
  function addSlashAffix(key) {
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -53,7 +53,8 @@ var prepare_default = (api) => {
53
53
  if (api.appData.framework === "vue") {
54
54
  return;
55
55
  }
56
- if (!isFirstTime) return;
56
+ if (!isFirstTime)
57
+ return;
57
58
  if (api.appData.bundler !== "utoopack") {
58
59
  import_utils.logger.info("Preparing...");
59
60
  }
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -1,3 +1,3 @@
1
1
  import { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -30,7 +30,8 @@ function getReactCompilerConfig(api) {
30
30
  return api.userConfig.reactCompiler === true ? {} : api.userConfig.reactCompiler || {};
31
31
  }
32
32
  const forgetConfig = api.userConfig.forget;
33
- if (forgetConfig === true) return {};
33
+ if (forgetConfig === true)
34
+ return {};
34
35
  return (forgetConfig == null ? void 0 : forgetConfig.ReactCompilerConfig) || {};
35
36
  }
36
37
  function resolveReactCompilerPlugin(api) {
@@ -55,7 +56,8 @@ var reactCompiler_default = (api) => {
55
56
  }
56
57
  },
57
58
  enableBy: ({ userConfig }) => {
58
- if (userConfig.reactCompiler === false) return false;
59
+ if (userConfig.reactCompiler === false)
60
+ return false;
59
61
  return "reactCompiler" in userConfig || "forget" in userConfig;
60
62
  }
61
63
  });
@@ -70,11 +72,6 @@ var reactCompiler_default = (api) => {
70
72
  `reactCompiler is not compatible with mako, please disable mako first.`
71
73
  );
72
74
  }
73
- if (api.config.utoopack) {
74
- throw new Error(
75
- `reactCompiler is not compatible with utoopack, please disable utoopack first.`
76
- );
77
- }
78
75
  });
79
76
  api.onCheck(() => {
80
77
  const reactMajorVersion = Number(api.appData.react.version.split(".")[0]);
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -17,5 +17,5 @@ export interface IRouteChunkFilesMap {
17
17
  */
18
18
  r: Record<string, number[]>;
19
19
  }
20
- declare const _default: (api: IApi) => void;
21
20
  export default _default;
21
+ declare function _default(api: IApi): void;
@@ -62,7 +62,8 @@ async function getRouteChunkFilesMap(chunks, opts) {
62
62
  const pickPreloadFiles = (files) => files.filter((f) => f.endsWith(".js") || f.endsWith(".css"));
63
63
  const routeFileResolveCache = {};
64
64
  for (const chunk of chunks) {
65
- if (chunk.entry) continue;
65
+ if (chunk.entry)
66
+ continue;
66
67
  const pickedFiles = pickPreloadFiles(chunk.files);
67
68
  const routeOrigins = (chunk.origins || []).filter(
68
69
  (origin) => {
@@ -104,7 +105,8 @@ async function getRoutePathFilesMap(routes, fileChunksMap, opts) {
104
105
  const { resolver, absPagesPath } = opts;
105
106
  const routeFilesMap = {};
106
107
  for (const route of Object.values(routes)) {
107
- if (!route.file) continue;
108
+ if (!route.file)
109
+ continue;
108
110
  if (!((_a = route.absPath) == null ? void 0 : _a.startsWith("/"))) {
109
111
  import_utils.logger.error(
110
112
  `[routePreloadOnLoad]: route absPath error, cannot preload for ${route.absPath}`
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -38,7 +38,7 @@ function hashString(str) {
38
38
  return hash;
39
39
  }
40
40
  function getClassNames(code, filename) {
41
- const { exports: exports2 } = import_parcelCSS.parcelCSS.transform({
41
+ const { exports } = import_parcelCSS.parcelCSS.transform({
42
42
  filename,
43
43
  code,
44
44
  minify: false,
@@ -48,7 +48,7 @@ function getClassNames(code, filename) {
48
48
  dashedIdents: false
49
49
  }
50
50
  });
51
- return Object.keys(exports2 || {});
51
+ return Object.keys(exports || {});
52
52
  }
53
53
  function cssLoader(opts) {
54
54
  return {
@@ -1 +1,2 @@
1
+ import { IApi } from 'umi';
1
2
  export declare const build: (api: IApi) => Promise<void>;
@@ -32,7 +32,7 @@ __export(mako_exports, {
32
32
  build: () => build
33
33
  });
34
34
  module.exports = __toCommonJS(mako_exports);
35
- var import_types = require("@umijs/bundler-webpack/dist/types");
35
+ var import_bundler_webpack = require("@umijs/bundler-webpack");
36
36
  var import_utils = require("@umijs/utils");
37
37
  var import_lodash = require("@umijs/utils/compiled/lodash");
38
38
  var import_fs = require("fs");
@@ -44,7 +44,7 @@ var build = async (api) => {
44
44
  const absOutputFile = (0, import_utils2.absServerBuildPath)(api);
45
45
  require("@umijs/bundler-webpack/dist/requireHook");
46
46
  const { build: build2 } = require(process.env.OKAM);
47
- const useHash = api.config.hash && api.env === import_types.Env.production;
47
+ const useHash = api.config.hash && api.env === import_bundler_webpack.Env.production;
48
48
  const publicPath = api.userConfig.publicPath || "/";
49
49
  const entry = import_path.default.resolve(api.paths.absTmpPath, "umi.server.ts");
50
50
  const options = {
@@ -1,3 +1,3 @@
1
1
  import type { IApi } from '../../types';
2
- declare const _default: (api: IApi) => void;
3
2
  export default _default;
3
+ declare function _default(api: IApi): void;
@@ -32,7 +32,7 @@ __export(ssr_exports, {
32
32
  default: () => ssr_default
33
33
  });
34
34
  module.exports = __toCommonJS(ssr_exports);
35
- var import_types = require("@umijs/core/dist/types");
35
+ var import_core = require("@umijs/core");
36
36
  var import_utils = require("@umijs/utils");
37
37
  var import_assert = __toESM(require("assert"));
38
38
  var import_fs = require("fs");
@@ -70,7 +70,7 @@ var ssr_default = (api) => {
70
70
  }).deepPartial();
71
71
  }
72
72
  },
73
- enableBy: import_types.EnableBy.config
73
+ enableBy: import_core.EnableBy.config
74
74
  });
75
75
  api.onCheck(() => {
76
76
  const reactVersion = parseInt(api.appData.react.version.split(".")[0], 10) || 0;
@@ -219,7 +219,8 @@ export type {
219
219
  }
220
220
  });
221
221
  api.onBuildComplete(async ({ err }) => {
222
- if (err) return;
222
+ if (err)
223
+ return;
223
224
  if (api.config.ssr.platform === "vercel") {
224
225
  const jsonFile = (0, import_path.join)(api.cwd, "vercel.json");
225
226
  const json = (0, import_fs.existsSync)(jsonFile) ? import_utils.fsExtra.readJSONSync(jsonFile) : {};