@umijs/plugins 4.6.58 → 4.6.61

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
 
@@ -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.58",
3
+ "version": "4.6.61",
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",
@@ -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.58",
48
+ "@umijs/bundler-utils": "4.6.61",
49
49
  "@umijs/valtio": "1.0.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "antd": "^4.24.1",
53
- "umi": "4.6.58"
53
+ "umi": "4.6.61"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"