Skip to content

Commit

Permalink
Merge branch 'umijs:master' into fix/hrm_port
Browse files Browse the repository at this point in the history
  • Loading branch information
guoshuangyang authored Jan 10, 2025
2 parents 78e69fe + b2a4220 commit ce44858
Show file tree
Hide file tree
Showing 49 changed files with 375 additions and 102 deletions.
4 changes: 4 additions & 0 deletions docs/.dumi/components/Contributing/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
color: #0273dc;
text-decoration: none;
}

img {
max-width: 100%;
}
}
}
1 change: 0 additions & 1 deletion docs/.dumi/components/Contributing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const Contributing = () => {
<img
src="https://opencollective.com/umi/contributors.svg?width=1200&button=false"
width="1200"
height="184"
/>
</a>
</div>
Expand Down
70 changes: 69 additions & 1 deletion docs/.dumi/components/Hero/index.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.hero {
height: 640px;
min-height: 640px;
position: relative;

:global {
Expand Down Expand Up @@ -122,3 +122,71 @@
}
}
}

@media (max-width: 768px){
.hero{
:global{
.bg{
height: 100%;
background-repeat: repeat;
}
.wrapper{
flex-wrap: wrap;
justify-content: center;
padding-bottom: 40px;
.left{
padding-top: 40px;
padding-left: 0;
.bigLogo{
margin: 0 auto;
width: 300px;
height: 139px;
background-size: 100% auto;
}
.actions{
margin-top: 40px;
flex-wrap:wrap;
justify-content: center;
.button{
margin-left: 0;
width: 120px;
height: 40px;
line-height: 40px;
font-size: 16px;
}
.githubStar{
font-size: 12px;
line-height: 40px;
&::before{
height: 40px;
}
}
}
}
.right{
padding-top: 40px;
margin-right: 0;
.bigSlogan1{
width: 200px;
height: 65px;
background-size: 100% auto;
}
.bigSlogan2{
width: 300px;
height: 49px;
background-size: 100% auto;
}
.slogan{
font-size: 20px;
width: auto;
}
.bow{
width: 330px;
height: 168px;
background-size: 100% auto;
}
}
}
}
}
}
5 changes: 3 additions & 2 deletions docs/docs/docs/api/api.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ Type definition is as follows:

```ts
declare function Link(props: {
prefetch?: boolean;
prefetch?: boolean | 'intent' | 'render' | 'viewport' | 'none';
prefetchTimeout?: number;
to: string | Partial<{ pathname: string; search: string; hash: string }>;
replace?: boolean;
state?: any;
Expand All @@ -207,7 +208,7 @@ function IndexPage({ user }) {

`<Link to>` supports relative path navigation; `<Link reloadDocument>` does not do routing navigation and is equivalent to the jump behavior of `<a href>`.

If `prefetch` is enabled, then when the user hovers over the component, Umi will automatically start preloading the component js files and data for the routing jump. (Note: Use this feature when `routePrefetch` and `manifest` are enabled)
If `prefetch` is enabled, then when the user hovers over the component, Umi will automatically start preloading the component js files and data for the routing jump. (Note: Use this feature when `routePrefetch` is enabled)

### matchPath

Expand Down
5 changes: 3 additions & 2 deletions docs/docs/docs/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ unlisten();

```ts
declare function Link(props: {
prefetch?: boolean;
prefetch?: boolean | 'intent' | 'render' | 'viewport' | 'none';
prefetchTimeout?: number;
to: string | Partial<{ pathname: string; search: string; hash: string }>;
replace?: boolean;
state?: any;
Expand All @@ -206,7 +207,7 @@ function IndexPage({ user }) {

`<Link to>` 支持相对路径跳转;`<Link reloadDocument>` 不做路由跳转,等同于 `<a href>` 的跳转行为。

若开启了 `prefetch` 则当用户将鼠标放到该组件上方时,Umi 就会自动开始进行跳转路由的组件 js 文件和数据预加载。(注:使用此功能请同时开启 `routePrefetch``manifest` 配置)
若开启了 `prefetch` 则当用户将鼠标放到该组件上方时,Umi 就会自动开始进行跳转路由的组件 js 文件和数据预加载。(注:使用此功能请开启 `routePrefetch` 配置)

### matchPath

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/api/config.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ Configure how routes are loaded. Setting moduleType to 'cjs' will load route com
## routePrefetch
- Type: `boolean`
- Type: `{ defaultPrefetch: 'none' | 'intent' | 'render' | 'viewport', defaultPrefetchTimeout: number } | false`
- Default: `false`
Enable route preloading functionality.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/api/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ proxy: {

## routePrefetch

- 类型:`boolean`
- 类型:`{ defaultPrefetch: 'none' | 'intent' | 'render' | 'viewport', defaultPrefetchTimeout: number } | false`
- 默认值:`false`

启用路由预加载功能。
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/api/runtime-config.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The return value of `getInitialState()` will become the global initial state. Fo
// src/app.ts
import { fetchInitialData } from "@/services/initial";

export async function () {
export async function getInitialState() {
const initialData = await fetchInitialData();
return initialData;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/api/runtime-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
// src/app.ts
import { fetchInitialData } from "@/services/initial";

export async function () {
export async function getInitialState() {
const initialData = await fetchInitialData();
return initialData;
}
Expand Down
6 changes: 4 additions & 2 deletions docs/docs/docs/introduce/contributing.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ translated_at: '2024-03-17T09:56:34.842Z'

Developing Umi requires Node.js 18+ and `pnpm` v8.

It is recommended to use [`nvm`](https://github.com/nvm-sh/nvm) to manage Node.js versions to avoid permission issues and easily switch between Node.js versions. Windows developers can use [`nvm-windows`](https://github.com/coreybutler/nvm-windows).
It's recommended to use [Volta](https://volta.sh/) to manage the node and pnpm version. And you need to set the `VOLTA_FEATURE_PNPM` environment variable to enable pnpm support.

Install `pnpm` via one of the methods on its [official website](https://pnpm.io/installation).
```bash
export VOLTA_FEATURE_PNPM=1
```

### Clone the Project

Expand Down
6 changes: 4 additions & 2 deletions docs/docs/docs/introduce/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ toc: content

开发 Umi 需要 Node.js 18+ 和 `pnpm` v8。

推荐使用 [`nvm`](https://github.com/nvm-sh/nvm) 管理 Node.js,避免权限问题的同时,还能够随时切换当前使用的 Node.js 的版本。在 Windows 系统下的开发者可以使用 [`nvm-windows`](https://github.com/coreybutler/nvm-windows)
推荐使用 [Volta](https://volta.sh/) 来管理 Node.js 和 pnpm 版本。并且需要设置 `VOLTA_FEATURE_PNPM` 环境变量来启用 pnpm 支持

`pnpm`[官网](https://pnpm.io/installation)选择一种方式安装即可。
```bash
export VOLTA_FEATURE_PNPM=1
```

### Clone 项目

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/max/charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pnpm install @ant-design/plots

在下面的使用示例中,我们将最小化引入。

您也可以直接阅读 Ant Design Charts 完整的[上手文档](https://charts.ant.design/zh/docs/manual/getting-started)[图表示例](https://charts.ant.design/zh/examples/gallery)
您也可以直接阅读 Ant Design Charts 完整的[上手文档](https://ant-design-charts.antgroup.com/manual/getting-started)[图表示例](https://ant-design-charts.antgroup.com/examples)

### 曲线图

Expand Down
29 changes: 28 additions & 1 deletion docs/docs/docs/max/data-flow.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@ translated_at: '2024-03-18T00:49:20.502Z'

`@umi/max` has a built-in **data flow management** [plugin](https://github.com/umijs/umi/blob/master/packages/plugins/src/model.ts), which is a lightweight data management solution based on the `hooks` paradigm. It can be used to manage global shared data in Umi projects.

## Configuration

e.g.

```ts
export default {
model: {
extraModels: ['src/models/userModel.ts'],
sort: (a, b) => a.namespace.localeCompare(b.namespace),
},
};
```

### extraModels

- Type: `string[]`
- Default: `[]`

Configure `extraModels` to automatically add these Model files to the data stream management.

### sort

- Type: `(a: Model, b: Model) => number`
- Default: `(a, b) => a.namespace.localeCompare(b.namespace)`

Configure `sort` to sort the Model based on the return value of the `sort` function.

## Getting Started

### Creating a Model
Expand Down Expand Up @@ -220,7 +247,7 @@ For specific usage, please refer to the [micro-frontend's parent-child communica
// src/components/AdminInfo/index.tsx
import { useModel } from 'umi';

export default function Page() {
export default () => {
const { user, fetchUser } = useModel('adminModel', (model) => ({
user: model.admin,
fetchUser: model.fetchAdmin,
Expand Down
29 changes: 28 additions & 1 deletion docs/docs/docs/max/data-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ toc: content

`@umi/max` 内置了**数据流管理**[插件](https://github.com/umijs/umi/blob/master/packages/plugins/src/model.ts),它是一种基于 `hooks` 范式的轻量级数据管理方案,可以在 Umi 项目中管理全局的共享数据。

## 配置

e.g.

```ts
export default {
model: {
extraModels: ['src/models/userModel.ts'],
sort: (a, b) => a.namespace.localeCompare(b.namespace),
},
};
```

### extraModels

- Type: `string[]`
- Default: `[]`

配置 `extraModels` 后,插件会自动将这些 Model 文件添加到数据流管理中。

### sort

- Type: `(a: Model, b: Model) => number`
- Default: `(a, b) => a.namespace.localeCompare(b.namespace)`

配置 `sort` 后,插件会根据 `sort` 函数返回的值对 Model 进行排序。

## 开始使用

### 创建 Model
Expand All @@ -29,7 +56,7 @@ Model 文件允许使用 `.(tsx|ts|jsx|js)` 四种后缀格式,**命名空间

```ts
// src/models/userModel.ts
export default function Page() {
export default () => {
const user = {
username: 'umi',
};
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/docs/max/dva.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,4 @@ Since the underlying layer of dva is based on redux, you can install redux's [de

## References

- [dva official website](https://dvajs.com/)
- [dva official website](https://dva.mxlab.top/)
2 changes: 1 addition & 1 deletion docs/docs/docs/max/dva.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,4 @@ dva 的底层是基于 redux,所以你可以安装 redux 的[开发者工具](

## 参考文章

- [dva 官网](https://dvajs.com/)
- [dva 官网](https://dva.mxlab.top/)
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "4.3.35",
"version": "4.4.4",
"workspaces": ["packages/*"]
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@
"node": ">=14",
"pnpm": "^8.11.0"
},
"volta": {
"node": "20.18.1",
"pnpm": "8.15.9"
},
"//": {
"why-overrides-parcel-watcher": "https://github.com/parcel-bundler/watcher/issues/156",
"why-overrides-browserslist": "See scripts/bundleDeps.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/ast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/ast",
"version": "4.3.35",
"version": "4.4.4",
"description": "@umijs/ast",
"homepage": "https://github.com/umijs/umi/tree/master/packages/ast#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-umi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/babel-preset-umi",
"version": "4.3.35",
"version": "4.4.4",
"description": "Official babel preset for umi.",
"homepage": "https://github.com/umijs/umi/tree/master/packages/babel-preset-umi#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-esbuild/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-esbuild",
"version": "4.3.35",
"version": "4.4.4",
"description": "@umijs/bundler-esbuild",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-esbuild#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-utils",
"version": "4.3.35",
"version": "4.4.4",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-utils#readme",
"bugs": "https://github.com/umijs/umi/issues",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-vite",
"version": "4.3.35",
"version": "4.4.4",
"description": "@umijs/bundler-vite",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-vite#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
1 change: 1 addition & 0 deletions packages/bundler-webpack/compiled/webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "webpack",
"version": "5.88.2",
"author": "Tobias Koppers @sokra",
"types": "types.d.ts"
}
2 changes: 1 addition & 1 deletion packages/bundler-webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-webpack",
"version": "4.3.35",
"version": "4.4.4",
"description": "@umijs/bundler-webpack",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-webpack/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function getConfig(opts: IOpts): Promise<Configuration> {
const config = new Config();
userConfig.targets ||= DEFAULT_BROWSER_TARGETS;
// normalize inline limit
userConfig.inlineLimit = parseInt(userConfig.inlineLimit || '10000', 10);
userConfig.inlineLimit = parseInt(userConfig.inlineLimit ?? '10000', 10);
const useHash = !!(opts.hash || (userConfig.hash && !isDev));
const applyOpts = {
name: opts.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/core",
"version": "4.3.35",
"version": "4.4.4",
"homepage": "https://github.com/umijs/umi/tree/master/packages/core#readme",
"bugs": "https://github.com/umijs/umi/issues",
"repository": {
Expand Down
Loading

0 comments on commit ce44858

Please sign in to comment.