Skip to content

Commit 7a33c9a

Browse files
committed
chore: bump version
1 parent ac81a72 commit 7a33c9a

10 files changed

Lines changed: 370 additions & 180 deletions

File tree

.changeset/ten-experts-shake.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@weapp-tailwindcss/postcss": patch
3+
---
4+
5+
## Fix
6+
7+
fix: 使用 rounded-full 单位时出现 infinity 问题,只在 taro 默认转化 rpx 情况下出现
8+
9+
https://github.com/sonofmagic/weapp-tailwindcss/issues/695
10+
11+
参考链接:
12+
13+
https://github.com/tailwindlabs/tailwindcss/blob/77b3cb5318840925d8a75a11cc90552a93507ddc/packages/tailwindcss/src/utilities.ts#L2128

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@
217217
"prettier": "^3.6.2",
218218
"promisify-loader-runner": "^1.0.1",
219219
"rimraf": "^6.0.1",
220-
"sass": "^1.92.0",
221-
"sass-embedded": "^1.92.0",
220+
"sass": "^1.92.1",
221+
"sass-embedded": "^1.92.1",
222222
"sass-true": "^9.0.0",
223223
"semver": "7.7.2",
224224
"set-value": "^4.1.0",
@@ -235,7 +235,7 @@
235235
"turbo": "^2.5.6",
236236
"typescript": "^5.9.2",
237237
"unbuild": "^3.6.1",
238-
"uuid": "^11.1.0",
238+
"uuid": "^12.0.0",
239239
"vinyl": "^3.0.1",
240240
"vinyl-fs": "^4.0.2",
241241
"vite": "^7.1.4",

packages/postcss/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
},
5858
"devDependencies": {
5959
"@weapp-tailwindcss/mangle": "workspace:*",
60+
"postcss-calc": "^10.1.1",
6061
"postcss-value-parser": "^4.2.0"
6162
}
6263
}

packages/postcss/src/plugins/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { AcceptedPlugin } from 'postcss'
22
import type { IStyleHandlerOptions } from '../types'
3+
// import calc from 'postcss-calc'
34
import postcssPresetEnv from 'postcss-preset-env'
45
import postcssRem2rpx from 'postcss-rem-to-responsive-pixel'
56
import { createContext } from './ctx'
@@ -17,6 +18,7 @@ export function getPlugins(options: IStyleHandlerOptions) {
1718
const plugins: AcceptedPlugin[] = [
1819
...(options.postcssOptions?.plugins ?? []),
1920
pre(options),
21+
// calc({ }),
2022
postcssPresetEnv(options.cssPresetEnv),
2123
]
2224
if (options.rem2rpx) {

packages/postcss/src/plugins/post.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ const postcssWeappTailwindcssPostPlugin: PostcssWeappTailwindcssRenamePlugin = (
4747
}
4848
/**
4949
* @description 移除 calc(infinity * 1px)
50+
* https://github.com/tailwindlabs/tailwindcss/blob/77b3cb5318840925d8a75a11cc90552a93507ddc/packages/tailwindcss/src/utilities.ts#L2128
5051
*/
51-
else if (/calc\(\s*infinity\s*\*\s*1px/.test(decl.value)) {
52+
else if (/calc\(\s*infinity\s*\*\s*1r?px/.test(decl.value)) {
5253
decl.value = '9999px'
5354
}
5455
}

packages/postcss/test/__snapshots__/issues.test.ts.snap

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,133 @@ view,text,:after,:before,::backdrop {
689689
}"
690690
`;
691691

692+
exports[`issues > https://github.com/sonofmagic/weapp-tailwindcss/issues/695 1`] = `
693+
"*,:after,:before,::backdrop {
694+
box-sizing: border-box;
695+
border: 0 solid;
696+
margin: 0;
697+
padding: 0;
698+
}
699+
.rounded-full {
700+
border-radius: calc(infinity * 1px);
701+
}
702+
.rounded-s-full {
703+
border-start-start-radius: calc(infinity * 1px);
704+
border-end-start-radius: calc(infinity * 1px);
705+
}
706+
.rounded-ss-full {
707+
border-start-start-radius: calc(infinity * 1px);
708+
}
709+
.rounded-e-full {
710+
border-start-end-radius: calc(infinity * 1px);
711+
border-end-end-radius: calc(infinity * 1px);
712+
}
713+
.rounded-se-full {
714+
border-start-end-radius: calc(infinity * 1px);
715+
}
716+
.rounded-ee-full {
717+
border-end-end-radius: calc(infinity * 1px);
718+
}
719+
.rounded-es-full {
720+
border-end-start-radius: calc(infinity * 1px);
721+
}
722+
.rounded-t-full {
723+
border-top-left-radius: calc(infinity * 1px);
724+
border-top-right-radius: calc(infinity * 1px);
725+
}
726+
.rounded-l-full {
727+
border-top-left-radius: calc(infinity * 1px);
728+
border-bottom-left-radius: calc(infinity * 1px);
729+
}
730+
.rounded-tl-full {
731+
border-top-left-radius: calc(infinity * 1px);
732+
}
733+
.rounded-r-full {
734+
border-top-right-radius: calc(infinity * 1px);
735+
border-bottom-right-radius: calc(infinity * 1px);
736+
}
737+
.rounded-tr-full {
738+
border-top-right-radius: calc(infinity * 1px);
739+
}
740+
.rounded-b-full {
741+
border-bottom-right-radius: calc(infinity * 1px);
742+
border-bottom-left-radius: calc(infinity * 1px);
743+
}
744+
.rounded-br-full {
745+
border-bottom-right-radius: calc(infinity * 1px);
746+
}
747+
.rounded-bl-full {
748+
border-bottom-left-radius: calc(infinity * 1px);
749+
}"
750+
`;
751+
752+
exports[`issues > https://github.com/sonofmagic/weapp-tailwindcss/issues/695 2`] = `
753+
"view,text,:after,:before,::backdrop {
754+
box-sizing: border-box;
755+
border: 0 solid;
756+
margin: 0;
757+
padding: 0;
758+
}
759+
.rounded-full {
760+
border-radius: 9999px;
761+
}
762+
.rounded-s-full {
763+
border-top-left-radius: 9999px;
764+
border-bottom-left-radius: 9999px;
765+
}
766+
.rounded-ss-full {
767+
border-top-left-radius: 9999px;
768+
}
769+
.rounded-e-full {
770+
border-top-right-radius: 9999px;
771+
border-bottom-right-radius: 9999px;
772+
}
773+
.rounded-se-full {
774+
border-top-right-radius: 9999px;
775+
}
776+
.rounded-ee-full {
777+
border-bottom-right-radius: 9999px;
778+
}
779+
.rounded-es-full {
780+
border-bottom-left-radius: 9999px;
781+
}
782+
.rounded-t-full {
783+
border-top-left-radius: 9999px;
784+
border-top-right-radius: 9999px;
785+
}
786+
.rounded-l-full {
787+
border-top-left-radius: 9999px;
788+
border-bottom-left-radius: 9999px;
789+
}
790+
.rounded-tl-full {
791+
border-top-left-radius: 9999px;
792+
}
793+
.rounded-r-full {
794+
border-top-right-radius: 9999px;
795+
border-bottom-right-radius: 9999px;
796+
}
797+
.rounded-tr-full {
798+
border-top-right-radius: 9999px;
799+
}
800+
.rounded-b-full {
801+
border-bottom-right-radius: 9999px;
802+
border-bottom-left-radius: 9999px;
803+
}
804+
.rounded-br-full {
805+
border-bottom-right-radius: 9999px;
806+
}
807+
.rounded-bl-full {
808+
border-bottom-left-radius: 9999px;
809+
}"
810+
`;
811+
812+
exports[`issues > https://github.com/sonofmagic/weapp-tailwindcss/issues/695 taro rpx case 1`] = `
813+
".rounded-full {
814+
border-radius: 9999px;
815+
}
816+
"
817+
`;
818+
692819
exports[`issues > space-x-number 1`] = `
693820
"@layer properties;
694821
:root, :host {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<view class="rounded-full"></view>
2+
['rounded-full', ['border-radius']],
3+
['rounded-s-full', ['border-start-start-radius', 'border-end-start-radius']],
4+
['rounded-e-full', ['border-start-end-radius', 'border-end-end-radius']],
5+
['rounded-t-full', ['border-top-left-radius', 'border-top-right-radius']],
6+
['rounded-r-full', ['border-top-right-radius', 'border-bottom-right-radius']],
7+
['rounded-b-full', ['border-bottom-right-radius', 'border-bottom-left-radius']],
8+
['rounded-l-full', ['border-top-left-radius', 'border-bottom-left-radius']],
9+
['rounded-ss-full', ['border-start-start-radius']],
10+
['rounded-se-full', ['border-start-end-radius']],
11+
['rounded-ee-full', ['border-end-end-radius']],
12+
['rounded-es-full', ['border-end-start-radius']],
13+
['rounded-tl-full', ['border-top-left-radius']],
14+
['rounded-tr-full', ['border-top-right-radius']],
15+
['rounded-br-full', ['border-bottom-right-radius']],
16+
['rounded-bl-full', ['border-bottom-left-radius']],

packages/postcss/test/issues.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,33 @@ describe('issues', () => {
9393
expect(css).toMatchSnapshot()
9494
})
9595

96+
it('https://github.com/sonofmagic/weapp-tailwindcss/issues/695', async () => {
97+
const code = await generateCss(path.resolve(__dirname, './fixtures/issues/695'))
98+
expect(code.css).toMatchSnapshot()
99+
const styleHandler = createStyleHandler({
100+
isMainChunk: true,
101+
})
102+
const { css } = await styleHandler(code.css, {
103+
isMainChunk: true,
104+
})
105+
expect(css).toMatchSnapshot()
106+
})
107+
// https://developer.mozilla.org/en-US/docs/Web/CSS/calc-keyword
108+
it('https://github.com/sonofmagic/weapp-tailwindcss/issues/695 taro rpx case', async () => {
109+
const code = `.rounded-full {
110+
border-radius: calc(infinity * 1rpx);
111+
}
112+
`
113+
114+
const styleHandler = createStyleHandler({
115+
isMainChunk: true,
116+
})
117+
const { css } = await styleHandler(code, {
118+
isMainChunk: true,
119+
})
120+
expect(css).toMatchSnapshot()
121+
})
122+
96123
it('space-x-number', async () => {
97124
const code = await generateCss(path.resolve(__dirname, './fixtures/issues/space-x-number'), [autoprefixer({
98125
add: true,

0 commit comments

Comments
 (0)