@baic/yolk-cli 2.1.0-alpha.103 → 2.1.0-alpha.105

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.
Files changed (52) hide show
  1. package/package.json +2 -2
  2. package/templates/umi-mobile/.umirc.ts.tpl +0 -1
  3. package/templates/umi-mobile/src/.umi/core/EmptyRoute.tsx +8 -0
  4. package/templates/umi-mobile/src/.umi/core/defineApp.ts +21 -0
  5. package/templates/umi-mobile/src/.umi/core/history.ts +70 -0
  6. package/templates/umi-mobile/src/.umi/core/historyIntelli.ts +132 -0
  7. package/templates/umi-mobile/src/.umi/core/plugin.ts +83 -0
  8. package/templates/umi-mobile/src/.umi/core/pluginConfig.d.ts +295 -0
  9. package/templates/umi-mobile/src/.umi/core/polyfill.ts +191 -0
  10. package/templates/umi-mobile/src/.umi/core/route.tsx +267 -0
  11. package/templates/umi-mobile/src/.umi/core/routeProps.js +3 -0
  12. package/templates/umi-mobile/src/.umi/core/routeProps.ts +4 -0
  13. package/templates/umi-mobile/src/.umi/core/terminal.ts +62 -0
  14. package/templates/umi-mobile/src/.umi/exports.ts +51 -0
  15. package/templates/umi-mobile/src/.umi/plugin-clickToComponent/runtime.tsx +19 -0
  16. package/templates/umi-mobile/src/.umi/plugin-errorBoundary/runtime.tsx +67 -0
  17. package/templates/umi-mobile/src/.umi/plugin-hd/runtime.tsx +57 -0
  18. package/templates/umi-mobile/src/.umi/testBrowser.tsx +91 -0
  19. package/templates/umi-mobile/src/.umi/tsconfig.json +29 -0
  20. package/templates/umi-mobile/src/.umi/typings.d.ts +138 -0
  21. package/templates/umi-mobile/src/.umi/umi.ts +76 -0
  22. package/templates/umi-mobile/src/app.tsx +2 -2
  23. package/templates/umi-mobile/src/pages/404.tsx +0 -1
  24. package/templates/umi-mobile/src/pages/demo/examples/BarCode.tsx +0 -1
  25. package/templates/umi-mobile/src/pages/demo/examples/Iconfont.tsx +1 -2
  26. package/templates/umi-mobile/src/pages/demo/examples/Input.tsx +0 -1
  27. package/templates/umi-mobile/src/pages/demo/examples/List/1.tsx +1 -2
  28. package/templates/umi-mobile/src/pages/demo/examples/List/2.tsx +1 -1
  29. package/templates/umi-mobile/src/pages/demo/examples/List/3.tsx +1 -1
  30. package/templates/umi-mobile/src/pages/demo/examples/List/4.tsx +7 -8
  31. package/templates/umi-mobile/src/pages/demo/examples/Loading.tsx +0 -1
  32. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/1.tsx +0 -1
  33. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/2.tsx +0 -1
  34. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/3.tsx +0 -1
  35. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/4.tsx +0 -1
  36. package/templates/umi-mobile/src/pages/demo/examples/PagingList/1.tsx +1 -2
  37. package/templates/umi-mobile/src/pages/demo/examples/QrCode.tsx +0 -1
  38. package/templates/umi-mobile/src/pages/demo/examples/Required.tsx +0 -1
  39. package/templates/umi-mobile/src/pages/demo/examples/TimerButton.tsx +0 -1
  40. package/templates/umi-mobile/src/pages/demo/examples/usePreload.tsx +1 -1
  41. package/templates/umi-mobile/src/pages/demo/index.tsx +8 -8
  42. package/templates/umi-mobile/src/pages/index.tsx +0 -2
  43. package/templates/umi-mobile-h5+app/.umirc.ts.tpl +0 -1
  44. package/templates/umi-mobile-native/.umirc.ts.tpl +0 -1
  45. package/templates/umi-web/.umirc.ts.tpl +0 -1
  46. package/templates/umi-web/src/pages/404.tsx +2 -3
  47. package/templates/umi-web/src/pages/demo/index.tsx +3 -2
  48. package/templates/umi-web/src/pages/index.tsx +0 -2
  49. package/templates/umi-web-screen/.umirc.ts.tpl +0 -1
  50. package/templates/umi-web-screen/src/components/resize-container/index.tsx +9 -8
  51. package/templates/umi-web-screen/src/pages/404.tsx +2 -3
  52. package/templates/umi-web-screen/src/pages/template/components/charts/demo-line/index.tsx +1 -2
@@ -1,8 +1,9 @@
1
- import * as React from 'react';
2
-
3
1
  import _ from 'lodash';
4
2
 
5
- import { Tabs, Collapse } from 'antd-mobile';
3
+ import type { FunctionComponent } from 'react';
4
+ import { createElement } from 'react';
5
+
6
+ import { Collapse, Tabs } from 'antd-mobile';
6
7
 
7
8
  import BarCode from './examples/BarCode';
8
9
  import Iconfont from './examples/Iconfont';
@@ -27,7 +28,7 @@ const { Panel } = Collapse;
27
28
 
28
29
  const tabs: Record<
29
30
  string,
30
- React.FunctionComponent | Record<string, React.FunctionComponent>
31
+ FunctionComponent | Record<string, FunctionComponent>
31
32
  > = {
32
33
  BarCode,
33
34
  Iconfont,
@@ -58,7 +59,7 @@ export default () => {
58
59
  if (_.isFunction(tab)) {
59
60
  return (
60
61
  <Tab key={key} title={key}>
61
- {React.createElement(tab)}
62
+ {createElement(tab)}
62
63
  </Tab>
63
64
  );
64
65
  }
@@ -71,7 +72,7 @@ export default () => {
71
72
  const tab2 = tab[key2];
72
73
  return (
73
74
  <Panel key={key2} title={key2}>
74
- {React.createElement(tab2)}
75
+ {createElement(tab2)}
75
76
  </Panel>
76
77
  );
77
78
  })}
@@ -79,9 +80,8 @@ export default () => {
79
80
  </Tab>
80
81
  );
81
82
  }
83
+ return null;
82
84
  })}
83
85
  </Tabs>
84
86
  );
85
87
  };
86
-
87
- // export default () => <PagingList_1 />;
@@ -1,3 +1 @@
1
- import * as React from 'react';
2
-
3
1
  export default () => <div>Hello world</div>;
@@ -2,7 +2,6 @@ import { defineConfig } from '@baic/yolk-umi';
2
2
 
3
3
  export default defineConfig({
4
4
  title: '{{ projectName }}',
5
- publicPath: '/',
6
5
  hd: {},
7
6
  'h5+app': {},
8
7
  });
@@ -2,7 +2,6 @@ import { defineConfig } from '@baic/yolk-umi';
2
2
 
3
3
  export default defineConfig({
4
4
  title: '{{ projectName }}',
5
- publicPath: '/',
6
5
  hd: {},
7
6
  'h5+app': {
8
7
  manifest: false,
@@ -2,5 +2,4 @@ import { defineConfig } from '@baic/yolk-umi';
2
2
 
3
3
  export default defineConfig({
4
4
  title: '{{ projectName }}',
5
- publicPath: '/',
6
5
  });
@@ -1,8 +1,7 @@
1
- import * as React from 'react';
2
- import { Result, Button } from 'antd';
3
-
4
1
  import { history } from 'umi';
5
2
 
3
+ import { Button, Result } from 'antd';
4
+
6
5
  export default () => (
7
6
  <Result
8
7
  status="404"
@@ -103,7 +103,7 @@ export default () => {
103
103
  const keys = Object.keys(tabs);
104
104
  return (
105
105
  <Tabs defaultActiveKey={keys[0]}>
106
- {keys.map(key => {
106
+ {keys.map((key) => {
107
107
  const tab = tabs[key];
108
108
  if (_.isFunction(tab)) {
109
109
  return (
@@ -117,7 +117,7 @@ export default () => {
117
117
  return (
118
118
  <TabPane key={key} tab={key}>
119
119
  <Tabs defaultActiveKey={keys2[0]}>
120
- {keys2.map(key2 => {
120
+ {keys2.map((key2) => {
121
121
  const tab2 = tab[key2];
122
122
  return (
123
123
  <TabPane key={key2} tab={key2}>
@@ -129,6 +129,7 @@ export default () => {
129
129
  </TabPane>
130
130
  );
131
131
  }
132
+ return null;
132
133
  })}
133
134
  </Tabs>
134
135
  );
@@ -1,3 +1 @@
1
- import * as React from 'react';
2
-
3
1
  export default () => <div>Hello world</div>;
@@ -3,6 +3,5 @@ import { defineConfig } from '@baic/yolk-umi';
3
3
 
4
4
  export default defineConfig({
5
5
  title: '{{ projectName }}',
6
- publicPath: '/',
7
6
  lessVarsResources: [path.resolve('src/styles/vars.less')],
8
7
  });
@@ -1,7 +1,8 @@
1
1
  import _ from 'lodash';
2
2
  import classnames from 'classnames';
3
3
 
4
- import * as React from 'react';
4
+ import type { ReactNode, RefObject } from 'react';
5
+ import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
5
6
 
6
7
  import { useSize } from 'ahooks';
7
8
 
@@ -15,15 +16,15 @@ export type ContainerInstance = {
15
16
  };
16
17
 
17
18
  type ResizeContainerProps = {
18
- children?: React.ReactNode | ((e: ContainerInstance) => React.ReactNode);
19
+ children?: ReactNode | ((e: ContainerInstance) => ReactNode);
19
20
  className?: string;
20
- getContainer?: () => HTMLElement | React.RefObject<HTMLElement>;
21
+ getContainer?: () => HTMLElement | RefObject<HTMLElement>;
21
22
  onResize?: (e: ContainerInstance) => void;
22
23
  containerParentElementZoom?: boolean | number;
23
24
  containerZoom?: boolean | number;
24
25
  };
25
26
 
26
- const Component = React.forwardRef<ContainerInstance, ResizeContainerProps>(
27
+ const Component = forwardRef<ContainerInstance, ResizeContainerProps>(
27
28
  (
28
29
  {
29
30
  children,
@@ -35,13 +36,13 @@ const Component = React.forwardRef<ContainerInstance, ResizeContainerProps>(
35
36
  },
36
37
  ref,
37
38
  ) => {
38
- const containerRef = React.useRef<HTMLDivElement>(null);
39
+ const containerRef = useRef<HTMLDivElement>(null);
39
40
  const { width = 0, height = 0 } = useSize(
40
41
  _.isFunction(getContainer)
41
42
  ? getContainer()
42
43
  : () => containerRef.current?.parentElement || null,
43
44
  ) || { width: 0, height: 0 };
44
- const instance = React.useMemo(() => {
45
+ const instance = useMemo(() => {
45
46
  let res = {
46
47
  width,
47
48
  height,
@@ -72,8 +73,8 @@ const Component = React.forwardRef<ContainerInstance, ResizeContainerProps>(
72
73
  }
73
74
  return res;
74
75
  }, [width, height, onResize, containerParentElementZoom, containerZoom]);
75
- React.useImperativeHandle(ref, () => instance);
76
- const childrenMemo = React.useMemo(() => {
76
+ useImperativeHandle(ref, () => instance);
77
+ const childrenMemo = useMemo(() => {
77
78
  const { width: containerWidth, height: containerHeight } = instance;
78
79
  if (0 === containerWidth || 0 === containerHeight) {
79
80
  return null;
@@ -1,8 +1,7 @@
1
- import * as React from 'react';
2
- import { Result, Button } from 'antd';
3
-
4
1
  import { history } from 'umi';
5
2
 
3
+ import { Button, Result } from 'antd';
4
+
6
5
  export default () => (
7
6
  <Result
8
7
  status="404"
@@ -1,5 +1,3 @@
1
- import * as React from 'react';
2
-
3
1
  import { Line } from '@ant-design/plots';
4
2
 
5
3
  import { ResizeContainer } from '@/components';
@@ -8,6 +6,7 @@ const Component = () => (
8
6
  <ResizeContainer>
9
7
  {({ width, height }) => (
10
8
  <Line
9
+ supportCSSTransform
11
10
  width={width}
12
11
  height={height}
13
12
  xField="date"