Skip to content

Commit 97169d3

Browse files
committed
chore: 发布 vite-plugin-font
1 parent fda877b commit 97169d3

File tree

5 files changed

+154
-156
lines changed

5 files changed

+154
-156
lines changed

packages/subsets/package.json

+71-71
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
{
2-
"name": "@konghayao/cn-font-split",
3-
"version": "4.12.0",
4-
"description": "中文 web font 切割工具",
5-
"main": "dist/index.js",
6-
"browser": "dist/browser/index.js",
7-
"type": "module",
8-
"bin": {
9-
"cn-font-split": "bin/cn-font-split.mjs"
10-
},
11-
"repository": {
12-
"type": "git",
13-
"url": "https://github.com/KonghaYao/cn-font-split/tree/ts/packages/subsets"
14-
},
15-
"homepage": "https://chinese-font.netlify.app/",
16-
"scripts": {
17-
"build": "rollup -c ",
18-
"dev": "rollup -c -w",
19-
"build:browser": "rollup -c rollup.config.browser.mjs ",
20-
"dev:browser": "rollup -c rollup.config.browser.mjs -w",
21-
"test": "vitest",
22-
"test:node": "node ./test/node.test.mjs",
23-
"test:deno": "deno run -A --no-npm ./test/deno.test.js",
24-
"test:bun": "bun run ./test/bun.test.mjs",
25-
"test:browser": "live-server --port=9000 --cors --no-browser ./dist/browser&&vitest --mode browser test/browser.test.js",
26-
"coverage": "vitest run --coverage",
27-
"prepublish": "tsc && pnpm build && pnpm build:browser && tsc"
28-
},
29-
"keywords": [
30-
"font",
31-
"converter",
32-
"performance",
33-
"wasm",
34-
"woff2",
35-
"ttf",
36-
"otf",
37-
"opentype-fonts",
38-
"font-subsetter",
39-
"font-subset",
40-
"cjk"
41-
],
42-
"author": "KonghaYao<[email protected]>",
43-
"license": "Apache-2.0",
44-
"dependencies": {
45-
"@chinese-fonts/font-contours": "^1.0.0",
46-
"@chinese-fonts/wawoff2": "2.0.5",
47-
"@japont/unicode-range": "^1.0.0",
48-
"@konghayao/harfbuzzjs": "8.3.1",
49-
"@konghayao/opentype.js": "2024.3.19",
50-
"@napi-rs/woff-build": "^0.2.0",
51-
"byte-size": "^8.1.1",
52-
"font-sharp": "workspace:^",
53-
"fs-extra": "^11.1.1",
54-
"md5": "^2.3.0",
55-
"os-locale": "^6.0.2",
56-
"tslog": "^4.9.2",
57-
"workerpool": "^9.1.1"
58-
},
59-
"devDependencies": {
60-
"@rollup/plugin-terser": "^0.4.4",
61-
"@types/byte-size": "^8.1.1",
62-
"@types/md5": "^2.3.4",
63-
"@types/opentype.js": "^1.3.7",
64-
"@types/workerpool": "^6.4.5",
65-
"@vitest/browser": "^1.6.0",
66-
"comlink": "^4.4.1",
67-
"live-server": "^1.2.2",
68-
"path-browserify": "^1.0.1",
69-
"resolve": "^1.22.8",
70-
"vitest": "^1.6.0",
71-
"webdriverio": "^8.20.4"
72-
}
2+
"name": "@konghayao/cn-font-split",
3+
"version": "4.13.0",
4+
"description": "中文 web font 切割工具",
5+
"main": "dist/index.js",
6+
"browser": "dist/browser/index.js",
7+
"type": "module",
8+
"bin": {
9+
"cn-font-split": "bin/cn-font-split.mjs"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/KonghaYao/cn-font-split/tree/ts/packages/subsets"
14+
},
15+
"homepage": "https://chinese-font.netlify.app/",
16+
"scripts": {
17+
"build": "rollup -c ",
18+
"dev": "rollup -c -w",
19+
"build:browser": "rollup -c rollup.config.browser.mjs ",
20+
"dev:browser": "rollup -c rollup.config.browser.mjs -w",
21+
"test": "vitest",
22+
"test:node": "node ./test/node.test.mjs",
23+
"test:deno": "deno run -A --no-npm ./test/deno.test.js",
24+
"test:bun": "bun run ./test/bun.test.mjs",
25+
"test:browser": "live-server --port=9000 --cors --no-browser ./dist/browser&&vitest --mode browser test/browser.test.js",
26+
"coverage": "vitest run --coverage",
27+
"prepublish": "tsc && pnpm build && pnpm build:browser && tsc"
28+
},
29+
"keywords": [
30+
"font",
31+
"converter",
32+
"performance",
33+
"wasm",
34+
"woff2",
35+
"ttf",
36+
"otf",
37+
"opentype-fonts",
38+
"font-subsetter",
39+
"font-subset",
40+
"cjk"
41+
],
42+
"author": "KonghaYao<[email protected]>",
43+
"license": "Apache-2.0",
44+
"dependencies": {
45+
"@chinese-fonts/font-contours": "^1.0.0",
46+
"@chinese-fonts/wawoff2": "2.0.5",
47+
"@japont/unicode-range": "^1.0.0",
48+
"@konghayao/harfbuzzjs": "8.3.1",
49+
"@konghayao/opentype.js": "2024.3.19",
50+
"@napi-rs/woff-build": "^0.2.0",
51+
"byte-size": "^8.1.1",
52+
"font-sharp": "workspace:^",
53+
"fs-extra": "^11.1.1",
54+
"md5": "^2.3.0",
55+
"os-locale": "^6.0.2",
56+
"tslog": "^4.9.2",
57+
"workerpool": "^9.1.1"
58+
},
59+
"devDependencies": {
60+
"@rollup/plugin-terser": "^0.4.4",
61+
"@types/byte-size": "^8.1.1",
62+
"@types/md5": "^2.3.4",
63+
"@types/opentype.js": "^1.3.7",
64+
"@types/workerpool": "^6.4.5",
65+
"@vitest/browser": "^1.6.0",
66+
"comlink": "^4.4.1",
67+
"live-server": "^1.2.2",
68+
"path-browserify": "^1.0.1",
69+
"resolve": "^1.22.8",
70+
"vitest": "^1.6.0",
71+
"webdriverio": "^8.20.4"
72+
}
7373
}

packages/vite/README.md

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
# 🔠 vite-plugin-cn-font-split
1+
# 🔠 vite-plugin-font ⚡
22

33
[中文](./README_zh.md) | [english](./README.md)
44

5-
[vite-plugin-cn-font-split](https://www.npmjs.com/package/vite-plugin-cn-font-split) is a font building tool for [Chinese web fonts project](https://chinese-font.netlify.app) supported by Vite. It can split large fonts into Webfonts, with powerful performance and simplicity. vite-plugin-cn-font-split is supported by [cn-font-split](https://www.npmjs.com/package/cn-font-split).
5+
[vite-plugin-font](https://www.npmjs.com/package/vite-plugin-font) is a font building tool for [Chinese web fonts project](https://chinese-font.netlify.app) supported by Vite. It can split large fonts into Webfonts, with powerful performance and simplicity. vite-plugin-font is supported by [cn-font-split](https://www.npmjs.com/package/cn-font-split).
66

77
## 📦 Install
88

99
```sh
10-
npm i -D vite-plugin-cn-font-split
10+
npm i -D vite-plugin-font
1111
```
1212

1313
```js
1414
// vite.config.js
1515
import { defineConfig } from 'vite';
16-
import viteFont from 'vite-plugin-cn-font-split';
16+
import viteFont from 'vite-plugin-font';
1717
export default defineConfig({
18-
plugins: [viteFont()],
18+
plugins: [viteFont()],
1919
});
2020
```
2121

22-
2322
```jsx
2423
// Automatically inject CSS to import fonts, and support tree shaking optimization of font information!
25-
import { css } from '../../demo/public/SmileySans-Oblique.ttf'; // Directly import font files
24+
import { css } from '../../demo/public/SmileySans-Oblique.ttf'; // Directly import font files
2625
console.log(css.family, css.weight); // You can get CSS-related data from here
2726

28-
export const App = ()=>{
29-
return <div style={{
30-
fontFamily: css.family
31-
}}></div>
32-
}
33-
27+
export const App = () => {
28+
return (
29+
<div
30+
style={{
31+
fontFamily: css.family,
32+
}}
33+
></div>
34+
);
35+
};
3436
```
3537

3638
## Typescript Support
@@ -40,12 +42,11 @@ The source code includes the `src/font.d.ts` file, which you can add to your `ts
4042
```ts
4143
{
4244
\"compilerOptions\": {
43-
\"types\": [\"vite-plugin-cn-font-split/src/font.d\"]
45+
\"types\": [\"vite-plugin-font/src/font.d\"]
4446
}
4547
}
4648
```
4749

48-
4950
## Input Parameters
5051

51-
Please refer to the usage instructions of [cn-font-split](https://www.npmjs.com/package/cn-font-split) for input parameters, most of which are common.
52+
Please refer to the usage instructions of [cn-font-split](https://www.npmjs.com/package/cn-font-split) for input parameters, most of which are common.

packages/vite/README_zh.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
# 🔠 vite-plugin-cn-font-split
1+
# 🔠 vite-plugin-font ⚡
22

33
[中文](./README_zh.md) | [english](./README.md)
44

5-
[中文网字计划](https://chinese-font.netlify.app) 开发支持的 vite 字体构建工具。 vite-plugin-cn-font-split 可以将庞大的字体切割成 Webfonts,性能强大且简单。vite-plugin-cn-font-split 由 [cn-font-split](https://www.npmjs.com/package/cn-font-split) 支持
6-
5+
[中文网字计划](https://chinese-font.netlify.app) 开发支持的 vite 字体构建工具。 vite-plugin-font 可以将庞大的字体切割成 Webfonts,性能强大且简单。vite-plugin-font 由 [cn-font-split](https://www.npmjs.com/package/cn-font-split) 支持
76

87
## 📦 Install
98

109
```sh
11-
npm i -D vite-plugin-cn-font-split
10+
npm i -D vite-plugin-font
1211
```
1312

1413
```js
1514
// vite.config.js
1615
import { defineConfig } from 'vite';
17-
import viteFont from 'vite-plugin-cn-font-split';
16+
import viteFont from 'vite-plugin-font';
1817
export default defineConfig({
1918
plugins: [viteFont()],
2019
});
2120
```
2221

23-
2422
```jsx
2523
// 自动注入 css 导入字体,并且支持字体信息的摇树优化!
26-
import { css } from '../../demo/public/SmileySans-Oblique.ttf'; // 直接 import 字体文件
24+
import { css } from '../../demo/public/SmileySans-Oblique.ttf'; // 直接 import 字体文件
2725
console.log(css.family, css.weight); // 你可以从这里得到 css 相关的数据
2826

29-
export const App = ()=>{
30-
return <div style={{
31-
fontFamily: css.family
32-
}}></div>
33-
}
34-
27+
export const App = () => {
28+
return (
29+
<div
30+
style={{
31+
fontFamily: css.family,
32+
}}
33+
></div>
34+
);
35+
};
3536
```
3637

3738
## Typescript 支持
@@ -41,12 +42,11 @@ export const App = ()=>{
4142
```ts
4243
{
4344
"compilerOptions": {
44-
"types": ["vite-plugin-cn-font-split/src/font.d"]
45+
"types": ["vite-plugin-font/src/font.d"]
4546
}
4647
}
4748
```
4849

49-
5050
## 输入参数
5151

52-
输入参数请见 [cn-font-split](https://www.npmjs.com/package/cn-font-split) 使用说明,大部分参数都是通用的。
52+
输入参数请见 [cn-font-split](https://www.npmjs.com/package/cn-font-split) 使用说明,大部分参数都是通用的。

packages/vite/package.json

+49-52
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,50 @@
11
{
2-
"version": "0.1.0",
3-
"name": "vite-plugin-cn-font-split",
4-
"description": "Vite plugin for bundle otf,ttf... font to webfonts",
5-
"main": "./dist/index.js",
6-
"type": "module",
7-
"repository": {
8-
"type": "git",
9-
"url": "git+https://github.com/KonghaYao/cn-font-split.git"
10-
},
11-
"files": [
12-
"dist",
13-
"src"
14-
],
15-
"author": "KonghaYao<[email protected]>",
16-
"license": "Apache-2.0",
17-
"scripts": {
18-
"build": "tsc -p tsconfig.node.json",
19-
"dev": "vite",
20-
"prepublish": "pnpm build"
21-
},
22-
"keywords": [
23-
"vite",
24-
"vite-plugin",
25-
"web-font",
26-
"webfont",
27-
"vue",
28-
"react",
29-
"converter",
30-
"performance",
31-
"wasm",
32-
"woff2",
33-
"ttf",
34-
"otf",
35-
"opentype-fonts",
36-
"font-subsetter",
37-
"font-subset",
38-
"cjk"
39-
],
40-
"peerDependencies": {
41-
"vite": "^2 || ^3 || ^4 || ^5"
42-
},
43-
"devDependencies": {
44-
"vite": "^5"
45-
},
46-
"dependencies": {
47-
"@konghayao/cn-font-split": "workspace:^"
48-
},
49-
"bugs": {
50-
"url": "https://github.com/KonghaYao/cn-font-split/issues"
51-
},
52-
"homepage": "https://chinese-font.netlify.app"
53-
}
2+
"version": "0.2.0",
3+
"name": "vite-plugin-font",
4+
"description": "Vite plugin for bundle otf,ttf... font to webfonts",
5+
"main": "./dist/index.js",
6+
"type": "module",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/KonghaYao/cn-font-split.git"
10+
},
11+
"files": ["dist", "src"],
12+
"author": "KonghaYao<[email protected]>",
13+
"license": "Apache-2.0",
14+
"scripts": {
15+
"build": "tsc -p tsconfig.node.json",
16+
"dev": "vite",
17+
"prepublish": "pnpm build"
18+
},
19+
"keywords": [
20+
"vite",
21+
"vite-plugin",
22+
"web-font",
23+
"webfont",
24+
"vue",
25+
"react",
26+
"converter",
27+
"performance",
28+
"wasm",
29+
"woff2",
30+
"ttf",
31+
"otf",
32+
"opentype-fonts",
33+
"font-subsetter",
34+
"font-subset",
35+
"cjk"
36+
],
37+
"peerDependencies": {
38+
"vite": "^2 || ^3 || ^4 || ^5"
39+
},
40+
"devDependencies": {
41+
"vite": "^5"
42+
},
43+
"dependencies": {
44+
"@konghayao/cn-font-split": "workspace:^"
45+
},
46+
"bugs": {
47+
"url": "https://github.com/KonghaYao/cn-font-split/issues"
48+
},
49+
"homepage": "https://chinese-font.netlify.app"
50+
}

packages/vite/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function split(
1717
let viteConfig;
1818
let cacheDir = config.cacheDir;
1919
return <Plugin>{
20-
name: 'vite-plugin-cn-font-split',
20+
name: 'vite-plugin-font',
2121
enforce: 'pre',
2222
configResolved(c) {
2323
viteConfig = c;

0 commit comments

Comments
 (0)