@umijs/preset-umi 4.0.19 → 4.0.21

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.
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -123,11 +106,11 @@ umi build --clean
123
106
  umi: (0, import_path.join)(api.paths.absTmpPath, "umi.ts")
124
107
  }
125
108
  });
126
- const opts = __spreadProps(__spreadValues({
109
+ const opts = {
127
110
  config: api.config,
128
111
  cwd: api.cwd,
129
- entry
130
- }, api.config.vite ? { modifyViteConfig } : { babelPreset, chainWebpack, modifyWebpackConfig }), {
112
+ entry,
113
+ ...api.config.vite ? { modifyViteConfig } : { babelPreset, chainWebpack, modifyWebpackConfig },
131
114
  beforeBabelPlugins,
132
115
  beforeBabelPresets,
133
116
  extraBabelPlugins,
@@ -140,7 +123,7 @@ umi build --clean
140
123
  });
141
124
  },
142
125
  clean: true
143
- });
126
+ };
144
127
  let stats;
145
128
  if (api.config.vite) {
146
129
  stats = await bundlerVite.build(opts);
@@ -154,12 +137,13 @@ umi build --clean
154
137
  });
155
138
  const { vite } = api.args;
156
139
  const markupArgs = await (0, import_getMarkupArgs.getMarkupArgs)({ api });
157
- const markup = await (0, import_server.getMarkup)(__spreadProps(__spreadValues({}, markupArgs), {
140
+ const markup = await (0, import_server.getMarkup)({
141
+ ...markupArgs,
158
142
  styles: markupArgs.styles.concat(api.config.vite ? [] : assetsMap["umi.css"] || []),
159
143
  scripts: (api.config.vite ? [] : assetsMap["umi.js"] || []).concat(markupArgs.scripts),
160
144
  esmScript: !!opts.config.esm || vite,
161
145
  path: "/"
162
- }));
146
+ });
163
147
  (0, import_fs.writeFileSync)((0, import_path.join)(api.paths.absOutputPath, "index.html"), markup, "utf-8");
164
148
  import_utils.logger.event("Build index.html");
165
149
  }
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -68,12 +51,13 @@ function createRouteMiddleware(opts) {
68
51
  stats,
69
52
  publicPath: opts.api.config.publicPath
70
53
  });
71
- const requestHandler = await (0, import_server.createRequestHandler)(__spreadProps(__spreadValues({}, markupArgs), {
54
+ const requestHandler = await (0, import_server.createRequestHandler)({
55
+ ...markupArgs,
72
56
  styles: markupArgs.styles.concat(assetsMap["umi.css"] || []),
73
57
  scripts: (assetsMap["umi.js"] || []).concat(markupArgs.scripts),
74
58
  esmScript: false,
75
59
  historyType: ((_a = opts.api.config.history) == null ? void 0 : _a.type) || "browser"
76
- }));
60
+ });
77
61
  requestHandler(req, res, next);
78
62
  };
79
63
  };
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -83,7 +66,7 @@ var DepBuilderInWorker = class {
83
66
  }
84
67
  async buildWithESBuild(opts) {
85
68
  var _a;
86
- const alias = __spreadValues({}, (_a = this.opts.depConfig.resolve) == null ? void 0 : _a.alias);
69
+ const alias = { ...(_a = this.opts.depConfig.resolve) == null ? void 0 : _a.alias };
87
70
  const externals = this.opts.depConfig.externals;
88
71
  const entryContent = (0, import_getESBuildEntry.getESBuildEntry)({ deps: opts.deps });
89
72
  const ENTRY_FILE = "esbuild-entry.js";
@@ -96,11 +79,12 @@ var DepBuilderInWorker = class {
96
79
  entry: {
97
80
  [`${import_mfsu.MF_VA_PREFIX}remoteEntry`]: entryPath
98
81
  },
99
- config: __spreadProps(__spreadValues({}, this.opts.depEsBuildConfig), {
82
+ config: {
83
+ ...this.opts.depEsBuildConfig,
100
84
  outputPath: tmpDir,
101
85
  alias,
102
86
  externals
103
- }),
87
+ },
104
88
  inlineStyle: true
105
89
  });
106
90
  import_utils.logger.event(`[mfsu] compiled with esbuild successfully in ${+new Date() - date} ms`);
@@ -116,9 +100,10 @@ var DepBuilderInWorker = class {
116
100
  };
117
101
  try {
118
102
  await this.writeMFFiles({ deps: opts.deps.map((d) => new import_dep.Dep(d)) });
119
- const newOpts = __spreadProps(__spreadValues({}, opts), {
103
+ const newOpts = {
104
+ ...opts,
120
105
  onBuildComplete
121
- });
106
+ };
122
107
  if (this.opts.buildDepWithESBuild) {
123
108
  await this.buildWithESBuild(newOpts);
124
109
  } else {
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -89,7 +72,7 @@ var dev_config_default = (api) => {
89
72
  umi: (0, import_path.join)(api.paths.absTmpPath, "umi.ts")
90
73
  }
91
74
  });
92
- const opts = __spreadProps(__spreadValues({
75
+ const opts = {
93
76
  config: api.config,
94
77
  pkg: api.pkg,
95
78
  cwd: api.cwd,
@@ -97,8 +80,8 @@ var dev_config_default = (api) => {
97
80
  entry,
98
81
  port: api.appData.port,
99
82
  host: api.appData.host,
100
- ip: api.appData.ip
101
- }, { babelPreset, chainWebpack, modifyWebpackConfig }), {
83
+ ip: api.appData.ip,
84
+ ...{ babelPreset, chainWebpack, modifyWebpackConfig },
102
85
  beforeBabelPlugins,
103
86
  beforeBabelPresets,
104
87
  extraBabelPlugins,
@@ -115,7 +98,7 @@ var dev_config_default = (api) => {
115
98
  ...MFSU_EAGER_DEFAULT_INCLUDE,
116
99
  ...((_c = api.config.mfsu) == null ? void 0 : _c.include) || []
117
100
  ])
118
- });
101
+ };
119
102
  return opts;
120
103
  }
121
104
  });
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -46,9 +32,10 @@ async function getBabelOpts(opts) {
46
32
  key: "modifyBabelPresetOpts",
47
33
  initialValue: {
48
34
  presetEnv: {},
49
- presetReact: __spreadValues({
50
- runtime: isGTEReact17 ? "automatic" : "classic"
51
- }, isGTEReact17 ? {} : { importSource: void 0 }),
35
+ presetReact: {
36
+ runtime: isGTEReact17 ? "automatic" : "classic",
37
+ ...isGTEReact17 ? {} : { importSource: void 0 }
38
+ },
52
39
  presetTypeScript: {},
53
40
  pluginTransformRuntime: {},
54
41
  pluginLockCoreJS: {},
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -57,12 +40,13 @@ function ViteHtmlPlugin(api) {
57
40
  api.appData.hasSrcDir ? "/src/.umi/umi.ts" : "/.umi/umi.ts"
58
41
  ];
59
42
  const markupArgs = await (0, import_getMarkupArgs.getMarkupArgs)({ api });
60
- const opts = __spreadProps(__spreadValues({}, markupArgs), {
43
+ const opts = {
44
+ ...markupArgs,
61
45
  esmScript: true,
62
46
  scripts: viteScripts.concat(markupArgs.scripts),
63
47
  historyType: ((_c = api.config.history) == null ? void 0 : _c.type) || "browser"
64
- });
65
- const html = await (0, import_server.getMarkup)(__spreadValues({}, opts));
48
+ };
49
+ const html = await (0, import_server.getMarkup)({ ...opts });
66
50
  res.setHeader("Content-Type", "text/html");
67
51
  res.end(await server.transformIndexHtml(req.url, html));
68
52
  } catch (e) {
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -50,9 +33,10 @@ function addUnWatch(unWatcher) {
50
33
  unWatches.push(unWatcher);
51
34
  }
52
35
  function watch(opts) {
53
- const watcher = import_utils.chokidar.watch(opts.path, __spreadProps(__spreadValues({}, opts.watchOpts), {
36
+ const watcher = import_utils.chokidar.watch(opts.path, {
37
+ ...opts.watchOpts,
54
38
  ignoreInitial: true
55
- }));
39
+ });
56
40
  watcher.on("all", opts.onChange);
57
41
  if (opts.addToUnWatches) {
58
42
  addUnWatch(() => {
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -73,11 +56,12 @@ var jest_default = (api) => {
73
56
  typescript: "^4",
74
57
  "ts-node": "^10"
75
58
  };
76
- const packageToInstall = res.willUseTLR ? __spreadProps(__spreadValues({}, basicDeps), {
59
+ const packageToInstall = res.willUseTLR ? {
60
+ ...basicDeps,
77
61
  "@testing-library/react": "^13",
78
62
  "@testing-library/jest-dom": "^5.16.4",
79
63
  "@types/testing-library__jest-dom": "^5.14.5"
80
- }) : basicDeps;
64
+ } : basicDeps;
81
65
  h.addDevDeps(packageToInstall);
82
66
  h.addScript("test", "jest");
83
67
  const setupImports = res.willUseTLR ? [
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -86,11 +69,17 @@ var GeneratorHelper = class {
86
69
  const { api } = this;
87
70
  const externalDeps = import_utils.lodash.omit(deps, ["@umijs/plugins"]);
88
71
  if (this.needInstallUmiPlugin) {
89
- api.pkg.devDependencies = __spreadValues(__spreadValues({}, api.pkg.devDependencies), deps);
72
+ api.pkg.devDependencies = {
73
+ ...api.pkg.devDependencies,
74
+ ...deps
75
+ };
90
76
  (0, import_fs.writeFileSync)(api.pkgPath, JSON.stringify(api.pkg, null, 2));
91
77
  import_utils.logger.info("Write package.json");
92
78
  } else if (!import_utils.lodash.isEmpty(externalDeps)) {
93
- api.pkg.devDependencies = __spreadValues(__spreadValues({}, api.pkg.devDependencies), externalDeps);
79
+ api.pkg.devDependencies = {
80
+ ...api.pkg.devDependencies,
81
+ ...externalDeps
82
+ };
94
83
  (0, import_fs.writeFileSync)(api.pkgPath, JSON.stringify(api.pkg, null, 2));
95
84
  import_utils.logger.info("Update package.json for devDependencies");
96
85
  }
@@ -115,9 +104,10 @@ var GeneratorHelper = class {
115
104
  if (((_a = api.pkg.scripts) == null ? void 0 : _a[name]) && ((_b = api.pkg.scripts) == null ? void 0 : _b[name]) !== cmd) {
116
105
  import_utils.logger.warn(`scripts.${name} = "${(_c = api.pkg.scripts) == null ? void 0 : _c[name]}" already exists, will be overwritten with "${cmd}"!`);
117
106
  }
118
- api.pkg.scripts = __spreadProps(__spreadValues({}, api.pkg.scripts), {
107
+ api.pkg.scripts = {
108
+ ...api.pkg.scripts,
119
109
  [name]: cmd
120
- });
110
+ };
121
111
  }
122
112
  appendGitIgnore(patterns) {
123
113
  const { api } = this;
@@ -142,9 +132,10 @@ ${toAppend}`);
142
132
  }
143
133
  async ensureVariableWithQuestion(v, question) {
144
134
  if (!v) {
145
- const res = await promptsExitWhenCancel(__spreadProps(__spreadValues({}, question), {
135
+ const res = await promptsExitWhenCancel({
136
+ ...question,
146
137
  name: "variable"
147
- }));
138
+ });
148
139
  return res.variable ? res.variable : question.initial;
149
140
  }
150
141
  return v;
@@ -158,11 +149,12 @@ function getUmiJsPlugin() {
158
149
  return umijsPluginVersion;
159
150
  }
160
151
  function promptsExitWhenCancel(questions, options) {
161
- return (0, import_utils.prompts)(questions, __spreadProps(__spreadValues({}, options), {
152
+ return (0, import_utils.prompts)(questions, {
153
+ ...options,
162
154
  onCancel: () => {
163
155
  process.exit(1);
164
156
  }
165
- }));
157
+ });
166
158
  }
167
159
  function trim(s) {
168
160
  return (s == null ? void 0 : s.trim()) || "";
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __objRest = (source, exclude) => {
10
- var target = {};
11
- for (var prop in source)
12
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
13
- target[prop] = source[prop];
14
- if (source != null && __getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(source)) {
16
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
17
- target[prop] = source[prop];
18
- }
19
- return target;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -57,8 +43,7 @@ var check_default = (api) => {
57
43
  }
58
44
  });
59
45
  });
60
- api.onCheckCode((_a) => {
61
- var _b = _a, { CodeFrameError } = _b, args = __objRest(_b, ["CodeFrameError"]);
46
+ api.onCheckCode(({ CodeFrameError, ...args }) => {
62
47
  if (["cnpm", "tnpm"].includes(api.appData.npmClient)) {
63
48
  args.imports.forEach(({ source, loc }) => {
64
49
  if (!isAbsolutePath(source) && /@\d/.test(source)) {
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -66,23 +49,25 @@ var configPlugins_default = (api) => {
66
49
  const reactDOMVersion = require((0, import_path.join)(reactDOMPath, "package.json")).version;
67
50
  const isLT18 = !reactDOMVersion.startsWith("18.");
68
51
  const configDefaults = {
69
- alias: __spreadProps(__spreadValues({
52
+ alias: {
70
53
  umi: "@@/exports",
71
54
  react: resolveProjectDep({
72
55
  pkg: api.pkg,
73
56
  cwd: api.cwd,
74
57
  dep: "react"
75
- }) || (0, import_path.dirname)(require.resolve("react/package.json"))
76
- }, isLT18 ? {
77
- "react-dom/client": reactDOMPath
78
- } : {}), {
58
+ }) || (0, import_path.dirname)(require.resolve("react/package.json")),
59
+ ...isLT18 ? {
60
+ "react-dom/client": reactDOMPath
61
+ } : {},
79
62
  "react-dom": reactDOMPath,
80
63
  "react-router": (0, import_path.dirname)(require.resolve("react-router/package.json")),
81
64
  "react-router-dom": (0, import_path.dirname)(require.resolve("react-router-dom/package.json"))
82
- }),
83
- externals: __spreadValues({}, isLT18 && ((_a = userConfig.externals) == null ? void 0 : _a["react-dom"]) ? {
84
- "react-dom/client": userConfig.externals["react-dom"]
85
- } : {}),
65
+ },
66
+ externals: {
67
+ ...isLT18 && ((_a = userConfig.externals) == null ? void 0 : _a["react-dom"]) ? {
68
+ "react-dom/client": userConfig.externals["react-dom"]
69
+ } : {}
70
+ },
86
71
  autoCSSModules: true,
87
72
  publicPath: "/",
88
73
  mountElementId: "root",
@@ -92,7 +77,10 @@ var configPlugins_default = (api) => {
92
77
  };
93
78
  const bundleSchemas = api.config.vite ? (0, import_schema.getSchemas)() : (0, import_schema2.getSchemas)();
94
79
  const extraSchemas = (0, import_schema3.getSchemas)();
95
- const schemas = __spreadValues(__spreadValues({}, bundleSchemas), extraSchemas);
80
+ const schemas = {
81
+ ...bundleSchemas,
82
+ ...extraSchemas
83
+ };
96
84
  for (const key of Object.keys(schemas)) {
97
85
  const config = {
98
86
  schema: schemas[key] || ((Joi) => Joi.any())
@@ -109,10 +97,11 @@ var configPlugins_default = (api) => {
109
97
  ]);
110
98
  }
111
99
  api.modifyConfig((memo, args) => {
112
- memo.alias = __spreadProps(__spreadValues({}, memo.alias), {
100
+ memo.alias = {
101
+ ...memo.alias,
113
102
  "@": args.paths.absSrcPath,
114
103
  "@@": args.paths.absTmpPath
115
- });
104
+ };
116
105
  return memo;
117
106
  });
118
107
  };
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -64,11 +50,12 @@ var devTool_default = (api) => {
64
50
  }
65
51
  if (shortPath === "bundle-status") {
66
52
  const isMFSUEnable = api.config.mfsu !== false;
67
- return res.json(__spreadValues({
68
- bundleStatus: api.appData.bundleStatus
69
- }, isMFSUEnable && !enableVite ? {
70
- mfsuBundleStatus: api.appData.mfsuBundleStatus
71
- } : {}));
53
+ return res.json({
54
+ bundleStatus: api.appData.bundleStatus,
55
+ ...isMFSUEnable && !enableVite ? {
56
+ mfsuBundleStatus: api.appData.mfsuBundleStatus
57
+ } : {}
58
+ });
72
59
  }
73
60
  if (shortPath === "status") {
74
61
  const isMFSUDone = api.config.mfsu ? (_a = api.appData.mfsuBundleStatus) == null ? void 0 : _a.done : true;
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -80,9 +63,10 @@ var legacy_default = (api) => {
80
63
  memo.srcTranspiler = import_types.Transpiler.babel;
81
64
  memo.jsMinifier = import_types.JSMinifier.terser;
82
65
  memo.cssMinifier = import_types.CSSMinifier.cssnano;
83
- memo.targets = __spreadProps(__spreadValues({}, userConfig.targets), {
66
+ memo.targets = {
67
+ ...userConfig.targets,
84
68
  ie: 11
85
- });
69
+ };
86
70
  import_utils.logger.ready(`${import_utils.chalk.cyan("legacy")} mode is enabled, we automatically modify the ${[
87
71
  "srcTranspiler",
88
72
  "jsMinifier",
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -90,7 +76,10 @@ var redirect_default = (api) => {
90
76
  });
91
77
  return obj;
92
78
  }, {});
93
- memo.alias = __spreadValues(__spreadValues({}, memo.alias), alias);
79
+ memo.alias = {
80
+ ...memo.alias,
81
+ ...alias
82
+ };
94
83
  return memo;
95
84
  });
96
85
  };
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -144,14 +127,14 @@ async function collectEntry(root, opts) {
144
127
  const indexFile = getIndexFile(absDir);
145
128
  if (indexFile) {
146
129
  const config = opts.getConfigFromEntryFile ? await getConfigFromEntryFile(indexFile) : await getConfig(indexFile);
147
- memo.push(__spreadProps(__spreadValues({
130
+ memo.push({
148
131
  name: dir,
149
132
  file: indexFile,
150
133
  tmpFilePath: `mpa/${dir}${(0, import_path.extname)(indexFile)}`,
151
- mountElementId: "root"
152
- }, config), {
134
+ mountElementId: "root",
135
+ ...config,
153
136
  title: config.title || dir
154
- }));
137
+ });
155
138
  }
156
139
  }
157
140
  return memo;
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -67,12 +50,12 @@ var lessLoader = (opts) => {
67
50
  const filename = (0, import_path.basename)(args.path);
68
51
  const relFilename = (0, import_utils.winPath)(args.path).replace((0, import_css_loader.ensureLastSlash)((0, import_utils.winPath)(opts.cwd)), "");
69
52
  try {
70
- const result = await import_less.default.render(content, __spreadProps(__spreadValues({
53
+ const result = await import_less.default.render(content, {
71
54
  filename,
72
- rootpath: dir
73
- }, lessOptions), {
55
+ rootpath: dir,
56
+ ...lessOptions,
74
57
  paths: [...lessOptions.paths || [], dir]
75
- }));
58
+ });
76
59
  const classNames = (0, import_css_loader.getClassNames)(Buffer.from(result.css), filename).sort();
77
60
  const cssModuleObject = classNames.reduce((memo, key) => {
78
61
  memo[key] = `${key}___${(0, import_css_loader.hashString)(`${relFilename}@${key}`)}`;
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -131,8 +114,10 @@ export default function handler(request, response) {
131
114
  api.modifyWebpackConfig((config) => {
132
115
  var _a;
133
116
  config.plugins.push(new ProcessAssetsPlugin());
134
- config.optimization = __spreadProps(__spreadValues({}, config.optimization), {
135
- splitChunks: __spreadProps(__spreadValues({}, (_a = config.optimization) == null ? void 0 : _a.splitChunks), {
117
+ config.optimization = {
118
+ ...config.optimization,
119
+ splitChunks: {
120
+ ...(_a = config.optimization) == null ? void 0 : _a.splitChunks,
136
121
  cacheGroups: {
137
122
  styles: {
138
123
  name: "umi",
@@ -143,8 +128,8 @@ export default function handler(request, response) {
143
128
  enforce: true
144
129
  }
145
130
  }
146
- })
147
- });
131
+ }
132
+ };
148
133
  return config;
149
134
  });
150
135
  };
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -55,7 +41,10 @@ var configTypes_default = (api) => {
55
41
  return {
56
42
  [key]: schema
57
43
  };
58
- }).reduce((acc, curr) => __spreadValues(__spreadValues({}, acc), curr), {});
44
+ }).reduce((acc, curr) => ({
45
+ ...acc,
46
+ ...curr
47
+ }), {});
59
48
  const interfaceName = "IConfigFromPlugins";
60
49
  const content = await (0, import_joi2types.default)(import_joi.default.object(properties), {
61
50
  interfaceName,
@@ -61,6 +61,9 @@ async function getRoutes(opts) {
61
61
  routes = (0, import_core.getConfigRoutes)({
62
62
  routes: opts.api.config.routes,
63
63
  onResolveComponent(component) {
64
+ if ((0, import_path.isAbsolute)(component)) {
65
+ return component;
66
+ }
64
67
  if (component.startsWith("@/")) {
65
68
  component = component.replace("@/", "../");
66
69
  }
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -62,10 +45,11 @@ function babelPlugin_default() {
62
45
  const filename = (0, import_utils.winPath)(state.opts.filename);
63
46
  if (cache.has(filename) && !filename.includes("bundler-webpack/client") && !filename.startsWith((0, import_utils.winPath)((0, import_path.join)(opts.cwd, "node_modules")))) {
64
47
  opts.onCheckCode({
65
- args: __spreadProps(__spreadValues({}, cache.get(state.opts.filename)), {
48
+ args: {
49
+ ...cache.get(state.opts.filename),
66
50
  file: state.opts.filename,
67
51
  isFromTmp: state.opts.filename.startsWith(opts.absTmpPath)
68
- })
52
+ }
69
53
  });
70
54
  }
71
55
  },
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -60,9 +43,10 @@ var transform_default = (api) => {
60
43
  try {
61
44
  api.applyPlugins({
62
45
  key: "onCheckCode",
63
- args: __spreadProps(__spreadValues({}, args), {
46
+ args: {
47
+ ...args,
64
48
  CodeFrameError: import_CodeFrameError.default
65
- }),
49
+ },
66
50
  sync: true
67
51
  });
68
52
  } catch (err) {
@@ -1,24 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
5
  var __export = (target, all) => {
23
6
  for (var name in all)
24
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -65,9 +48,10 @@ var vite_default = (api) => {
65
48
  });
66
49
  api.modifyViteConfig((memo) => {
67
50
  var _a, _b;
68
- memo.optimizeDeps = __spreadProps(__spreadValues({}, memo.optimizeDeps || {}), {
51
+ memo.optimizeDeps = {
52
+ ...memo.optimizeDeps || {},
69
53
  include: (_b = (_a = memo.optimizeDeps) == null ? void 0 : _a.include) == null ? void 0 : _b.concat(Object.values(api.appData.deps).map(({ matches }) => matches[0]).filter((item) => (item == null ? void 0 : item.startsWith("@fs")) && !(item == null ? void 0 : item.includes("node_modules"))))
70
- });
54
+ };
71
55
  return memo;
72
56
  });
73
57
  let buildStats;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { UmiApiRequest, UmiApiResponse } from './features/apiRoute';
2
2
  export type { IApi, IConfig, IRoute, webpack } from './types';
3
3
  declare const _default: () => {
4
- plugins: string[];
4
+ plugins: (string | false)[];
5
5
  };
6
6
  export default _default;
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var src_default = () => {
29
29
  return {
30
30
  plugins: [
31
31
  require.resolve("./registerMethods"),
32
- require.resolve("@umijs/did-you-know/dist/plugin"),
32
+ process.env.DID_YOU_KNOW !== "none" && require.resolve("@umijs/did-you-know/dist/plugin"),
33
33
  require.resolve("./features/404/404"),
34
34
  require.resolve("./features/appData/appData"),
35
35
  require.resolve("./features/check/check"),
@@ -77,7 +77,7 @@ var src_default = () => {
77
77
  require.resolve("./commands/verify-commit"),
78
78
  require.resolve("./commands/preview"),
79
79
  require.resolve("@umijs/plugin-run")
80
- ]
80
+ ].filter(Boolean)
81
81
  };
82
82
  };
83
83
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,26 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
26
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -78,7 +61,7 @@ var AutoUpdateSrcCodeCache = class {
78
61
  },
79
62
  onCacheUpdate: (_cache, events) => {
80
63
  const merged = this.getMergedCode();
81
- const info = __spreadProps(__spreadValues({}, merged), { events });
64
+ const info = { ...merged, events };
82
65
  this.listeners.forEach((l) => l(info));
83
66
  }
84
67
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.0.19",
3
+ "version": "4.0.21",
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",
@@ -26,19 +26,19 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@types/multer": "1.4.7",
29
- "@umijs/ast": "4.0.19",
30
- "@umijs/babel-preset-umi": "4.0.19",
31
- "@umijs/bundler-utils": "4.0.19",
32
- "@umijs/bundler-vite": "4.0.19",
33
- "@umijs/bundler-webpack": "4.0.19",
34
- "@umijs/core": "4.0.19",
29
+ "@umijs/ast": "4.0.21",
30
+ "@umijs/babel-preset-umi": "4.0.21",
31
+ "@umijs/bundler-utils": "4.0.21",
32
+ "@umijs/bundler-vite": "4.0.21",
33
+ "@umijs/bundler-webpack": "4.0.21",
34
+ "@umijs/core": "4.0.21",
35
35
  "@umijs/did-you-know": "^1.0.0",
36
- "@umijs/history": "5.3.0",
37
- "@umijs/mfsu": "4.0.19",
38
- "@umijs/plugin-run": "4.0.19",
39
- "@umijs/renderer-react": "4.0.19",
40
- "@umijs/server": "4.0.19",
41
- "@umijs/utils": "4.0.19",
36
+ "@umijs/history": "5.3.1",
37
+ "@umijs/mfsu": "4.0.21",
38
+ "@umijs/plugin-run": "4.0.21",
39
+ "@umijs/renderer-react": "4.0.21",
40
+ "@umijs/server": "4.0.21",
41
+ "@umijs/utils": "4.0.21",
42
42
  "click-to-react-component": "^1.0.8",
43
43
  "core-js": "3.22.4",
44
44
  "current-script-polyfill": "1.0.0",
@@ -14,15 +14,23 @@ export function createHistory(opts: any) {
14
14
  if (opts.basename) {
15
15
  basename = opts.basename;
16
16
  }
17
- history = h;
18
- const oldPush = h.push;
19
- history.push = (to, state) => {
20
- oldPush(patchTo(to), state);
21
- };
22
- const oldReplace = h.replace;
23
- history.replace = (to, state) => {
24
- oldReplace(patchTo(to), state);
25
- };
17
+
18
+ history = {
19
+ ...h,
20
+ push(to, state) {
21
+ h.push(patchTo(to), state);
22
+ },
23
+ replace(to, state) {
24
+ h.replace(patchTo(to), state);
25
+ },
26
+ get location() {
27
+ return h.location;
28
+ },
29
+ get action() {
30
+ return h.action;
31
+ }
32
+ }
33
+
26
34
  return h;
27
35
  }
28
36