@umijs/plugins 4.6.59 → 4.6.62

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.
package/dist/access.js CHANGED
@@ -53,10 +53,7 @@ var access_default = (api) => {
53
53
  content: `
54
54
  import React from 'react';${hasAccessFile ? `
55
55
  import accessFactory from '@/access';
56
- import { useModel } from '${(0, import_withTmpPath.getPluginModelImport)({
57
- api,
58
- from: "runtime.tsx"
59
- })}';
56
+ import { useModel } from '@@/plugin-model';
60
57
  ` : ""}
61
58
  import { AccessContext } from './context';
62
59
 
package/dist/antd.js CHANGED
@@ -306,7 +306,6 @@ var antd_default = (api) => {
306
306
  // 是否启用了 theme algorithm
307
307
  enableModernThemeAlgorithm,
308
308
  antdConfigSetter,
309
- isUtooWin: (0, import_withTmpPath.isUtooWin)(api),
310
309
  modelPluginCompat,
311
310
  lodashPath,
312
311
  /**
@@ -55,10 +55,7 @@ var initial_state_default = (api) => {
55
55
  path: "Provider.tsx",
56
56
  content: `
57
57
  import React from 'react';
58
- import { useModel } from '${(0, import_withTmpPath.getPluginModelImport)({
59
- api,
60
- from: "Provider.tsx"
61
- })}';
58
+ import { useModel } from '@@/plugin-model';
62
59
  ${loading ? `import Loading from '${loading}'` : `function Loading() { return <div />; }`}
63
60
  export default function InitialStateProvider(props: any) {
64
61
  const appLoaded = React.useRef(false);
package/dist/layout.js CHANGED
@@ -146,10 +146,7 @@ import './${layoutFile}';
146
146
  import Logo from './Logo';
147
147
  import Exception from './Exception';
148
148
  import { getRightRenderContent } from './rightRender';
149
- ${hasInitialStatePlugin ? `import { useModel } from '${(0, import_withTmpPath.getPluginModelImport)({
150
- api,
151
- from: "Layout.tsx"
152
- })}';` : "const useModel = null;"}
149
+ ${hasInitialStatePlugin ? `import { useModel } from '@@/plugin-model';` : "const useModel = null;"}
153
150
  ${api.config.access ? `
154
151
  import { useAccessMarkedRoutes } from '@@/plugin-access';
155
152
  `.trim() : "const useAccessMarkedRoutes = (r) => r;"}
@@ -203,10 +203,7 @@ export const setMasterOptions = (newOpts) => options = ({ ...options, ...newOpts
203
203
  path: file.replace(/\.tpl$/, ""),
204
204
  content: content.replace(
205
205
  "__USE_MODEL__",
206
- api.isPluginEnable("model") ? `import { useModel } from '${(0, import_withTmpPath.getPluginModelImport)({
207
- api,
208
- from: "masterRuntimePlugin.tsx"
209
- })}'` : `console.warn(\`[plugins/qiankun]: Seems like you're not using @umijs/plugin-model, you need to install it or some features may not work!\`);
206
+ api.isPluginEnable("model") ? `import { useModel } from '@@/plugin-model'` : `console.warn(\`[plugins/qiankun]: Seems like you're not using @umijs/plugin-model, you need to install it or some features may not work!\`);
210
207
  const useModel = null`
211
208
  ).replace(
212
209
  /from 'lodash\//g,
@@ -250,10 +250,7 @@ if (!isServer && !window.__POWERED_BY_QIANKUN__) {
250
250
  path: file.replace(/\.tpl$/, ""),
251
251
  content: getFileContent(file).replace(
252
252
  "__USE_MODEL__",
253
- api.isPluginEnable("model") ? `import { useModel } from '${(0, import_withTmpPath.getPluginModelImport)({
254
- api,
255
- from: "slaveRuntimePlugin.ts"
256
- })}'` : `console.warn(\`[plugins/qiankun]: Seems like you're not using @umijs/plugin-model, you need to install it or some features may not work!\`);
253
+ api.isPluginEnable("model") ? `import { useModel } from '@@/plugin-model'` : `console.warn(\`[plugins/qiankun]: Seems like you're not using @umijs/plugin-model, you need to install it or some features may not work!\`);
257
254
  const useModel = null`
258
255
  ).replace(
259
256
  /from 'qiankun'/g,
@@ -4,8 +4,3 @@ export declare function withTmpPath(opts: {
4
4
  path: string;
5
5
  noPluginDir?: boolean;
6
6
  }): string;
7
- export declare function isUtooWin(api: IApi): boolean;
8
- export declare function getPluginModelImport(opts: {
9
- api: IApi;
10
- from: string;
11
- }): string;
@@ -19,8 +19,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/utils/withTmpPath.ts
20
20
  var withTmpPath_exports = {};
21
21
  __export(withTmpPath_exports, {
22
- getPluginModelImport: () => getPluginModelImport,
23
- isUtooWin: () => isUtooWin,
24
22
  withTmpPath: () => withTmpPath
25
23
  });
26
24
  module.exports = __toCommonJS(withTmpPath_exports);
@@ -35,24 +33,7 @@ function withTmpPath(opts) {
35
33
  )
36
34
  );
37
35
  }
38
- function withTmpPluginPath(opts) {
39
- return (0, import_plugin_utils.winPath)((0, import_path.join)(opts.api.paths.absTmpPath, `plugin-${opts.pluginKey}`));
40
- }
41
- function isUtooWin(api) {
42
- return process.platform === "win32" && api.appData.bundler === "utoopack";
43
- }
44
- function getPluginModelImport(opts) {
45
- if (!isUtooWin(opts.api)) {
46
- return "@@/plugin-model";
47
- }
48
- const from = withTmpPath({ api: opts.api, path: opts.from });
49
- const to = withTmpPluginPath({ api: opts.api, pluginKey: "model" });
50
- const relPath = (0, import_plugin_utils.winPath)((0, import_path.relative)((0, import_path.dirname)(from), to));
51
- return relPath.startsWith(".") ? relPath : `./${relPath}`;
52
- }
53
36
  // Annotate the CommonJS export names for ESM import in node:
54
37
  0 && (module.exports = {
55
- getPluginModelImport,
56
- isUtooWin,
57
38
  withTmpPath
58
39
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.6.59",
3
+ "version": "4.6.62",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -26,7 +26,7 @@
26
26
  "@tanstack/react-query": "^4.24.10",
27
27
  "@tanstack/react-query-devtools": "^4.24.10",
28
28
  "antd-dayjs-webpack-plugin": "^1.0.6",
29
- "axios": "^0.27.2",
29
+ "axios": "^1.17.0",
30
30
  "babel-plugin-import": "^1.13.8",
31
31
  "babel-plugin-styled-components": "2.1.4",
32
32
  "dayjs": "^1.11.7",
@@ -36,7 +36,7 @@
36
36
  "event-emitter": "~0.3.5",
37
37
  "fast-deep-equal": "3.1.3",
38
38
  "intl": "1.2.5",
39
- "lodash": "^4.17.21",
39
+ "lodash": "^4.18.1",
40
40
  "moment": "^2.29.4",
41
41
  "qiankun": "^2.10.1",
42
42
  "react-intl": "3.12.1",
@@ -45,12 +45,12 @@
45
45
  "styled-components": "6.1.1",
46
46
  "tslib": "^2",
47
47
  "warning": "^4.0.3",
48
- "@umijs/bundler-utils": "4.6.59",
48
+ "@umijs/bundler-utils": "4.6.62",
49
49
  "@umijs/valtio": "1.0.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "antd": "^4.24.1",
53
- "umi": "4.6.59"
53
+ "umi": "4.6.62"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"
@@ -30,9 +30,9 @@ import merge from '{{{lodashPath.merge}}}'
30
30
 
31
31
  let cacheAntdConfig = null;
32
32
 
33
- const getAntdConfig = ({{#isUtooWin}}runtimePluginManager?: any{{/isUtooWin}}) => {
33
+ const getAntdConfig = () => {
34
34
  if(!cacheAntdConfig){
35
- cacheAntdConfig = {{#isUtooWin}}(runtimePluginManager || getPluginManager()){{/isUtooWin}}{{^isUtooWin}}getPluginManager(){{/isUtooWin}}.applyPlugins({
35
+ cacheAntdConfig = getPluginManager().applyPlugins({
36
36
  key: 'antd',
37
37
  type: ApplyPluginsType.modify,
38
38
  initialValue: {
@@ -53,14 +53,14 @@ const getAntdConfig = ({{#isUtooWin}}runtimePluginManager?: any{{/isUtooWin}}) =
53
53
  return cacheAntdConfig;
54
54
  }
55
55
 
56
- function AntdProvider({ children{{#isUtooWin}}, pluginManager{{/isUtooWin}} }) {
56
+ function AntdProvider({ children }) {
57
57
  let container = children;
58
58
 
59
59
  const [antdConfig, _setAntdConfig] = React.useState(() => {
60
60
  const {
61
61
  appConfig: _,
62
62
  ...finalConfigProvider
63
- } = getAntdConfig({{#isUtooWin}}pluginManager{{/isUtooWin}});
63
+ } = getAntdConfig();
64
64
  {{#enableModernThemeAlgorithm}}
65
65
  finalConfigProvider.theme ??= {};
66
66
  finalConfigProvider.theme.algorithm ??= [];
@@ -155,9 +155,9 @@ function AntdProvider({ children{{#isUtooWin}}, pluginManager{{/isUtooWin}} }) {
155
155
  return container;
156
156
  }
157
157
 
158
- export function rootContainer(children{{#isUtooWin}}, opts{{/isUtooWin}}) {
158
+ export function rootContainer(children) {
159
159
  return (
160
- <AntdProvider{{#isUtooWin}} pluginManager={opts?.plugin}{{/isUtooWin}}>
160
+ <AntdProvider>
161
161
  {children}
162
162
  </AntdProvider>
163
163
  );
@@ -166,10 +166,10 @@ export function rootContainer(children{{#isUtooWin}}, opts{{/isUtooWin}}) {
166
166
  {{#appConfig}}
167
167
  // The App component should be under ConfigProvider
168
168
  // plugin-locale has other ConfigProvider
169
- export function innerProvider(container: any{{#isUtooWin}}, opts: any{{/isUtooWin}}) {
169
+ export function innerProvider(container: any) {
170
170
  const {
171
171
  appConfig: finalAppConfig = {},
172
- } = getAntdConfig({{#isUtooWin}}opts?.plugin{{/isUtooWin}});
172
+ } = getAntdConfig();
173
173
  return <App {...finalAppConfig}>{container}</App>;
174
174
  }
175
175
  {{/appConfig}}