Skip to content

Commit c53a82e

Browse files
committed
fix: standardize quotes in FUNDING.yml and release.yml, improve type assertions in transformCss.ts
1 parent ebf6140 commit c53a82e

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

.github/workflows/ci.yml

+27-28
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
branches:
1010
- main
1111

12-
merge_group: {}
13-
1412
jobs:
1513
lint:
1614
runs-on: ubuntu-latest
@@ -19,14 +17,11 @@ jobs:
1917

2018
- name: Install pnpm
2119
uses: pnpm/action-setup@v4
22-
with:
23-
version: 9
2420

2521
- name: Set node
2622
uses: actions/setup-node@v4
2723
with:
28-
node-version: 18.18.2
29-
cache: pnpm
24+
node-version: lts/*
3025

3126
- name: Setup
3227
run: npm i -g @antfu/ni
@@ -37,40 +32,47 @@ jobs:
3732
- name: Lint
3833
run: nr lint
3934

35+
typecheck:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Install pnpm
41+
uses: pnpm/action-setup@v4
42+
43+
- name: Set node
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: lts/*
47+
48+
- name: Setup
49+
run: npm i -g @antfu/ni
50+
51+
- name: Install
52+
run: nci
53+
54+
- name: Typecheck
55+
run: nr typecheck
56+
4057
test:
4158
runs-on: ${{ matrix.os }}
4259

4360
strategy:
4461
matrix:
45-
os: [ubuntu-latest]
46-
node_version: [18.18.2, lts/*]
47-
include:
48-
- os: macos-latest
49-
node_version: lts/*
50-
- os: windows-latest
51-
node_version: lts/*
62+
node: [lts/*]
63+
os: [ubuntu-latest, windows-latest, macos-latest]
5264
fail-fast: false
5365

5466
steps:
55-
- name: Set git to use LF
56-
run: |
57-
git config --global core.autocrlf false
58-
git config --global core.eol lf
59-
6067
- uses: actions/checkout@v4
6168

6269
- name: Install pnpm
6370
uses: pnpm/action-setup@v4
64-
with:
65-
version: 9
6671

67-
- name: Set node ${{ matrix.node_version }}
72+
- name: Set node ${{ matrix.node }}
6873
uses: actions/setup-node@v4
6974
with:
70-
node-version: ${{ matrix.node_version }}
71-
cache: pnpm
72-
73-
- run: corepack enable
75+
node-version: ${{ matrix.node }}
7476

7577
- name: Setup
7678
run: npm i -g @antfu/ni
@@ -83,6 +85,3 @@ jobs:
8385

8486
- name: Test
8587
run: nr test
86-
87-
- name: Typecheck
88-
run: nr typecheck

src/transformCss.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ function findSameSource(allChange: AllChange[]) {
614614
return result
615615
}
616616

617+
const skipTransformFlag = Symbol('skipTransformFlag')
617618
async function getConflictClass(
618619
allChange: AllChange[],
619620
): Promise<[string, (code: string) => string]> {
@@ -635,7 +636,9 @@ async function getConflictClass(
635636
map[key] = [calculateWeight(name), value]
636637
}
637638
else {
638-
const [preWeight] = map[key]
639+
const [preWeight] = map[key] as any
640+
if (preWeight === skipTransformFlag)
641+
return
639642
const curWeight = calculateWeight(name)
640643
if (+curWeight > +preWeight)
641644
map[key] = [+curWeight, value]
@@ -674,12 +677,11 @@ async function getConflictClass(
674677
// 提前处理 map
675678
const joinMap = Object.keys(map)
676679
.map((key) => {
677-
const value = map[key][1]
680+
const value = map[key][1] as string
678681
return `${key}:${value}`
679682
})
680683
.join(';')
681684
const { transformedResult, newStyle } = transformStyleToUnocssPre(joinMap)
682-
const skipTransformFlag = Symbol('skipTransformFlag')
683685
if (transformedResult) {
684686
// map 赋值新 newStyle
685687
map = newStyle.split(';').reduce(
@@ -704,7 +706,10 @@ async function getConflictClass(
704706
let transferCss
705707
= map[key][1] === skipTransformFlag
706708
? key
707-
: transformStyleToUnocss(`${key}:${map[key][1]}`, isRem)[0]
709+
: transformStyleToUnocss(
710+
`${key}:${map[key][1] as string}`,
711+
isRem,
712+
)[0]
708713

709714
const match = transferCss.match(/(\S*)="\[([^\]]*)\]"/)
710715
if (match) {

0 commit comments

Comments
 (0)