@umijs/preset-umi 4.3.0 → 4.3.2

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.
@@ -150,10 +150,46 @@
150
150
  background-position-x: -340px !important;
151
151
  }
152
152
  </style>
153
+ <style data-mako>
154
+ #loading[data-mako]::after {
155
+ position: absolute;
156
+ top: 0;
157
+ left: 64px;
158
+ content: '';
159
+ width: 20px;
160
+ height: 22px;
161
+ background: center / 20px 22px;
162
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAuCAMAAABteatCAAABKVBMVEUAAAADAgAAAAAAAAAAAAAAAAAAAAAIBwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMCgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASDwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+2SgAAAD81ycWEwPxzSXOsCBBOAoqIwbjwiOWgBd2ZBJdTw741Ca1mhyhihlHPAswKQcbFwT00CbgvyLWtyG5nh2GchV7aRNYSw1VSA3zzybpxyTmxCTLrR+QehaMdxZvXxFmVxBjVQ85MQglIAXqxyTSsyG/ox6zmRyrkhqpkBqmjhqdhhiBbhRQRAxMQQyKBhJVAAAAM3RSTlMA/vrcEO3F/nA4BvfUqYx4aFAjBP7x6uOugCEdCrSllohUSj0yLRQC/se/k2FWJ7qamFjVvxppAAAB4klEQVQ4y42U10IaQRhG2QVBAaVIMxQNCthT9iwdkSoEEkss6e39HyIaQ4Zhdjee63PxH/h2XCqF4EbU9QQ8bsAb9vxXzNI7iYGeivgdvQ12h8ag09VgaXPF3sujjYwHzq96gNvu3OgSY2PGx1bf7txMkJ+mITBHNufmuKsYMm//nit5y8TODJXzKWTnvW2dL4YFpz5y63NeOkHLyvum8ao05/m91EwLr6mxJR24Sf+DhTeGkOQd4ruw8FpoYcnbCfBd1cwb9CPJKya5Vr32lEBe8kovuG0r3qBLfNslsUW5oXiVWxI7shdB+6R473okj2XvOM6l4g3vYK24OJmJGlK93gU9e5QRYor6wLCg/fWXBvGXs54QmjQZ6c5LMfOCDuX3VcOOsz8z3wvfjyYUBOrjhp1qXgHux//vIAFarVOx8honGkvLsz2u51cD4JucLg6t8sZHYM0jvRCH+yyeazbLsPrMtUg6lISm8D7XwWv5CBTitMRPXgN3xGVFOsnEVBpUPEFqbdGgiwYZ/z71itqgkqM/fPyO1QZ5vLHqv4bnLlvCaCO1QSWi0bl/kUSDDSsBfqgNKtEEN2qDStFN90JpUMnsUZ4+NPidvVIKUBtUDkA0OBBCNDjxWjQ4o4sGR34DhGGszb2iUaMAAAAASUVORK5CYII=');
163
+ animation: fade-in-out alternate infinite 1s;
164
+ }
165
+
166
+ #loading[data-mako] small::after {
167
+ content: 'Umi with Mako';
168
+ }
169
+
170
+ #loading[data-mako] .loader {
171
+ position: fixed;
172
+ left: 0;
173
+ top: 0;
174
+ height: 5px;
175
+ width: 100vw;
176
+ --c:no-repeat linear-gradient(#1d90fe 0 0);
177
+ background: var(--c),var(--c),#cddeee;
178
+ background-size: 60% 100%;
179
+ animation: l16 3s infinite;
180
+ }
181
+
182
+ @keyframes l16 {
183
+ 0% {background-position:-150% 0,-150% 0}
184
+ 66% {background-position: 250% 0,-150% 0}
185
+ 100% {background-position: 250% 0, 250% 0}
186
+ }
187
+ </style>
153
188
  </head>
154
189
 
155
190
  <body>
156
191
  <div id="loading">
192
+ <div class="loader"></div>
157
193
  <h3>Bundling...</h3>
158
194
  <small></small>
159
195
  <p class="summary"></p>
@@ -180,6 +216,14 @@
180
216
  }
181
217
 
182
218
  function renderStatus(data) {
219
+ if (data.bundler === 'mako') {
220
+ loading.setAttribute('data-mako', '');
221
+ window.__MAKO_PERCENT = window.__MAKO_PERCENT || 0.1;
222
+ const makoPercent = Math.floor(window.__MAKO_PERCENT * 100);
223
+ loading.setAttribute('data-percent', makoPercent);
224
+ window.__MAKO_PERCENT = window.__MAKO_PERCENT >= 1 ? 0.2 : window.__MAKO_PERCENT + 0.1;
225
+ return;
226
+ }
183
227
  const hasMFSU = Boolean(data.mfsuBundleStatus);
184
228
  const hasProgressDetails = Boolean(
185
229
  data.bundleStatus.progresses[0].details,
@@ -34,23 +34,13 @@ __export(configPlugins_exports, {
34
34
  module.exports = __toCommonJS(configPlugins_exports);
35
35
  var import_schema = require("@umijs/bundler-vite/dist/schema");
36
36
  var import_schema2 = require("@umijs/bundler-webpack/dist/schema");
37
- var import_utils = require("@umijs/utils");
38
37
  var import_path = require("path");
38
+ var import_resolveProjectDep = require("../../utils/resolveProjectDep");
39
39
  var import_schema3 = require("./schema");
40
- function resolveProjectDep(opts) {
41
- var _a, _b;
42
- if (((_a = opts.pkg.dependencies) == null ? void 0 : _a[opts.dep]) || ((_b = opts.pkg.devDependencies) == null ? void 0 : _b[opts.dep])) {
43
- return (0, import_path.dirname)(
44
- import_utils.resolve.sync(`${opts.dep}/package.json`, {
45
- basedir: opts.cwd
46
- })
47
- );
48
- }
49
- }
50
40
  var configPlugins_default = (api) => {
51
41
  var _a;
52
42
  const { userConfig } = api;
53
- const reactDOMPath = resolveProjectDep({
43
+ const reactDOMPath = (0, import_resolveProjectDep.resolveProjectDep)({
54
44
  pkg: api.pkg,
55
45
  cwd: api.cwd,
56
46
  dep: "react-dom"
@@ -63,7 +53,7 @@ var configPlugins_default = (api) => {
63
53
  const configDefaults = {
64
54
  alias: {
65
55
  umi: "@@/exports",
66
- react: resolveProjectDep({
56
+ react: (0, import_resolveProjectDep.resolveProjectDep)({
67
57
  pkg: api.pkg,
68
58
  cwd: api.cwd,
69
59
  dep: "react"
@@ -29,8 +29,6 @@ var devToolAppDist = (0, import_path.join)(__dirname, "../../../devToolAppDist")
29
29
  var assetsDir = (0, import_path.join)(__dirname, "../../../assets");
30
30
  var devTool_default = (api) => {
31
31
  api.addBeforeMiddlewares(async () => {
32
- if (api.config.mako)
33
- return [];
34
32
  const $ = await api.applyPlugins({
35
33
  key: "modifyDevToolLoadingHTML",
36
34
  type: api.ApplyPluginsType.modify,
@@ -55,6 +53,7 @@ var devTool_default = (api) => {
55
53
  if (shortPath === "bundle-status") {
56
54
  const isMFSUEnable = api.config.mfsu !== false;
57
55
  return res.json({
56
+ bundler: api.appData.bundler,
58
57
  bundleStatus: api.appData.bundleStatus,
59
58
  ...isMFSUEnable && !enableVite ? {
60
59
  mfsuBundleStatus: api.appData.mfsuBundleStatus
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/features/forget/forget.ts
@@ -32,6 +22,8 @@ __export(forget_exports, {
32
22
  default: () => forget_default
33
23
  });
34
24
  module.exports = __toCommonJS(forget_exports);
25
+ var import_path = require("path");
26
+ var import_resolveProjectDep = require("../../utils/resolveProjectDep");
35
27
  var forget_default = (api) => {
36
28
  api.describe({
37
29
  key: "forget",
@@ -64,13 +56,23 @@ var forget_default = (api) => {
64
56
  );
65
57
  }
66
58
  });
59
+ const BABEL_PLUGIN_NAME = `babel-plugin-react-compiler`;
60
+ let libPath;
61
+ try {
62
+ libPath = (0, import_resolveProjectDep.resolveProjectDep)({
63
+ pkg: api.pkg,
64
+ cwd: api.cwd,
65
+ dep: BABEL_PLUGIN_NAME
66
+ }) || (0, import_path.dirname)(require.resolve(`${BABEL_PLUGIN_NAME}/package.json`));
67
+ } catch (e) {
68
+ }
67
69
  api.modifyConfig((memo) => {
68
70
  let ReactCompilerConfig = api.userConfig.forget.ReactCompilerConfig || {};
69
71
  return {
70
72
  ...memo,
71
73
  extraBabelPlugins: [
72
74
  ...memo.extraBabelPlugins || [],
73
- [require.resolve("babel-plugin-react-compiler"), ReactCompilerConfig]
75
+ [libPath, ReactCompilerConfig]
74
76
  ]
75
77
  };
76
78
  });
@@ -32,7 +32,6 @@ __export(mako_exports, {
32
32
  default: () => mako_default
33
33
  });
34
34
  module.exports = __toCommonJS(mako_exports);
35
- var import_utils = require("@umijs/utils");
36
35
  var import_path = __toESM(require("path"));
37
36
  var import_platform = require("../../utils/platform");
38
37
  var mako_default = (api) => {
@@ -46,7 +45,22 @@ var mako_default = (api) => {
46
45
  load: zod.function(),
47
46
  generateEnd: zod.function()
48
47
  }).partial()
49
- )
48
+ ),
49
+ px2rem: zod.object({
50
+ root: zod.number(),
51
+ propBlackList: zod.array(zod.string()),
52
+ propWhiteList: zod.array(zod.string()),
53
+ selectorBlackList: zod.array(zod.string()),
54
+ selectorWhiteList: zod.array(zod.string()),
55
+ selectorDoubleList: zod.array(zod.string())
56
+ }).partial(),
57
+ experimental: zod.object({
58
+ webpackSyntaxValidate: zod.array(zod.string())
59
+ }).partial(),
60
+ flexBugs: zod.boolean(),
61
+ optimization: zod.object({
62
+ skipModules: zod.boolean()
63
+ }).partial()
50
64
  }).partial();
51
65
  }
52
66
  },
@@ -75,12 +89,8 @@ var mako_default = (api) => {
75
89
  api.logger.info(`Using mako@${pkg.version}`);
76
90
  const isBigfish = process.env.BIGFISH_INFO;
77
91
  if (!isBigfish) {
78
- api.logger.warn(
79
- import_utils.chalk.yellow(
80
- import_utils.chalk.bold(
81
- `Mako is an extremely fast, production-grade web bundler based on Rust. And it's still under active development and is not yet ready for production use. If you encounter any issues, please checkout https://makojs.dev/ to join the community and report the issue.`
82
- )
83
- )
92
+ api.logger.info(
93
+ `Mako is an extremely fast, production-grade web bundler based on Rust. If you encounter any issues, please checkout https://makojs.dev/ to join the community and report the issue.`
84
94
  );
85
95
  }
86
96
  } catch (e) {
@@ -77,6 +77,7 @@ async function extractExports(opts) {
77
77
  },
78
78
  bundle: true,
79
79
  write: false,
80
+ logLevel: "error",
80
81
  entryPoints: [`${opts.entry}?entry`],
81
82
  plugins: [
82
83
  {
@@ -0,0 +1,5 @@
1
+ export declare function resolveProjectDep(opts: {
2
+ pkg: any;
3
+ cwd: string;
4
+ dep: string;
5
+ }): string | undefined;
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/utils/resolveProjectDep.ts
20
+ var resolveProjectDep_exports = {};
21
+ __export(resolveProjectDep_exports, {
22
+ resolveProjectDep: () => resolveProjectDep
23
+ });
24
+ module.exports = __toCommonJS(resolveProjectDep_exports);
25
+ var import_utils = require("@umijs/utils");
26
+ var import_path = require("path");
27
+ function resolveProjectDep(opts) {
28
+ var _a, _b;
29
+ if (((_a = opts.pkg.dependencies) == null ? void 0 : _a[opts.dep]) || ((_b = opts.pkg.devDependencies) == null ? void 0 : _b[opts.dep])) {
30
+ return (0, import_path.dirname)(
31
+ import_utils.resolve.sync(`${opts.dep}/package.json`, {
32
+ basedir: opts.cwd
33
+ })
34
+ );
35
+ }
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ resolveProjectDep
40
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
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",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@iconify/utils": "2.1.1",
23
23
  "@svgr/core": "6.5.1",
24
- "@umijs/bundler-mako": "0.7.3",
24
+ "@umijs/bundler-mako": "0.7.5",
25
25
  "@umijs/es-module-parser": "0.0.7",
26
26
  "@umijs/history": "5.3.1",
27
27
  "babel-plugin-dynamic-import-node": "2.3.3",
@@ -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.0",
45
- "@umijs/babel-preset-umi": "4.3.0",
46
- "@umijs/bundler-esbuild": "4.3.0",
47
- "@umijs/bundler-utils": "4.3.0",
48
- "@umijs/bundler-vite": "4.3.0",
49
- "@umijs/bundler-webpack": "4.3.0",
50
- "@umijs/core": "4.3.0",
51
- "@umijs/mfsu": "4.3.0",
52
- "@umijs/plugin-run": "4.3.0",
53
- "@umijs/utils": "4.3.0",
54
- "@umijs/zod2ts": "4.3.0",
55
- "@umijs/server": "4.3.0",
44
+ "@umijs/ast": "4.3.2",
45
+ "@umijs/babel-preset-umi": "4.3.2",
46
+ "@umijs/bundler-esbuild": "4.3.2",
47
+ "@umijs/bundler-utils": "4.3.2",
48
+ "@umijs/bundler-vite": "4.3.2",
49
+ "@umijs/bundler-webpack": "4.3.2",
50
+ "@umijs/core": "4.3.2",
56
51
  "@umijs/did-you-know": "1.0.3",
57
- "@umijs/renderer-react": "4.3.0",
58
- "@umijs/ui": "3.0.1"
52
+ "@umijs/mfsu": "4.3.2",
53
+ "@umijs/plugin-run": "4.3.2",
54
+ "@umijs/renderer-react": "4.3.2",
55
+ "@umijs/server": "4.3.2",
56
+ "@umijs/ui": "3.0.1",
57
+ "@umijs/utils": "4.3.2",
58
+ "@umijs/zod2ts": "4.3.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@manypkg/get-packages": "1.1.3",