Skip to content

Commit

Permalink
feat: postcss plugin px2rem support selector double rem list
Browse files Browse the repository at this point in the history
Feat postcss plugin px2rem support selector double rem list
  • Loading branch information
xiaohuoni authored Aug 24, 2021
2 parents 7234563 + f3725e7 commit 753b214
Show file tree
Hide file tree
Showing 34 changed files with 188 additions and 133 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"npmClient": "yarn",
"useWorkspaces": true,
"changelog": {
Expand Down
1 change: 0 additions & 1 deletion modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ declare namespace NodeJS {
declare module 'archiver';
declare module 'auto-skeleton-plugin';
declare module 'qrcode-terminal';
declare module 'postcss-px-to-viewport';
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
"@types/babel__traverse": "7.11.1",
"@types/jest": "^26.0.15",
"@types/node": "^15.0.3",
"@umijs/test": "^3.3.7",
"@umijs/types": "^3.3.7",
"@umijs/utils": "^3.3.7",
"@umijs/test": "^3.4.15",
"@umijs/test-utils": "^3.4.15",
"@umijs/types": "^3.4.15",
"@umijs/utils": "^3.4.15",
"all-contributors-cli": "6.20.0",
"cnpm": "6.2.0",
"escape-goat": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/aconsole/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/aconsole",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/aconsole",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/alita/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alita",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "alita",
"main": "index.js",
"module": "index.esm.js",
Expand Down Expand Up @@ -34,7 +34,7 @@
"access": "public"
},
"dependencies": {
"@alitajs/umi-presets-alita": "2.8.15-alpha.2",
"@alitajs/umi-presets-alita": "2.8.15-alpha.3",
"umi": "3.4.15"
}
}
2 changes: 1 addition & 1 deletion packages/cordova-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/cordova-native",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/cordova-native",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/cordova/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/cordova",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "umi support cordova",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-alita/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-alita",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "create-alita",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -29,7 +29,7 @@
"access": "public"
},
"dependencies": {
"@alitajs/generate": "2.8.15-alpha.2",
"@alitajs/generate": "2.8.15-alpha.3",
"@umijs/utils": "^3.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/generate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/generate",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/generate",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion packages/hd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Hd plugin for umi.
// .umirc.ts
export default {
plugins: ['@alitajs/hd'],
hd: true,
hd: {
px2rem: {
selectorDoubleRemList: [/.ant-/],
},
},
};
```

Expand All @@ -25,6 +29,7 @@ export default {
"propBlackList": [],
"exclude": false,
"selectorBlackList": [],
"selectorDoubleRemList": [/.ant-/],
"ignoreIdentifier": false,
"replace": true,
"mediaQuery": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/hd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/hd",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "umi 移动端的适配方案",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -28,6 +28,6 @@
"access": "public"
},
"dependencies": {
"postcss-plugin-px2rem": "0.8.1"
"@alitajs/postcss-plugin-px2rem": "0.0.1"
}
}
3 changes: 2 additions & 1 deletion packages/hd/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'path';
import px2rem, { IOpts } from 'postcss-plugin-px2rem';
import px2rem, { IOpts } from '@alitajs/postcss-plugin-px2rem';
import { IApi } from 'umi';

export interface HdOptions {
Expand Down Expand Up @@ -38,6 +38,7 @@ export default (api: IApi) => {
px2rem({
rootValue: 100,
minPixelValue: 2,
selectorDoubleRemList: [/.ant-/],
...(configPx2rem || {}),
}),
];
Expand Down
2 changes: 1 addition & 1 deletion packages/hd/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module 'postcss-plugin-px2rem' {
declare module '@alitajs/postcss-plugin-px2rem' {
export interface IOpts {
rootValue: number;
unitPrecision: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/keep-alive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/keep-alive",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/keep-alive",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/layout",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/layout",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/main-path/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/main-path",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/main-path",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -25,6 +25,6 @@
"access": "public"
},
"dependencies": {
"@alitajs/utils": "2.8.15-alpha.2"
"@alitajs/utils": "2.8.15-alpha.3"
}
}
2 changes: 1 addition & 1 deletion packages/micro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/micro",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/micro",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/native",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/native",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-dva/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
See our website [@umijs/plugin-dva](https://umijs.org/plugins/plugin-dva) for more information.

从 umi-plugins 库,拷贝来的,支持引入第三方库中(node_modules)的 model
## Install

Using npm:
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-dva/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/plugin-dva",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@umijs/plugin-dva",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import styles from './index.less';
import { connect } from 'dva';

export default connect(state => ({
Expand All @@ -8,7 +7,7 @@ export default connect(state => ({
}))((props) => {
return (
<div>
<h1 className={styles.title}>Page index { props.foo.desc } { props.foo.count } { props.bar.desc } { props.bar.count }</h1>
<h1>Page index { props.foo.desc } { props.foo.count } { props.bar.desc } { props.bar.count }</h1>
</div>
);
})
2 changes: 1 addition & 1 deletion packages/plugin-dva/src/getModels/getModels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ test('parser error when has jsx', () => {
}).toThrow(
`Dva model ${utils.winPath(
relative(__dirname, filePath),
)} parse failed, SyntaxError: Unterminated regular expression. (3:26)`,
)} parse failed, SyntaxError: Unterminated regular expression`,
);
});
10 changes: 5 additions & 5 deletions packages/plugin-dva/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('normal', async () => {
await generateTmp({ cwd });
const { container } = render({ cwd });
expect(container.innerHTML).toEqual(
'<div><h1 class="title">Page index foo 0</h1></div>',
'<div><h1>Page index foo 0</h1></div>',
);
});

Expand All @@ -21,7 +21,7 @@ test('page models', async () => {
await generateTmp({ cwd });
const { container } = render({ cwd });
expect(container.innerHTML).toEqual(
'<div><h1 class="title">Page index foo 0 bar 1</h1></div>',
'<div><h1>Page index foo 0 bar 1</h1></div>',
);
});

Expand All @@ -30,12 +30,12 @@ test('with-immer', async () => {
await generateTmp({ cwd });
const { container } = render({ cwd });
expect(container.innerHTML).toEqual(
'<div><h1 class="title">Page index foo 0</h1><button>add</button></div>',
'<div><h1>Page index foo 0</h1><button>add</button></div>',
);
fireEvent.click(getByText(container, 'add'));
await utils.delay(100);
expect(container.innerHTML).toEqual(
'<div><h1 class="title">Page index foo 1</h1><button>add</button></div>',
'<div><h1>Page index foo 1</h1><button>add</button></div>',
);
});

Expand All @@ -45,6 +45,6 @@ test('lazyLoad', async () => {
const { container } = render({ cwd });
await utils.delay(100);
expect(container.innerHTML).toEqual(
'<div><h1 class="title">Page index foo 0</h1></div>',
'<div><h1>Page index foo 0</h1></div>',
);
});
2 changes: 1 addition & 1 deletion packages/plugin-layout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/plugin-layout",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/plugin-layout",
"keywords": [
"umi"
Expand Down
2 changes: 1 addition & 1 deletion packages/retain-log/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/retain-log",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/retain-log",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/router",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/router",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/routes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/routes",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/routes",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/tabs-layout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/tabs-layout",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/tabs-layout",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/umi-plugin-authorize/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "umi-plugin-authorize",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "configure authorize",
"license": "MIT",
"repository": {
Expand Down
26 changes: 13 additions & 13 deletions packages/umi-presets-alita/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/umi-presets-alita",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/umi-presets-alita",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -25,18 +25,18 @@
"access": "public"
},
"dependencies": {
"@alitajs/aconsole": "2.8.15-alpha.2",
"@alitajs/cordova": "2.8.15-alpha.2",
"@alitajs/generate": "2.8.15-alpha.2",
"@alitajs/hd": "2.8.15-alpha.2",
"@alitajs/keep-alive": "2.8.15-alpha.2",
"@alitajs/layout": "2.8.15-alpha.2",
"@alitajs/main-path": "2.8.15-alpha.2",
"@alitajs/plugin-dva": "2.8.15-alpha.2",
"@alitajs/plugin-layout": "2.8.15-alpha.2",
"@alitajs/retain-log": "2.8.15-alpha.2",
"@alitajs/router": "2.8.15-alpha.2",
"@alitajs/routes": "2.8.15-alpha.2",
"@alitajs/aconsole": "2.8.15-alpha.3",
"@alitajs/cordova": "2.8.15-alpha.3",
"@alitajs/generate": "2.8.15-alpha.3",
"@alitajs/hd": "2.8.15-alpha.3",
"@alitajs/keep-alive": "2.8.15-alpha.3",
"@alitajs/layout": "2.8.15-alpha.3",
"@alitajs/main-path": "2.8.15-alpha.3",
"@alitajs/plugin-dva": "2.8.15-alpha.3",
"@alitajs/plugin-layout": "2.8.15-alpha.3",
"@alitajs/retain-log": "2.8.15-alpha.3",
"@alitajs/router": "2.8.15-alpha.3",
"@alitajs/routes": "2.8.15-alpha.3",
"@umijs/plugin-antd": "0.9.1",
"@umijs/plugin-esbuild": "1.3.1",
"@umijs/plugin-helmet": "1.1.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/umi-presets-micro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/umi-presets-micro",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/umi-presets-micro",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -25,7 +25,7 @@
"access": "public"
},
"dependencies": {
"@alitajs/micro": "2.8.15-alpha.2",
"@alitajs/native": "2.8.15-alpha.2"
"@alitajs/micro": "2.8.15-alpha.3",
"@alitajs/native": "2.8.15-alpha.3"
}
}
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alitajs/utils",
"version": "2.8.15-alpha.2",
"version": "2.8.15-alpha.3",
"description": "@alitajs/utils",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
Loading

0 comments on commit 753b214

Please sign in to comment.