@unocss/preset-web-fonts 0.62.2 → 0.62.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +18 -18
- package/dist/local.mjs +2 -2
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -26,6 +26,24 @@ const BunnyFontsProvider = createBunnyFontsProvider(
|
|
|
26
26
|
"https://fonts.bunny.net"
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
+
const FontshareProvider = createFontshareProvider("fontshare", "https://api.fontshare.com");
|
|
30
|
+
function createFontshareProvider(name, host) {
|
|
31
|
+
return {
|
|
32
|
+
name,
|
|
33
|
+
getImportUrl(fonts) {
|
|
34
|
+
const strings = fonts.map((f) => {
|
|
35
|
+
let name2 = f.name.replace(/\s+/g, "-").toLocaleLowerCase();
|
|
36
|
+
if (f.weights?.length)
|
|
37
|
+
name2 += `@${f.weights.flatMap((w) => f.italic ? Number(w) + 1 : w).sort().join()}`;
|
|
38
|
+
else
|
|
39
|
+
name2 += `@${f.italic ? 2 : 1}`;
|
|
40
|
+
return `f[]=${name2}`;
|
|
41
|
+
}).join("&");
|
|
42
|
+
return `${host}/v2/css?${strings}&display=swap`;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
function createGoogleCompatibleProvider(name, host) {
|
|
30
48
|
return {
|
|
31
49
|
name,
|
|
@@ -48,24 +66,6 @@ function createGoogleCompatibleProvider(name, host) {
|
|
|
48
66
|
}
|
|
49
67
|
const GoogleFontsProvider = createGoogleCompatibleProvider("google", "https://fonts.googleapis.com");
|
|
50
68
|
|
|
51
|
-
const FontshareProvider = createFontshareProvider("fontshare", "https://api.fontshare.com");
|
|
52
|
-
function createFontshareProvider(name, host) {
|
|
53
|
-
return {
|
|
54
|
-
name,
|
|
55
|
-
getImportUrl(fonts) {
|
|
56
|
-
const strings = fonts.map((f) => {
|
|
57
|
-
let name2 = f.name.replace(/\s+/g, "-").toLocaleLowerCase();
|
|
58
|
-
if (f.weights?.length)
|
|
59
|
-
name2 += `@${f.weights.flatMap((w) => f.italic ? Number(w) + 1 : w).sort().join()}`;
|
|
60
|
-
else
|
|
61
|
-
name2 += `@${f.italic ? 2 : 1}`;
|
|
62
|
-
return `f[]=${name2}`;
|
|
63
|
-
}).join("&");
|
|
64
|
-
return `${host}/v2/css?${strings}&display=swap`;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
69
|
const NoneProvider = {
|
|
70
70
|
name: "none",
|
|
71
71
|
getPreflight() {
|
package/dist/local.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
1
2
|
import { createHash } from 'node:crypto';
|
|
2
3
|
import fs from 'node:fs';
|
|
3
4
|
import fsp from 'node:fs/promises';
|
|
4
|
-
import process from 'node:process';
|
|
5
5
|
import { resolve, join } from 'node:path';
|
|
6
|
-
import
|
|
6
|
+
import process from 'node:process';
|
|
7
7
|
import { fetch } from 'ofetch';
|
|
8
8
|
|
|
9
9
|
function replaceAsync(string, searchValue, replacer) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-web-fonts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.62.
|
|
4
|
+
"version": "0.62.4",
|
|
5
5
|
"description": "Web Fonts support for Uno CSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"ofetch": "^1.3.4",
|
|
53
|
-
"@unocss/core": "0.62.
|
|
53
|
+
"@unocss/core": "0.62.4"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "unbuild",
|