Skip to content

Commit 42a42a8

Browse files
committed
feat: 完成完整的重构
1 parent 5021e29 commit 42a42a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1471
-2021
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
```typescript
1010
import { parse } from '@tarojs/parse-css-to-stylesheet'
1111

12-
const code = parse(jsxCode, [cssCode1, cssCode2, ...])
12+
// Harmony
13+
const code = parse(jsxCode, [cssCode1, cssCode2, ...], "Harmony")
14+
// ReactNative
15+
// const code = parse(jsxCode, [cssCode1, cssCode2, ...], "ReactNative")
1316

1417
```

__test__/fixure/rn/index.jsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

__test__/fixure/rn/index.scss

Lines changed: 0 additions & 13 deletions
This file was deleted.

__test__/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const fs = require('fs')
22
const path = require('path')
33
process.env.platform = 'arm64'
44
const { parse } = require('../index.js')
5-
const component = fs.readFileSync(path.resolve(__dirname, 'fixure/rn/index.jsx'), 'utf8')
6-
const css1 = fs.readFileSync(path.resolve(__dirname, 'fixure/rn/index.scss'), 'utf8')
7-
const code = parse(component, [css1])
5+
const component = fs.readFileSync(path.resolve(__dirname, 'fixure/mod.jsx'), 'utf8')
6+
const css1 = fs.readFileSync(path.resolve(__dirname, 'fixure/Mod.scss'), 'utf8')
7+
const code = parse(component, [css1], "ReactNative")
88

99
console.log(code)

__test__/index.spec.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,20 @@ import test from 'ava'
99

1010
import { parse } from '../index.js'
1111

12-
test('test parse', (t) => {
12+
test('test parse Harmony', (t) => {
1313
const jsx = fs.readFileSync(path.resolve(__dirname, 'fixure/mod.jsx'), 'utf8')
1414
const css1 = fs.readFileSync(path.resolve(__dirname, 'fixure/Mod.scss'), 'utf8')
1515
const css2 = fs.readFileSync(path.resolve(__dirname, 'fixure/test.scss'), 'utf8')
1616

17-
const code = parse(jsx, [css1, css2])
17+
const code = parse(jsx, [css1, css2], "Harmony")
18+
t.snapshot(code)
19+
})
20+
21+
test('test parse ReactNative', (t) => {
22+
const jsx = fs.readFileSync(path.resolve(__dirname, 'fixure/mod.jsx'), 'utf8')
23+
const css1 = fs.readFileSync(path.resolve(__dirname, 'fixure/Mod.scss'), 'utf8')
24+
const css2 = fs.readFileSync(path.resolve(__dirname, 'fixure/test.scss'), 'utf8')
25+
26+
const code = parse(jsx, [css1, css2], "ReactNative")
1827
t.snapshot(code)
1928
})

0 commit comments

Comments
 (0)