@umijs/plugins 4.0.0-beta.16 → 4.0.0-beta.17

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/antd.js CHANGED
@@ -52,7 +52,7 @@ exports.default = (api) => {
52
52
  // babel-plugin-import
53
53
  api.addExtraBabelPlugins(() => {
54
54
  const style = api.config.antd.style || 'less';
55
- return api.config.antd.import
55
+ return api.config.antd.import && !api.appData.vite
56
56
  ? [
57
57
  [
58
58
  require.resolve('babel-plugin-import'),
@@ -102,7 +102,7 @@ export function rootContainer(container) {
102
102
  // import antd style if antd.import is not configured
103
103
  api.addEntryImportsAhead(() => {
104
104
  const style = api.config.antd.style || 'less';
105
- return api.config.antd.import
105
+ return api.config.antd.import && !api.appData.vite
106
106
  ? []
107
107
  : [
108
108
  {
package/dist/dva.js CHANGED
@@ -67,16 +67,15 @@ exports.default = (api) => {
67
67
  // aliased to @umijs/plugins/templates/dva
68
68
  import { create, Provider } from 'dva';
69
69
  import React, { useRef } from 'react';
70
- import { useAppData } from 'umi';
70
+ import { history } from 'umi';
71
71
  import { models } from './models';
72
72
 
73
73
  export function RootContainer(props: any) {
74
- const { navigator } = useAppData();
75
74
  const app = useRef<any>();
76
75
  if (!app.current) {
77
76
  app.current = create(
78
77
  {
79
- history: navigator,
78
+ history,
80
79
  },
81
80
  {
82
81
  initialReducer: {},
@@ -84,7 +83,7 @@ export function RootContainer(props: any) {
84
83
  return [...middlewares];
85
84
  },
86
85
  setupApp(app: IDvaApp) {
87
- app._history = navigator;
86
+ app._history = history;
88
87
  },
89
88
  },
90
89
  );
package/dist/layout.js CHANGED
@@ -111,7 +111,7 @@ const { formatMessage } = useIntl();
111
111
  <ProLayout
112
112
  route={route}
113
113
  location={location}
114
- title={userConfig.name || 'plugin-layout'}
114
+ title={userConfig.title || 'plugin-layout'}
115
115
  navTheme="dark"
116
116
  siderWidth={256}
117
117
  onMenuHeaderClick={(e) => {
@@ -0,0 +1,3 @@
1
+ import { IApi } from 'umi';
2
+ declare const _default: (api: IApi) => void;
3
+ export default _default;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const child_process_1 = require("child_process");
23
+ const path = __importStar(require("path"));
24
+ exports.default = (api) => {
25
+ api.describe({ key: 'tailwindcss' });
26
+ api.onStart(() => {
27
+ const inputPath = path.resolve(api.cwd, 'tailwind.css');
28
+ const generatedPath = path.resolve(api.paths.absTmpPath, 'tailwind.css');
29
+ const binPath = path.resolve(api.cwd, 'node_modules/.bin/tailwind');
30
+ /** 透过子进程建立 tailwindcss 服务,将生成的 css 写入 generatedPath */
31
+ const tailwind = (0, child_process_1.exec)(`${binPath} -i ${inputPath} -o ${generatedPath} --watch`, { cwd: api.cwd });
32
+ tailwind.on('error', (m) => {
33
+ api.logger.error('tailwindcss service encounter an error: ' + m);
34
+ });
35
+ /** 将生成的 css 文件加入到 import 中 */
36
+ api.addEntryImports(() => [{ source: generatedPath }]);
37
+ });
38
+ };
@@ -0,0 +1,3 @@
1
+ import { IApi } from 'umi';
2
+ declare const _default: (api: IApi) => void;
3
+ export default _default;
package/dist/unocss.js ADDED
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const utils_1 = require("@umijs/utils");
26
+ const child_process_1 = require("child_process");
27
+ const fs = __importStar(require("fs"));
28
+ const path_1 = __importDefault(require("path"));
29
+ exports.default = (api) => {
30
+ api.describe({
31
+ key: 'unocss',
32
+ config: {
33
+ schema(Joi) {
34
+ return Joi.object({
35
+ watch: Joi.array(),
36
+ });
37
+ },
38
+ },
39
+ enableBy: api.EnableBy.config,
40
+ });
41
+ api.onStart(() => {
42
+ /** 由于 @unocss/cli 对设置文件进行了检查,因此加入需要 unocss.config.ts 设置的提示
43
+ * https://github.com/antfu/unocss/blob/main/packages/cli/src/index.ts#L93 */
44
+ if (!fs.existsSync(path_1.default.resolve(api.paths.cwd, 'unocss.config.ts')))
45
+ utils_1.logger.warn('请在项目目录中添加 unocss.config.ts 文件,并配置需要的 unocss presets,否则插件将没有效果!');
46
+ const generatedPath = path_1.default.resolve(api.paths.absTmpPath, 'uno.css');
47
+ const binPath = path_1.default.resolve(api.cwd, 'node_modules/.bin/unocss');
48
+ const watchDirs = api.config.unocss.watch;
49
+ /** 透过子进程建立 unocss 服务,将生成的 css 写入 generatedPath */
50
+ const unocss = (0, child_process_1.exec)(`${binPath} ${watchDirs.join(' ')} --out-file ${generatedPath} --watch`, { cwd: api.cwd });
51
+ unocss.on('error', (m) => {
52
+ api.logger.error('unocss service encounter an error: ' + m);
53
+ });
54
+ /** 将生成的 css 文件加入到 import 中 */
55
+ api.addEntryImports(() => [{ source: generatedPath }]);
56
+ });
57
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.0-beta.16",
3
+ "version": "4.0.0-beta.17",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -24,7 +24,7 @@
24
24
  "@ahooksjs/use-request": "^2.0.0",
25
25
  "@ant-design/icons": "^4.7.0",
26
26
  "@ant-design/pro-layout": "^6.31.7",
27
- "@umijs/bundler-utils": "4.0.0-beta.16",
27
+ "@umijs/bundler-utils": "4.0.0-beta.17",
28
28
  "antd": "^4.17.3",
29
29
  "antd-dayjs-webpack-plugin": "^1.0.6",
30
30
  "axios": "^0.24.0",
@@ -42,7 +42,7 @@
42
42
  "warning": "^4.0.3"
43
43
  },
44
44
  "devDependencies": {
45
- "umi": "4.0.0-beta.16"
45
+ "umi": "4.0.0-beta.17"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"