webfont 12.1.0 → 12.2.0
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/README.md +58 -12
- package/dist/cli.mjs +875 -772
- package/dist/index.js +1 -1
- package/dist/index.mjs +523 -0
- package/dist/{parseTemplateOption-5T7rSw5J.mjs → parseTemplateOption-Bvbie1SQ.mjs} +0 -1
- package/dist/parseTemplateOption-DLNu6PPx.mjs +38 -0
- package/dist/{renderTemplates-DvRlS58E.mjs → renderTemplates-Biyrk6t-.mjs} +16 -17
- package/dist/renderTemplates-CXVKq3Op.mjs +102 -0
- package/dist/src/browser.d.mts +2 -0
- package/dist/src/index.d.mts +5 -0
- package/dist/src/lib/applyOptimizeSvgToGlyphs.d.mts +3 -0
- package/dist/src/lib/evenoddFillRule.d.mts +2 -0
- package/dist/src/lib/execCLI/index.d.mts +24 -0
- package/dist/src/lib/inputSource.d.mts +2 -0
- package/dist/src/lib/inputSourceUtils.d.mts +4 -0
- package/dist/src/lib/largeFontLigatures.d.mts +4 -0
- package/dist/src/lib/optimizeSvgGlyphs.d.mts +4 -0
- package/dist/src/lib/p-limit/index.d.mts +2 -0
- package/dist/src/lib/parseFormats.d.mts +4 -0
- package/dist/src/lib/parseTemplateOption.d.mts +2 -0
- package/dist/src/lib/runtimeEnvironment.d.mts +4 -0
- package/dist/src/lib/sfnt/flavor.d.mts +2 -0
- package/dist/src/lib/svgDiagnostics/diagnoseSvgContents.d.mts +13 -0
- package/dist/src/lib/svgDiagnostics/diagnoseSvgContents.d.ts +1 -0
- package/dist/src/lib/svgFontOutput/emptyGlyphPaths.d.mts +3 -0
- package/dist/src/lib/svgTools/applySvgDiagnostics.d.mts +13 -0
- package/dist/src/lib/svgTools/applySvgTools.d.mts +14 -0
- package/dist/src/lib/svgTools/normalizeSvgToolsOptions.d.mts +2 -0
- package/dist/src/lib/svgicons2svgfont/index.d.mts +14 -0
- package/dist/src/lib/svgicons2svgfont/metadataFromSrcPath.d.mts +11 -0
- package/dist/src/lib/templateUnicodeRange.d.mts +4 -0
- package/dist/src/lib/ttf2eot/index.d.mts +2 -0
- package/dist/src/lib/ttfEncode.d.mts +5 -0
- package/dist/src/standalone/convertTtfInput.d.mts +3 -0
- package/dist/src/standalone/convertWebfontInput.d.mts +3 -0
- package/dist/src/standalone/defaultOptions.d.mts +3 -0
- package/dist/src/standalone/fetchWebfontUrl.d.mts +1 -0
- package/dist/src/standalone/generateSvgFont.d.mts +2 -0
- package/dist/src/standalone/getGlyphsDataFromInputs.d.mts +3 -0
- package/dist/src/standalone/glyphsData.d.mts +4 -0
- package/dist/src/standalone/index.d.mts +10 -0
- package/dist/src/standalone/inputMode.d.mts +9 -0
- package/dist/src/standalone/options.d.mts +5 -0
- package/dist/src/standalone/optionsFromGlyphs.d.mts +3 -0
- package/dist/src/standalone/renderTemplates.d.mts +10 -0
- package/dist/src/standalone/runSvgPipeline.d.mts +3 -0
- package/dist/src/standalone/templateFonts.d.mts +3 -0
- package/dist/src/standalone/toTtf.d.mts +4 -0
- package/dist/src/standalone/validateWebfontOptions.d.mts +6 -0
- package/dist/src/standalone/webfontFromGlyphs.d.mts +3 -0
- package/dist/src/types/DecompressedFont.d.mts +5 -0
- package/dist/src/types/Format.d.mts +11 -0
- package/dist/src/types/Format.d.ts +5 -3
- package/dist/src/types/GlyphContentTransformFn.d.mts +2 -0
- package/dist/src/types/GlyphData.d.mts +6 -0
- package/dist/src/types/GlyphInput.d.mts +6 -0
- package/dist/src/types/GlyphMetadata.d.mts +10 -0
- package/dist/src/types/GlyphTransformFn.d.mts +2 -0
- package/dist/src/types/InitialOptions.d.mts +12 -0
- package/dist/src/types/InitialOptions.d.ts +2 -0
- package/dist/src/types/MetadataProvider.d.mts +5 -0
- package/dist/src/types/OptionsBase.d.mts +41 -0
- package/dist/src/types/OptionsBase.d.ts +3 -1
- package/dist/src/types/RenderedTemplate.d.mts +7 -0
- package/dist/src/types/Result.d.mts +26 -0
- package/dist/src/types/ResultConfig.d.mts +4 -0
- package/dist/src/types/SvgToolsOptions.d.mts +13 -0
- package/dist/src/types/SvgToolsOptions.d.ts +1 -1
- package/dist/src/types/TranscodedFont.d.mts +7 -0
- package/dist/src/types/TtfPostProcessFn.d.mts +12 -0
- package/dist/src/types/TtfPostProcessFn.d.ts +12 -0
- package/dist/src/types/WebfontFromGlyphsOptions.d.mts +11 -0
- package/dist/src/types/WebfontOptions.d.mts +44 -0
- package/dist/src/types/WebfontOptions.d.ts +1 -0
- package/dist/src/types/index.d.mts +9 -0
- package/dist/src/types/index.d.ts +1 -0
- package/package.json +38 -18
- package/dist/templates/index.d.ts +0 -19
package/dist/cli.mjs
CHANGED
|
@@ -2,48 +2,35 @@
|
|
|
2
2
|
import { fileURLToPath as e } from "node:url";
|
|
3
3
|
const t = e(import.meta.url);
|
|
4
4
|
e(new URL(".", import.meta.url));
|
|
5
|
-
import {
|
|
6
|
-
import { pathToFileURL as
|
|
7
|
-
import
|
|
8
|
-
import * as
|
|
9
|
-
import { createReadStream as
|
|
10
|
-
import * as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { globby as
|
|
14
|
-
import { cosmiconfig as
|
|
15
|
-
import
|
|
16
|
-
import * as
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { SVGIcons2SVGFontStream as
|
|
24
|
-
import
|
|
25
|
-
import { optimize as
|
|
26
|
-
import { Readable as
|
|
27
|
-
import
|
|
28
|
-
//#region
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
get: ((e) => t[e]).bind(null, s),
|
|
32
|
-
enumerable: !(r = ue(t, s)) || r.enumerable
|
|
33
|
-
});
|
|
34
|
-
return e;
|
|
35
|
-
}, b = (e, t, n) => (n = e == null ? {} : le(fe(e)), me(t || !e || !e.__esModule ? v(n, "default", {
|
|
36
|
-
value: e,
|
|
37
|
-
enumerable: !0
|
|
38
|
-
}) : n, e)), he = {
|
|
39
|
-
name: "webfont",
|
|
40
|
-
version: "12.1.0",
|
|
41
|
-
description: "Generator of fonts from SVG icons; decompress WOFF/WOFF2 to embedded TTF/OTF (not TTF↔OTF transcoding)",
|
|
42
|
-
directories: {
|
|
5
|
+
import { a as n, i as r, n as i, r as a, t as o } from "./parseTemplateOption-DLNu6PPx.mjs";
|
|
6
|
+
import { pathToFileURL as s } from "node:url";
|
|
7
|
+
import c from "meow";
|
|
8
|
+
import * as l from "fs";
|
|
9
|
+
import { createReadStream as u } from "fs";
|
|
10
|
+
import * as d from "path";
|
|
11
|
+
import f from "path";
|
|
12
|
+
import ee from "resolve-from";
|
|
13
|
+
import { globby as te } from "globby";
|
|
14
|
+
import { cosmiconfig as ne } from "cosmiconfig";
|
|
15
|
+
import re from "deepmerge";
|
|
16
|
+
import * as ie from "fs/promises";
|
|
17
|
+
import ae from "ttf2woff";
|
|
18
|
+
import oe from "wawoff2";
|
|
19
|
+
import se from "ttf2eot";
|
|
20
|
+
import ce from "fontverter";
|
|
21
|
+
import le from "xml2js";
|
|
22
|
+
import ue from "p-limit";
|
|
23
|
+
import { SVGIcons2SVGFontStream as de, fileSorter as fe, getMetadataService as pe } from "svgicons2svgfont";
|
|
24
|
+
import me from "crypto";
|
|
25
|
+
import { optimize as he } from "svgo";
|
|
26
|
+
import { Readable as ge } from "stream";
|
|
27
|
+
import _e from "svg2ttf";
|
|
28
|
+
//#region package.json
|
|
29
|
+
var ve, ye, be, xe, Se, Ce, we, Te, Ee, De, p, m, h, g, _, v, y, b, x, S, C, w, T, E, Oe, ke, Ae = r((() => {
|
|
30
|
+
ve = "webfont", ye = "12.2.0", be = "Generator of fonts from SVG icons; decompress WOFF/WOFF2 to embedded TTF/OTF (not TTF↔OTF transcoding)", xe = {
|
|
43
31
|
lib: "dist",
|
|
44
32
|
source: "src"
|
|
45
|
-
},
|
|
46
|
-
files: [
|
|
33
|
+
}, Se = [
|
|
47
34
|
"dist",
|
|
48
35
|
"dist/src/index.d.ts",
|
|
49
36
|
"templates",
|
|
@@ -51,42 +38,52 @@ var le = Object.create, v = Object.defineProperty, ue = Object.getOwnPropertyDes
|
|
|
51
38
|
"!**/__mocks__",
|
|
52
39
|
"README.md",
|
|
53
40
|
"NOTICE.md"
|
|
54
|
-
],
|
|
55
|
-
main: "dist/index.js",
|
|
56
|
-
browser: "dist/browser.js",
|
|
57
|
-
bin: "dist/cli.mjs",
|
|
58
|
-
source: "src/index.ts",
|
|
59
|
-
types: "dist/src/index.d.ts",
|
|
60
|
-
typings: "dist/src/index.d.ts",
|
|
61
|
-
exports: {
|
|
41
|
+
], Ce = "commonjs", we = "dist/index.js", Te = "dist/index.mjs", Ee = "dist/browser.js", De = "dist/cli.mjs", p = "src/index.ts", m = "dist/src/index.d.ts", h = "dist/src/index.d.ts", g = {
|
|
62
42
|
".": {
|
|
43
|
+
browser: {
|
|
44
|
+
types: "./dist/src/index.d.ts",
|
|
45
|
+
default: "./dist/browser.js"
|
|
46
|
+
},
|
|
63
47
|
node: {
|
|
64
|
-
import:
|
|
65
|
-
|
|
48
|
+
import: {
|
|
49
|
+
types: "./dist/src/index.d.mts",
|
|
50
|
+
default: "./dist/index.mjs"
|
|
51
|
+
},
|
|
52
|
+
require: {
|
|
53
|
+
types: "./dist/src/index.d.ts",
|
|
54
|
+
default: "./dist/index.js"
|
|
55
|
+
}
|
|
66
56
|
},
|
|
67
|
-
default:
|
|
57
|
+
default: {
|
|
58
|
+
types: "./dist/src/index.d.ts",
|
|
59
|
+
default: "./dist/browser.js"
|
|
60
|
+
}
|
|
68
61
|
},
|
|
69
62
|
"./package.json": "./package.json"
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
build: "vite build --mode library && vite build --mode browser && vite build --mode cli",
|
|
63
|
+
}, _ = {
|
|
64
|
+
build: "vite build --mode library && vite build --mode library-esm && vite build --mode browser && vite build --mode cli && node scripts/emit-mts-types.mjs",
|
|
73
65
|
clean: "rm -rf dist/ temp/",
|
|
74
66
|
demo: "node dist/cli.mjs './src/fixtures/svg-icons/*.svg' -d demo -t html --normalize --center-horizontally",
|
|
75
67
|
lint: "biome check .",
|
|
68
|
+
"lint:suppressions": "node scripts/check-no-suppressions.mjs",
|
|
69
|
+
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
76
70
|
depcheck: "knip",
|
|
77
71
|
prebuild: "npm run clean && npm run lint",
|
|
78
72
|
prepare: "lefthook install",
|
|
79
73
|
predemo: "npm run build",
|
|
80
|
-
prepublishOnly: "npm run build",
|
|
74
|
+
prepublishOnly: "npm run build && npm run test:package",
|
|
81
75
|
pretest: "npm run build",
|
|
82
76
|
prettify: "biome check --write .",
|
|
83
77
|
test: "vitest run src",
|
|
78
|
+
"test:attw": "attw --pack .",
|
|
79
|
+
"test:pack": "node scripts/pack-smoke-test.mjs",
|
|
80
|
+
"test:package": "npm run test:publint && npm run test:attw && npm run test:pack",
|
|
81
|
+
"test:publint": "publint --level=warning",
|
|
84
82
|
testc: "vitest run src --coverage",
|
|
85
83
|
"test-debug": "vitest run src --no-file-parallelism",
|
|
86
84
|
testu: "vitest run src -u",
|
|
87
|
-
"deprecate-pre-12": "npm deprecate 'webfont@>=10.0.0 <12.0.0' 'Deprecated: upgrade to webfont@12. v10–11 enabled ligatures by default (browser hangs on large fonts, #558). 12.x: ligatures off, Node
|
|
88
|
-
},
|
|
89
|
-
dependencies: {
|
|
85
|
+
"deprecate-pre-12": "npm deprecate 'webfont@>=10.0.0 <12.0.0' 'Deprecated: upgrade to webfont@12. v10–11 enabled ligatures by default (browser hangs on large fonts, #558). 12.x: ligatures off, Node 24.14+, named import, unicode-range off, template fixes. See MIGRATION.md'"
|
|
86
|
+
}, v = {
|
|
90
87
|
cosmiconfig: "9.0.2",
|
|
91
88
|
deepmerge: "^4.2.2",
|
|
92
89
|
fontverter: "2.0.0",
|
|
@@ -100,48 +97,40 @@ var le = Object.create, v = Object.defineProperty, ue = Object.getOwnPropertyDes
|
|
|
100
97
|
svgo: "4.0.1",
|
|
101
98
|
ttf2eot: "3.1.0",
|
|
102
99
|
ttf2woff: "^3.0.0",
|
|
103
|
-
wawoff2: "2.0.
|
|
100
|
+
wawoff2: "2.0.1",
|
|
104
101
|
xml2js: "0.6.2"
|
|
105
|
-
},
|
|
106
|
-
|
|
102
|
+
}, y = {
|
|
103
|
+
"@arethetypeswrong/cli": "0.18.4",
|
|
107
104
|
"@biomejs/biome": "2.5.2",
|
|
108
|
-
"@types/node": "
|
|
105
|
+
"@types/node": "26.1.0",
|
|
109
106
|
"@types/nunjucks": "3.2.6",
|
|
110
|
-
"@types/rimraf": "latest",
|
|
111
107
|
"@types/svg2ttf": "5.0.3",
|
|
112
108
|
"@types/ttf2eot": "2.0.2",
|
|
113
109
|
"@types/ttf2woff": "2.0.4",
|
|
114
110
|
"@types/wawoff2": "1.0.2",
|
|
115
111
|
"@types/xml2js": "0.4.14",
|
|
116
112
|
"@vitest/coverage-v8": "4.1.9",
|
|
117
|
-
"
|
|
118
|
-
"is-eot": "latest",
|
|
113
|
+
"is-eot": "1.0.0",
|
|
119
114
|
"is-svg": "6.1.0",
|
|
120
|
-
"is-ttf": "
|
|
121
|
-
"is-woff": "
|
|
122
|
-
"is-woff2": "
|
|
115
|
+
"is-ttf": "0.2.2",
|
|
116
|
+
"is-woff": "1.0.3",
|
|
117
|
+
"is-woff2": "1.0.0",
|
|
123
118
|
knip: "6.24.0",
|
|
124
119
|
lefthook: "2.1.9",
|
|
125
|
-
|
|
120
|
+
publint: "0.3.21",
|
|
126
121
|
typescript: "6.0.3",
|
|
127
122
|
vite: "8.1.3",
|
|
128
123
|
"vite-plugin-checker": "0.14.4",
|
|
129
124
|
"vite-plugin-dts": "5.0.3",
|
|
130
125
|
vitest: "4.1.9"
|
|
131
|
-
},
|
|
132
|
-
overrides: {
|
|
133
|
-
"fast-glob": "3.2.12",
|
|
126
|
+
}, b = {
|
|
134
127
|
minimatch: "10.2.5",
|
|
135
128
|
"test-exclude": "7.0.2",
|
|
136
129
|
"woff2sfnt-sfnt2woff": "1.0.0"
|
|
137
|
-
},
|
|
138
|
-
repository: {
|
|
130
|
+
}, x = {
|
|
139
131
|
type: "git",
|
|
140
132
|
url: "git+https://github.com/itgalaxy/webfont.git"
|
|
141
|
-
},
|
|
142
|
-
author: "itgalaxy <development@itgalaxy.company>",
|
|
143
|
-
license: "MIT",
|
|
144
|
-
contributors: [{
|
|
133
|
+
}, S = "itgalaxy <development@itgalaxy.company>", C = [{
|
|
145
134
|
name: "Alexander Krasnoyarov",
|
|
146
135
|
email: "alexander.krasnoyarov@itgalaxy.company",
|
|
147
136
|
url: "https://vk.com/sterling_archer"
|
|
@@ -149,11 +138,7 @@ var le = Object.create, v = Object.defineProperty, ue = Object.getOwnPropertyDes
|
|
|
149
138
|
name: "Jimmy Andrade",
|
|
150
139
|
email: "webfont@jimmyandrade.com",
|
|
151
140
|
url: "https://github.com/jimmyandrade"
|
|
152
|
-
}],
|
|
153
|
-
bugs: { url: "https://github.com/itgalaxy/webfont/issues" },
|
|
154
|
-
homepage: "https://github.com/itgalaxy/webfont#readme",
|
|
155
|
-
engines: { node: ">= 24.14.0" },
|
|
156
|
-
keywords: [
|
|
141
|
+
}], w = { url: "https://github.com/itgalaxy/webfont/issues" }, T = "https://github.com/itgalaxy/webfont#readme", E = { node: ">=24.14.0" }, Oe = [
|
|
157
142
|
"cli",
|
|
158
143
|
"standalone",
|
|
159
144
|
"font",
|
|
@@ -173,721 +158,839 @@ var le = Object.create, v = Object.defineProperty, ue = Object.getOwnPropertyDes
|
|
|
173
158
|
"scss",
|
|
174
159
|
"builder",
|
|
175
160
|
"generator"
|
|
176
|
-
]
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
type: "string"
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
type: "
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
type: "string"
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
type: "
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
161
|
+
], ke = {
|
|
162
|
+
name: ve,
|
|
163
|
+
version: ye,
|
|
164
|
+
description: be,
|
|
165
|
+
directories: xe,
|
|
166
|
+
files: Se,
|
|
167
|
+
type: Ce,
|
|
168
|
+
sideEffects: !1,
|
|
169
|
+
main: we,
|
|
170
|
+
module: Te,
|
|
171
|
+
browser: Ee,
|
|
172
|
+
bin: De,
|
|
173
|
+
source: p,
|
|
174
|
+
types: m,
|
|
175
|
+
typings: h,
|
|
176
|
+
exports: g,
|
|
177
|
+
scripts: _,
|
|
178
|
+
dependencies: v,
|
|
179
|
+
devDependencies: y,
|
|
180
|
+
overrides: b,
|
|
181
|
+
repository: x,
|
|
182
|
+
author: S,
|
|
183
|
+
license: "MIT",
|
|
184
|
+
contributors: C,
|
|
185
|
+
bugs: w,
|
|
186
|
+
homepage: T,
|
|
187
|
+
engines: E,
|
|
188
|
+
keywords: Oe
|
|
189
|
+
};
|
|
190
|
+
})), je, Me, Ne = r((() => {
|
|
191
|
+
je = "\n Usage: webfont [input] [options]\n\n Input: File(s) or glob(s).\n\n SVG icons: one or more `.svg` files (default pipeline).\n Webfont decompression: one or more `.woff` / `.woff2` paths, globs, or http(s) URLs.\n You must have rights to any font file you process (see NOTICE.md).\n\n If an input argument is wrapped in quotation marks, it will be passed to \"fast-glob\"\n for cross-platform glob support.\n\n Options:\n\n --config\n\n Path to a specific configuration file (JSON, YAML, or CommonJS)\n or the name of a module in `node_modules` that points to one.\n If no `--config` argument is provided, webfont will search for\n configuration files in the following places, in this order:\n - a `webfont` property in `package.json`\n - a `.webfontrc` file (with or without filename extension:\n `.json`, `.yaml`, and `.js` are available)\n - a `webfont.config.js` file exporting a JS object\n The search will begin in the working directory and move up the\n directory tree until a configuration file is found.\n\n -u, --fontName\n\n The font family name you want, default: \"webfont\".\n\n -h, --help\n\n Output usage information.\n\n -v, --version\n\n Output the version number.\n\n -f, --formats\n\n Font formats to generate. Pass a JSON array (e.g. '[\"woff2\"]') or a\n comma-separated list (e.g. woff2 or svg, ttf, woff2).\n SVG input: svg, ttf, eot, woff, woff2 (not otf).\n WOFF/WOFF2 input: ttf and/or otf matching the embedded SFNT flavor.\n\n -d, --dest\n\n Destination for generated fonts.\n\n -m, --dest-create\n\n Create destination directory if it does not exist.\n\n -t, --template\n\n Built-in template name(s) ('css', 'scss', 'styl', 'html', 'json') or path to a custom template.\n Pass a JSON array (e.g. '[\"html\",\"scss\"]') or comma-separated list for multiple outputs.\n\n -s, --destTemplate\n\n Destination for generated template. If not passed used `dest` argument value.\n\n -c, --templateClassName\n\n Class name in css template.\n\n -p, --templateFontPath\n\n Font path in css template.\n\n -n, --templateFontName\n\n Font name in css template.\n\n --templateCacheString\n\n Specify cache string in scss/css template.\n\n --no-sort\n\n Keeps the files in the same order of entry\n\n --ligatures\n\n Add OpenType ligature glyphs (icon names as text). Off by default — large\n icon sets can hang Firefox on Windows (#558). Prefer class + codepoint CSS.\n\n --unicode-range\n\n Emit unicode-range in built-in @font-face rules (computed from glyph code points).\n Off by default — enabling may prevent ligature names from rendering; see README.\n\n --no-template-font-ligatures\n\n Omit font-feature-settings: \"liga\" from the built-in HTML preview template\n\n --optimize-svg\n\n Run a conservative SVGO pass on each SVG before font generation\n (does not convert strokes to fills; use glyphContentTransformFn for that)\n\n --verbose\n\n Tell me everything!.\n\n --svg-diagnose\n\n (Alpha) Scan SVG icons for icon-font incompatibilities (stroke-only paths,\n fill-rule: evenodd, unsupported elements) and log warnings.\n\n For \"svgicons2svgfont\":\n\n --fontId\n\n The font id you want, default as \"--fontName\".\n\n --fontStyle\n\n The font style you want.\n\n --fontWeight\n\n The font weight you want.\n\n --fixedWidth\n\n Creates a monospace font of the width of the largest input icon.\n\n --centerHorizontally\n\n Calculate the bounds of a glyph and center it horizontally.\n\n --centerVertically\n\n Center the glyphs vertically in the generated font.\n\n --normalize\n\n Normalize icons by scaling them to the height of the highest icon.\n\n --fontHeight\n\n The outputted font height [MAX(icons.height)].\n\n --round\n\n Setup the SVG path rounding [10e12].\n\n --descent\n\n The font descent [0].\n\n --ascent\n\n The font ascent [height - descent].\n\n --startUnicode\n\n The start unicode codepoint for files without prefix [0xEA01].\n\n --prependUnicode\n\n Prefix files with their automatically allocated unicode codepoint.\n\n --metadata\n\n Content of the metadata tag.\n\n --addHashInFontUrl\n\n Append an MD5 content hash to font URLs in built-in templates\n (?v=[hash]) while keeping output filenames stable (fontName.woff2, etc.).\n Use with a fixed fontName — do not randomize fontName for cache busting.\n", Me = {
|
|
192
|
+
ascent: { type: "string" },
|
|
193
|
+
centerHorizontally: { type: "boolean" },
|
|
194
|
+
centerVertically: { type: "boolean" },
|
|
195
|
+
config: { type: "string" },
|
|
196
|
+
descent: { type: "string" },
|
|
197
|
+
dest: {
|
|
198
|
+
shortFlag: "d",
|
|
199
|
+
default: process.cwd(),
|
|
200
|
+
type: "string"
|
|
201
|
+
},
|
|
202
|
+
destCreate: {
|
|
203
|
+
shortFlag: "m",
|
|
204
|
+
default: !1,
|
|
205
|
+
type: "boolean"
|
|
206
|
+
},
|
|
207
|
+
destTemplate: {
|
|
208
|
+
shortFlag: "s",
|
|
209
|
+
type: "string"
|
|
210
|
+
},
|
|
211
|
+
fixedWidth: { type: "boolean" },
|
|
212
|
+
fontHeight: { type: "string" },
|
|
213
|
+
fontId: { type: "string" },
|
|
214
|
+
fontName: {
|
|
215
|
+
shortFlag: "u",
|
|
216
|
+
type: "string"
|
|
217
|
+
},
|
|
218
|
+
fontStyle: { type: "string" },
|
|
219
|
+
fontWeight: { type: "string" },
|
|
220
|
+
formats: {
|
|
221
|
+
shortFlag: "f",
|
|
222
|
+
type: "string"
|
|
223
|
+
},
|
|
224
|
+
help: {
|
|
225
|
+
shortFlag: "h",
|
|
226
|
+
type: "boolean"
|
|
227
|
+
},
|
|
228
|
+
ligatures: {
|
|
229
|
+
default: !1,
|
|
230
|
+
type: "boolean"
|
|
231
|
+
},
|
|
232
|
+
metadata: { type: "string" },
|
|
233
|
+
normalize: { type: "boolean" },
|
|
234
|
+
prependUnicode: { type: "boolean" },
|
|
235
|
+
round: { type: "string" },
|
|
236
|
+
sort: {
|
|
237
|
+
default: !0,
|
|
238
|
+
type: "boolean"
|
|
239
|
+
},
|
|
240
|
+
startUnicode: { type: "string" },
|
|
241
|
+
template: {
|
|
242
|
+
shortFlag: "t",
|
|
243
|
+
type: "string"
|
|
244
|
+
},
|
|
245
|
+
templateClassName: {
|
|
246
|
+
shortFlag: "c",
|
|
247
|
+
type: "string"
|
|
248
|
+
},
|
|
249
|
+
templateFontName: {
|
|
250
|
+
shortFlag: "n",
|
|
251
|
+
type: "string"
|
|
252
|
+
},
|
|
253
|
+
addHashInFontUrl: {
|
|
254
|
+
default: !1,
|
|
255
|
+
type: "boolean"
|
|
256
|
+
},
|
|
257
|
+
optimizeSvg: {
|
|
258
|
+
default: !1,
|
|
259
|
+
type: "boolean"
|
|
260
|
+
},
|
|
261
|
+
templateFontPath: {
|
|
262
|
+
shortFlag: "p",
|
|
263
|
+
type: "string"
|
|
264
|
+
},
|
|
265
|
+
templateCacheString: {
|
|
266
|
+
default: "",
|
|
267
|
+
type: "string"
|
|
268
|
+
},
|
|
269
|
+
unicodeRange: {
|
|
270
|
+
default: !1,
|
|
271
|
+
type: "boolean"
|
|
272
|
+
},
|
|
273
|
+
templateFontLigatures: {
|
|
274
|
+
default: !0,
|
|
275
|
+
type: "boolean"
|
|
276
|
+
},
|
|
277
|
+
verbose: {
|
|
278
|
+
default: !1,
|
|
279
|
+
type: "boolean"
|
|
280
|
+
},
|
|
281
|
+
svgDiagnose: {
|
|
282
|
+
default: !1,
|
|
283
|
+
type: "boolean"
|
|
284
|
+
},
|
|
285
|
+
version: {
|
|
286
|
+
shortFlag: "v",
|
|
287
|
+
type: "boolean"
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
})), Pe, Fe, Ie = r((() => {
|
|
291
|
+
Ae(), Ne(), Pe = { url: s(t).href }, Fe = (e = process.argv.slice(2)) => c(je, {
|
|
292
|
+
argv: [...e],
|
|
293
|
+
autoHelp: !1,
|
|
294
|
+
autoVersion: !1,
|
|
295
|
+
flags: Me,
|
|
296
|
+
importMeta: Pe,
|
|
297
|
+
pkg: ke
|
|
302
298
|
});
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
299
|
+
})), Le, Re = r((() => {
|
|
300
|
+
Ie(), Ne(), Le = Fe();
|
|
301
|
+
})), ze, D, O, Be, Ve, He, k = r((() => {
|
|
302
|
+
ze = /^https?:\/\//iu, D = (e) => ze.test(e), O = (e) => {
|
|
303
|
+
if (D(e)) try {
|
|
304
|
+
return f.extname(new URL(e).pathname).toLowerCase();
|
|
305
|
+
} catch {
|
|
306
|
+
return "";
|
|
307
|
+
}
|
|
308
|
+
return f.extname(e).toLowerCase();
|
|
309
|
+
}, Be = (e) => {
|
|
310
|
+
let t = e;
|
|
311
|
+
D(e) && (t = new URL(e).pathname);
|
|
312
|
+
let n = f.basename(t), r = O(e);
|
|
313
|
+
return r === ".woff2" ? n.slice(0, -6) : r === ".woff" ? n.slice(0, -5) : n.replace(/\.[^.]+$/u, "");
|
|
314
|
+
}, Ve = {
|
|
315
|
+
".woff": "-woff",
|
|
316
|
+
".woff2": "-woff2"
|
|
317
|
+
}, He = (e) => {
|
|
318
|
+
let t = e.map((e) => Be(e)), n = /* @__PURE__ */ new Map();
|
|
319
|
+
for (let e of t) n.set(e, (n.get(e) ?? 0) + 1);
|
|
320
|
+
return e.map((e, r) => {
|
|
321
|
+
let i = t[r], a = (n.get(i) ?? 0) > 1, o = O(e);
|
|
322
|
+
return a ? `${i}${Ve[o] ?? `-${r + 1}`}` : i;
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
})), Ue, We = r((() => {
|
|
326
|
+
k(), Ue = async (e) => (await Promise.all(e.map((e) => D(e) ? Promise.resolve([e]) : te(e)))).flat();
|
|
327
|
+
})), Ge, Ke, qe, A, Je = r((() => {
|
|
328
|
+
Ge = 1330926671, Ke = 1953658213, qe = 65536, A = (e) => {
|
|
329
|
+
if (e.length < 4) throw Error("SFNT buffer is too short to read flavor");
|
|
330
|
+
let t = e.readUInt32BE(0);
|
|
331
|
+
if (t === Ge) return "otf";
|
|
332
|
+
if (t === Ke || t === qe) return "ttf";
|
|
333
|
+
throw Error(`Unsupported SFNT flavor 0x${t.toString(16)}`);
|
|
334
|
+
};
|
|
335
|
+
})), Ye, Xe = r((() => {
|
|
336
|
+
Ye = (e) => Buffer.from(se(e));
|
|
337
|
+
})), j, M, N, Ze = r((() => {
|
|
338
|
+
Xe(), j = (e) => Ye(e), M = (e, t = {}) => Buffer.from(ae(e, t).buffer), N = async (e) => Buffer.from(await oe.compress(e));
|
|
339
|
+
})), P, F, I, L, R, z, B, Qe, $e, et, V, tt, nt, rt, H = r((() => {
|
|
340
|
+
k(), P = /* @__PURE__ */ new Set([".woff", ".woff2"]), F = ".svg", I = ".ttf", L = [
|
|
341
|
+
"svg",
|
|
342
|
+
"ttf",
|
|
343
|
+
"eot",
|
|
344
|
+
"woff",
|
|
345
|
+
"woff2"
|
|
346
|
+
], R = (e) => e === F, z = (e) => e === I, B = (e) => P.has(e), Qe = (e) => R(e) || B(e) || z(e), $e = (e) => {
|
|
347
|
+
if (e.length === 0) return "empty";
|
|
348
|
+
let t = e.map((e) => O(e));
|
|
349
|
+
if (!t.every(Qe)) return "empty";
|
|
350
|
+
let n = t.some(R), r = t.some(B), i = t.some(z);
|
|
351
|
+
return [
|
|
352
|
+
n,
|
|
353
|
+
r,
|
|
354
|
+
i
|
|
355
|
+
].filter(Boolean).length > 1 ? "mixed" : r ? "webfont" : i ? "ttf" : n ? "svg" : "empty";
|
|
356
|
+
}, et = (e) => {
|
|
357
|
+
if (e.includes("otf")) throw Error("OTF output is only supported when converting WOFF/WOFF2 input. Request \"ttf\" for SVG icons, or pass a .woff/.woff2 file.");
|
|
358
|
+
}, V = (e, t) => t === "svg" ? e.filter((e) => O(e) === F) : t === "webfont" ? e.filter((e) => P.has(O(e))) : t === "ttf" ? e.filter((e) => O(e) === I) : [], tt = /* @__PURE__ */ new Set([
|
|
359
|
+
"ttf",
|
|
360
|
+
"eot",
|
|
361
|
+
"woff",
|
|
362
|
+
"woff2"
|
|
363
|
+
]), nt = (e) => {
|
|
364
|
+
let t = e.filter((e) => tt.has(e));
|
|
365
|
+
if (e.length === L.length && L.every((t) => e.includes(t))) return ["woff", "woff2"];
|
|
366
|
+
if (t.length === 0) throw Error("formats must include at least one of \"ttf\", \"eot\", \"woff\", or \"woff2\" when converting TTF input");
|
|
367
|
+
return [...new Set(t)];
|
|
368
|
+
}, rt = (e) => {
|
|
369
|
+
let t = e.filter((e) => e === "ttf" || e === "otf");
|
|
370
|
+
if (e.length === L.length && L.every((t) => e.includes(t))) return ["ttf"];
|
|
371
|
+
if (t.length === 0) throw Error("formats must include \"ttf\" and/or \"otf\" when converting WOFF/WOFF2 input");
|
|
372
|
+
return [...new Set(t)];
|
|
373
|
+
};
|
|
374
|
+
})), it, at, ot, st, ct, lt, ut = r((() => {
|
|
375
|
+
k(), Je(), Ze(), H(), it = (e) => {
|
|
376
|
+
if (e.length === 0) throw Error("No TTF files matched");
|
|
377
|
+
}, at = (e) => {
|
|
378
|
+
if (e.template) throw Error("Templates are not supported when converting TTF input");
|
|
379
|
+
if (e.glyphTransformFn) throw Error("glyphTransformFn is not supported when converting TTF input");
|
|
380
|
+
if (e.glyphContentTransformFn) throw Error("glyphContentTransformFn is not supported when converting TTF input");
|
|
381
|
+
}, ot = (e, t) => {
|
|
366
382
|
let n;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
+
try {
|
|
384
|
+
n = A(e);
|
|
385
|
+
} catch {
|
|
386
|
+
throw Error(`Input is not a valid TrueType font: ${t}`);
|
|
387
|
+
}
|
|
388
|
+
if (n !== "ttf") throw Error(`OpenType (OTF) input is not supported for webfont encoding. Use a .ttf file for ${t}.`);
|
|
389
|
+
}, st = async (e, t, n, r) => {
|
|
390
|
+
if (n === "ttf") {
|
|
391
|
+
e.ttf = t;
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (n === "eot") {
|
|
395
|
+
e.eot = j(t);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (n === "woff") {
|
|
399
|
+
let n;
|
|
400
|
+
typeof r.metadata == "string" && (n = r.metadata), e.woff = M(t, { metadata: n });
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
e.woff2 = await N(t);
|
|
404
|
+
}, ct = async (e, t, n, r) => {
|
|
405
|
+
if (D(e)) throw Error(`Remote TTF URLs are not supported. Download the file first: ${e}`);
|
|
406
|
+
r && console.log(`Encoding ${e}...`);
|
|
407
|
+
let i = await ie.readFile(e);
|
|
408
|
+
ot(i, e);
|
|
409
|
+
let a = { source: e };
|
|
410
|
+
return await Promise.all(t.map((e) => st(a, i, e, n))), a;
|
|
411
|
+
}, lt = async (e, t) => {
|
|
412
|
+
at(t), it(e);
|
|
413
|
+
let n = nt(t.formats), r = await Promise.all(e.map((e) => ct(e, n, t, t.verbose))), i = {
|
|
414
|
+
config: { ...t },
|
|
415
|
+
transcodedFonts: r
|
|
416
|
+
};
|
|
417
|
+
if (r.length === 1) {
|
|
418
|
+
let [e] = r;
|
|
419
|
+
i.ttf = e.ttf, i.eot = e.eot, i.woff = e.woff, i.woff2 = e.woff2;
|
|
420
|
+
}
|
|
421
|
+
return i;
|
|
383
422
|
};
|
|
384
|
-
|
|
385
|
-
let [e] = r;
|
|
386
|
-
i.ttf = e.ttf, i.eot = e.eot, i.woff = e.woff, i.woff2 = e.woff2;
|
|
387
|
-
}
|
|
388
|
-
return i;
|
|
389
|
-
}, Ne = /* @__PURE__ */ y(((e, t) => {
|
|
423
|
+
})), dt = /* @__PURE__ */ a(((e, t) => {
|
|
390
424
|
t.exports = function(e) {
|
|
391
425
|
return !e || e.length < 8 ? !1 : e[0] === 119 && e[1] === 79 && e[2] === 70 && e[3] === 70 && e[4] === 0 && e[5] === 1 && e[6] === 0 && e[7] === 0 || e[4] === 79 && e[5] === 84 && e[6] === 84 && e[7] === 79;
|
|
392
426
|
};
|
|
393
|
-
})),
|
|
427
|
+
})), ft = /* @__PURE__ */ a(((e, t) => {
|
|
394
428
|
t.exports = function(e) {
|
|
395
429
|
return !e || e.length < 8 ? !1 : e[0] === 119 && e[1] === 79 && e[2] === 70 && e[3] === 50 && e[4] === 0 && e[5] === 1 && e[6] === 0 && e[7] === 0;
|
|
396
430
|
};
|
|
397
|
-
})),
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
},
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
sfnt
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
431
|
+
})), pt, mt, ht, gt, _t = r((() => {
|
|
432
|
+
pt = /* @__PURE__ */ n(dt()), mt = /* @__PURE__ */ n(ft()), k(), ht = (e, t) => {
|
|
433
|
+
let n = O(t);
|
|
434
|
+
if (n === ".woff2" && !(0, mt.default)(e)) throw Error(`URL did not return a valid WOFF2 font: ${t}`);
|
|
435
|
+
if (n === ".woff" && !(0, pt.default)(e)) throw Error(`URL did not return a valid WOFF font: ${t}`);
|
|
436
|
+
if (e.length === 0) throw Error(`URL returned an empty response: ${t}`);
|
|
437
|
+
}, gt = async (e) => {
|
|
438
|
+
let t;
|
|
439
|
+
try {
|
|
440
|
+
t = await fetch(e);
|
|
441
|
+
} catch (t) {
|
|
442
|
+
let n = String(t);
|
|
443
|
+
throw t instanceof Error && (n = t.message), Error(`Failed to fetch font URL ${e}: ${n}`);
|
|
444
|
+
}
|
|
445
|
+
if (!t.ok) throw Error(`Failed to fetch font URL ${e}: HTTP ${t.status} ${t.statusText}`);
|
|
446
|
+
let n = await t.arrayBuffer(), r = Buffer.from(n);
|
|
447
|
+
return ht(r, e), r;
|
|
448
|
+
};
|
|
449
|
+
})), vt, yt, bt, xt, St, Ct, wt = r((() => {
|
|
450
|
+
k(), Je(), _t(), H(), vt = (e) => {
|
|
451
|
+
if (e.length === 0) throw Error("No WOFF or WOFF2 files matched");
|
|
452
|
+
}, yt = (e) => {
|
|
453
|
+
if (e.template) throw Error("Templates are not supported when converting WOFF/WOFF2 input");
|
|
454
|
+
if (e.glyphTransformFn) throw Error("glyphTransformFn is not supported when converting WOFF/WOFF2 input");
|
|
455
|
+
if (e.glyphContentTransformFn) throw Error("glyphContentTransformFn is not supported when converting WOFF/WOFF2 input");
|
|
456
|
+
}, bt = (e) => {
|
|
457
|
+
let { decompressed: t, sfnt: n, format: r, flavor: i, source: a } = e;
|
|
458
|
+
if (r === "ttf" && i !== "ttf") throw Error(`Input decompresses to OpenType (OTF). Request "otf" format instead of "ttf" for ${a}.`);
|
|
459
|
+
if (r === "otf" && i !== "otf") throw Error(`Input decompresses to TrueType (TTF). Request "ttf" format instead of "otf" for ${a}.`);
|
|
460
|
+
if (r === "ttf") {
|
|
461
|
+
t.ttf = n;
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
t.otf = n;
|
|
465
|
+
}, xt = (e) => D(e) ? gt(e) : ie.readFile(e), St = async (e, t, n) => {
|
|
466
|
+
n && console.log(`Decompressing ${e}...`);
|
|
467
|
+
let r = await xt(e), i = Buffer.from(await ce.convert(r, "sfnt")), a = A(i), o = { source: e };
|
|
468
|
+
for (let n of t) bt({
|
|
469
|
+
decompressed: o,
|
|
470
|
+
sfnt: i,
|
|
471
|
+
format: n,
|
|
472
|
+
flavor: a,
|
|
473
|
+
source: e
|
|
474
|
+
});
|
|
475
|
+
return o;
|
|
476
|
+
}, Ct = async (e, t) => {
|
|
477
|
+
yt(t), vt(e);
|
|
478
|
+
let n = rt(t.formats), r = await Promise.all(e.map((e) => St(e, n, t.verbose))), i = {
|
|
479
|
+
config: { ...t },
|
|
480
|
+
decompressedFonts: r
|
|
481
|
+
};
|
|
482
|
+
return r.length === 1 && (i.ttf = r[0].ttf, i.otf = r[0].otf), i;
|
|
483
|
+
};
|
|
484
|
+
})), Tt, Et = r((() => {
|
|
485
|
+
Tt = ue;
|
|
486
|
+
})), Dt, Ot, kt, At = r((() => {
|
|
487
|
+
Dt = (e) => ({
|
|
488
|
+
prependUnicode: !!e.prependUnicode,
|
|
489
|
+
startUnicode: Number(e.startUnicode)
|
|
490
|
+
}), Ot = (e) => {
|
|
491
|
+
if (e == null) return;
|
|
492
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
|
|
493
|
+
let t = e.trim();
|
|
494
|
+
if (t.length === 0) return;
|
|
495
|
+
let n = Number(t);
|
|
496
|
+
if (Number.isFinite(n)) return n;
|
|
497
|
+
}, kt = (e) => ({
|
|
498
|
+
ascent: e.ascent,
|
|
499
|
+
centerHorizontally: e.centerHorizontally,
|
|
500
|
+
centerVertically: e.centerVertically,
|
|
501
|
+
descent: e.descent,
|
|
502
|
+
fixedWidth: e.fixedWidth,
|
|
503
|
+
fontHeight: e.fontHeight,
|
|
504
|
+
fontId: e.fontId,
|
|
505
|
+
fontName: e.fontName,
|
|
506
|
+
fontStyle: e.fontStyle,
|
|
507
|
+
fontWeight: e.fontWeight,
|
|
508
|
+
metadata: e.metadata,
|
|
509
|
+
normalize: e.normalize,
|
|
510
|
+
round: Ot(e.round)
|
|
437
511
|
});
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
512
|
+
})), jt, Mt, Nt, Pt = r((() => {
|
|
513
|
+
Et(), At(), jt = (e) => e === void 0 ? [] : Array.isArray(e) ? e : [e], Mt = (e) => ({
|
|
514
|
+
name: e.name,
|
|
515
|
+
unicode: jt(e.unicode)
|
|
516
|
+
}), Nt = (e, t) => {
|
|
517
|
+
let n = t.metadataProvider || pe(Dt(t)), r = new le.Parser(), i = Tt(t.maxConcurrency);
|
|
518
|
+
return Promise.all(e.map((e) => i(() => new Promise((t, n) => {
|
|
519
|
+
let i = u(e), a = "";
|
|
520
|
+
i.on("error", (e) => n(e)).on("data", (e) => {
|
|
521
|
+
a += e.toString();
|
|
522
|
+
}).on("end", () => a.length === 0 ? n(/* @__PURE__ */ Error(`Empty file ${e}`)) : r.parseString(a, (r) => r ? n(r) : t({
|
|
523
|
+
contents: a,
|
|
524
|
+
srcPath: e
|
|
525
|
+
})));
|
|
526
|
+
})))).then((e) => {
|
|
527
|
+
let r = e;
|
|
528
|
+
t.sort && (r = e.sort((e, t) => fe(e.srcPath, t.srcPath)));
|
|
529
|
+
let { ligatures: i } = t;
|
|
530
|
+
return Promise.all(r.map((e) => new Promise((t, r) => {
|
|
531
|
+
n(e.srcPath, (n, a) => {
|
|
532
|
+
if (n) return r(n);
|
|
533
|
+
if (!a) return r(/* @__PURE__ */ Error(`Missing metadata for ${e.srcPath}`));
|
|
534
|
+
let o = Mt(a);
|
|
535
|
+
return i && o.unicode.push(a.name.replace(/-/gu, "_")), e.metadata = o, t(e);
|
|
536
|
+
});
|
|
537
|
+
})));
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
})), Ft, It = r((() => {
|
|
541
|
+
Ft = () => ({
|
|
542
|
+
centerHorizontally: !1,
|
|
543
|
+
centerVertically: !1,
|
|
544
|
+
descent: 0,
|
|
545
|
+
fixedWidth: !1,
|
|
546
|
+
fontHeight: void 0,
|
|
547
|
+
fontId: void 0,
|
|
548
|
+
fontName: "webfont",
|
|
549
|
+
fontStyle: "",
|
|
550
|
+
fontWeight: "",
|
|
551
|
+
formats: [
|
|
552
|
+
"svg",
|
|
553
|
+
"ttf",
|
|
554
|
+
"eot",
|
|
555
|
+
"woff",
|
|
556
|
+
"woff2"
|
|
557
|
+
],
|
|
558
|
+
formatsOptions: { ttf: {
|
|
559
|
+
copyright: null,
|
|
560
|
+
ts: null,
|
|
561
|
+
version: null
|
|
562
|
+
} },
|
|
563
|
+
ligatures: !1,
|
|
564
|
+
maxConcurrency: 100,
|
|
565
|
+
metadata: void 0,
|
|
566
|
+
normalize: !1,
|
|
567
|
+
prependUnicode: !1,
|
|
568
|
+
round: 0x9184e72a000,
|
|
569
|
+
sort: !0,
|
|
570
|
+
startUnicode: 59905,
|
|
571
|
+
templateFontPath: "./",
|
|
572
|
+
unicodeRange: !1,
|
|
573
|
+
verbose: !1
|
|
574
|
+
});
|
|
575
|
+
})), Lt, Rt = r((() => {
|
|
576
|
+
It(), Lt = (e) => {
|
|
577
|
+
if (!e?.files) throw Error("You must pass webfont a `files` glob");
|
|
578
|
+
return {
|
|
579
|
+
...Ft(),
|
|
580
|
+
...e
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
})), zt, Bt, Vt, Ht = r((() => {
|
|
584
|
+
zt = () => ({
|
|
585
|
+
multipass: !1,
|
|
586
|
+
plugins: [
|
|
587
|
+
"removeDoctype",
|
|
588
|
+
"removeXMLProcInst",
|
|
589
|
+
"removeComments",
|
|
590
|
+
"removeMetadata",
|
|
591
|
+
"removeEditorsNSData",
|
|
592
|
+
"removeDesc",
|
|
593
|
+
"cleanupAttrs",
|
|
594
|
+
"removeUnusedNS"
|
|
595
|
+
]
|
|
596
|
+
}), Bt = (e) => {
|
|
597
|
+
let t = zt();
|
|
598
|
+
return e ? {
|
|
599
|
+
...t,
|
|
600
|
+
...e,
|
|
601
|
+
plugins: e.plugins ?? t.plugins
|
|
602
|
+
} : t;
|
|
603
|
+
}, Vt = (e, t, n) => he(e, {
|
|
604
|
+
...Bt(n),
|
|
605
|
+
path: t
|
|
606
|
+
}).data;
|
|
607
|
+
})), Ut, Wt = r((() => {
|
|
608
|
+
Ht(), Ut = (e, t) => e.map((e) => ({
|
|
609
|
+
...e,
|
|
610
|
+
contents: Vt(e.contents, e.srcPath, t)
|
|
611
|
+
}));
|
|
612
|
+
})), Gt, Kt, qt = r((() => {
|
|
613
|
+
Gt = (e, t) => t && e > 2e3, Kt = (e) => `Warning: ${e} glyphs with ligatures enabled may cause severe browser slowdown or hangs (especially Firefox on Windows). Ligatures are off by default; enable only if needed: --ligatures or ligatures: true. See TROUBLESHOOTING.md and https://github.com/itgalaxy/webfont/issues/558`;
|
|
614
|
+
})), Jt, Yt, Xt, Zt, Qt, $t, en, tn = r((() => {
|
|
615
|
+
Jt = /<glyph\b([^>/]*)(?:\/>|>)/giu, Yt = /\bglyph-name=["']([^"']+)["']/iu, Xt = /\bd=["']([^"']*)["']/iu, Zt = (e) => {
|
|
616
|
+
let t = [];
|
|
617
|
+
for (let n of e.matchAll(Jt)) {
|
|
618
|
+
let e = n[1] ?? "", r = Yt.exec(e);
|
|
619
|
+
r && (Xt.exec(e)?.[1] ?? "").trim().length === 0 && t.push(r[1]);
|
|
620
|
+
}
|
|
621
|
+
return t;
|
|
622
|
+
}, Qt = (e, t) => {
|
|
623
|
+
for (let n of t) {
|
|
624
|
+
let t = n.metadata?.name;
|
|
625
|
+
if (t && (e === t || e.startsWith(`${t}-`))) return n.srcPath;
|
|
626
|
+
}
|
|
627
|
+
}, $t = (e, t) => {
|
|
628
|
+
let n = /* @__PURE__ */ new Set(), r = [];
|
|
629
|
+
for (let i of e) {
|
|
630
|
+
let e = Qt(i, t), a = e ?? i;
|
|
631
|
+
n.has(a) || (n.add(a), e ? r.push(`${i} (${e})`) : r.push(i));
|
|
632
|
+
}
|
|
633
|
+
return r.join("; ");
|
|
634
|
+
}, en = (e, t) => {
|
|
635
|
+
let n = Zt(e);
|
|
636
|
+
if (n.length === 0) return;
|
|
637
|
+
let r = $t(n, t);
|
|
638
|
+
throw Error(`Empty glyph path(s) in SVG font output for: ${r}. Stroke-only SVGs (fill="none" with stroke) often produce empty glyphs because svgicons2svgfont does not convert strokes. Convert strokes to filled paths in your design tool, preprocess with glyphContentTransformFn (for example svg-outline-stroke), or run with --svg-diagnose for compatibility warnings. See TROUBLESHOOTING.md ("Stroke-only SVGs produce blank icons").`);
|
|
444
639
|
};
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
},
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}), Ye = (e) => e === void 0 ? [] : Array.isArray(e) ? e : [e], Xe = (e) => ({
|
|
470
|
-
name: e.name,
|
|
471
|
-
unicode: Ye(e.unicode)
|
|
472
|
-
}), Ze = (e, t) => {
|
|
473
|
-
let n = t.metadataProvider || ie(Ke(t)), r = new m.Parser(), i = Ge(t.maxConcurrency);
|
|
474
|
-
return Promise.all(e.map((e) => i(() => new Promise((t, n) => {
|
|
475
|
-
let i = o(e), a = "";
|
|
476
|
-
i.on("error", (e) => n(e)).on("data", (e) => {
|
|
477
|
-
a += e.toString();
|
|
478
|
-
}).on("end", () => a.length === 0 ? n(/* @__PURE__ */ Error(`Empty file ${e}`)) : r.parseString(a, (r) => r ? n(r) : t({
|
|
479
|
-
contents: a,
|
|
640
|
+
})), nn, rn, an = r((() => {
|
|
641
|
+
nn = /fill-rule\s*:\s*evenodd|fill-rule\s*=\s*["']evenodd["']/iu, rn = (e) => nn.test(e);
|
|
642
|
+
})), on, sn, cn, ln, un, dn, fn, U, pn, mn, hn, gn = r((() => {
|
|
643
|
+
an(), on = /\bstroke\s*=|\bstroke\s*:/iu, sn = /fill\s*=\s*["']none["']|fill\s*:\s*none/iu, cn = /<(line|polyline|clipPath)\b/iu, ln = /<use\b/iu, un = (e) => on.test(e) ? sn.test(e) : !1, dn = (e) => cn.test(e), fn = (e) => ln.test(e), U = (e, t) => {
|
|
644
|
+
switch (e) {
|
|
645
|
+
case "evenodd-fill-rule": return `[webfont:diagnose] ${t} uses fill-rule: evenodd. Icon fonts render glyphs with the nonzero fill rule, so holes and counter-shapes can disappear. See TROUBLESHOOTING.md ("Icon details missing after export").`;
|
|
646
|
+
case "stroke-only": return `[webfont:diagnose] ${t} uses stroke-based paths (fill="none"). svgicons2svgfont ignores stroke; outlines may render as solid shapes or lose detail. Preprocess with glyphContentTransformFn (for example svg-outline-stroke) before conversion. See TROUBLESHOOTING.md ("Icon details missing after export").`;
|
|
647
|
+
case "unsupported-element": return `[webfont:diagnose] ${t} contains <line>, <polyline>, or <clipPath>. These elements are poorly supported in icon fonts; results may differ from the browser preview. Convert to filled paths or preprocess with glyphContentTransformFn.`;
|
|
648
|
+
case "use-reference": return `[webfont:diagnose] ${t} contains <use> (symbol/instance references). svgicons2svgfont does not resolve <use> or apply transform on references — the glyph may be empty or wrong. Flatten to paths in your editor, or preprocess with SVGO / glyphContentTransformFn before conversion. See TROUBLESHOOTING.md ("SVG transform and <use> references", #612).`;
|
|
649
|
+
default: return e;
|
|
650
|
+
}
|
|
651
|
+
}, pn = (e, t) => {
|
|
652
|
+
let n = [];
|
|
653
|
+
return rn(t) && n.push({
|
|
654
|
+
code: "evenodd-fill-rule",
|
|
655
|
+
message: U("evenodd-fill-rule", e),
|
|
656
|
+
srcPath: e
|
|
657
|
+
}), un(t) && n.push({
|
|
658
|
+
code: "stroke-only",
|
|
659
|
+
message: U("stroke-only", e),
|
|
660
|
+
srcPath: e
|
|
661
|
+
}), dn(t) && n.push({
|
|
662
|
+
code: "unsupported-element",
|
|
663
|
+
message: U("unsupported-element", e),
|
|
480
664
|
srcPath: e
|
|
481
|
-
}))
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
665
|
+
}), fn(t) && n.push({
|
|
666
|
+
code: "use-reference",
|
|
667
|
+
message: U("use-reference", e),
|
|
668
|
+
srcPath: e
|
|
669
|
+
}), n;
|
|
670
|
+
}, mn = (e) => e.flatMap((e) => pn(e.srcPath, e.contents)), hn = (e, t) => t.diagnose ? !0 : !!(t.verbose && e.code === "evenodd-fill-rule");
|
|
671
|
+
})), _n, vn = r((() => {
|
|
672
|
+
_n = (e) => {
|
|
673
|
+
if (!e || !e.diagnose) return;
|
|
674
|
+
let t = { diagnose: !0 };
|
|
675
|
+
return e.onMessage && (t.onMessage = e.onMessage), t;
|
|
676
|
+
};
|
|
677
|
+
})), yn, bn = r((() => {
|
|
678
|
+
gn(), vn(), yn = (e, t, n = {}) => {
|
|
679
|
+
let r = _n(t), i = mn(e), { reporter: a, verbose: o = !1 } = n;
|
|
680
|
+
for (let e of i) hn(e, {
|
|
681
|
+
diagnose: r?.diagnose,
|
|
682
|
+
verbose: o
|
|
683
|
+
}) && a?.(e.message);
|
|
684
|
+
let s = [];
|
|
685
|
+
return r?.diagnose && (s = i), {
|
|
686
|
+
diagnostics: s,
|
|
687
|
+
glyphs: e
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
})), xn, Sn = r((() => {
|
|
691
|
+
bn(), xn = (e, t, n = {}) => {
|
|
692
|
+
let { diagnostics: r, glyphs: i } = yn(e, t, n);
|
|
693
|
+
return {
|
|
694
|
+
diagnostics: r,
|
|
695
|
+
glyphs: i
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
})), Cn, wn = r((() => {
|
|
699
|
+
At(), Cn = (e, t) => {
|
|
700
|
+
let n = "";
|
|
701
|
+
return new Promise((r, i) => {
|
|
702
|
+
t.verbose && console.log("Generating SVG font...");
|
|
703
|
+
let a = new de(kt(t)).on("finish", () => r(n)).on("data", (e) => {
|
|
704
|
+
n += e;
|
|
705
|
+
}).on("error", (e) => i(e));
|
|
706
|
+
e.forEach((e) => {
|
|
707
|
+
let t = new ge();
|
|
708
|
+
t.push(e.contents), t.push(null), t.metadata = e.metadata ?? {
|
|
709
|
+
name: "",
|
|
710
|
+
unicode: []
|
|
711
|
+
}, a.write(t);
|
|
712
|
+
}), a.end();
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
})), Tn, En = r((() => {
|
|
716
|
+
Tn = (e, t = {}) => Buffer.from(_e(e, t).buffer);
|
|
717
|
+
})), Dn, On, kn, An, jn = r((() => {
|
|
718
|
+
Wt(), qt(), tn(), Sn(), Ze(), wn(), En(), Dn = (e) => j(e), On = (e, t) => M(e, t), kn = (e) => N(e), An = async (e, t) => {
|
|
719
|
+
let n = (e) => {
|
|
720
|
+
if (t.svgTools?.onMessage) {
|
|
721
|
+
t.svgTools.onMessage(e);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
(t.svgTools?.diagnose || t.verbose) && console.log(e);
|
|
725
|
+
}, r = !!(t.svgTools?.onMessage || t.svgTools?.diagnose || t.verbose), i;
|
|
726
|
+
r && (i = n);
|
|
727
|
+
let { diagnostics: a, glyphs: o } = xn(e, t.svgTools, {
|
|
728
|
+
reporter: i,
|
|
729
|
+
verbose: t.verbose
|
|
730
|
+
}), s = o;
|
|
731
|
+
if (t.optimizeSvg && (s = Ut(s, t.svgoConfig)), t.glyphContentTransformFn) {
|
|
732
|
+
let e = t.glyphContentTransformFn;
|
|
733
|
+
s = await Promise.all(s.map(async (t) => {
|
|
734
|
+
let n = await e(t);
|
|
735
|
+
return {
|
|
736
|
+
...t,
|
|
737
|
+
contents: n
|
|
738
|
+
};
|
|
739
|
+
}));
|
|
740
|
+
}
|
|
741
|
+
if (t.glyphTransformFn) {
|
|
742
|
+
let e = t.glyphTransformFn;
|
|
743
|
+
s = await Promise.all(s.map(async (t) => {
|
|
744
|
+
let n = await e(t.metadata ?? {
|
|
745
|
+
name: "",
|
|
746
|
+
unicode: []
|
|
747
|
+
});
|
|
748
|
+
return {
|
|
749
|
+
...t,
|
|
750
|
+
metadata: n
|
|
751
|
+
};
|
|
752
|
+
}));
|
|
753
|
+
}
|
|
754
|
+
Gt(s.length, t.ligatures) && console.log(Kt(s.length));
|
|
755
|
+
let c = {};
|
|
756
|
+
t.formatsOptions?.ttf && (c = t.formatsOptions.ttf);
|
|
757
|
+
let l = await Cn(s, t);
|
|
758
|
+
en(l, s);
|
|
759
|
+
let u = Tn(l, c);
|
|
760
|
+
if (t.ttfPostProcess) {
|
|
761
|
+
let e = await t.ttfPostProcess(u, {
|
|
762
|
+
fontName: t.fontName,
|
|
763
|
+
formats: t.formats
|
|
492
764
|
});
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
765
|
+
u = Buffer.from(e);
|
|
766
|
+
}
|
|
767
|
+
let d = {
|
|
768
|
+
config: t,
|
|
769
|
+
glyphsData: s,
|
|
770
|
+
hash: me.createHash("md5").update(l).digest("hex"),
|
|
771
|
+
svg: l,
|
|
772
|
+
ttf: u
|
|
773
|
+
};
|
|
774
|
+
a.length > 0 && (d.svgDiagnostics = a);
|
|
775
|
+
let { formats: f } = t;
|
|
776
|
+
if (f.includes("eot") && (d.eot = Dn(u)), f.includes("woff")) {
|
|
777
|
+
let e;
|
|
778
|
+
typeof t.metadata == "string" && (e = t.metadata), d.woff = On(u, { metadata: e });
|
|
779
|
+
}
|
|
780
|
+
if (f.includes("woff2") && (d.woff2 = Buffer.from(await kn(u))), t.template) {
|
|
781
|
+
let { renderTemplates: e } = await import("./renderTemplates-CXVKq3Op.mjs"), { templates: n, usedBuildInTemplate: r } = e(t, d, f);
|
|
782
|
+
n.length > 0 && (d.templates = n, d.template = n[0]?.content, d.usedBuildInTemplate = r);
|
|
783
|
+
}
|
|
784
|
+
return f.includes("svg") || delete d.svg, f.includes("ttf") || delete d.ttf, f.includes("otf") || delete d.otf, d;
|
|
785
|
+
};
|
|
786
|
+
})), W, Mn, G, K, Nn, Pn = r((() => {
|
|
787
|
+
W = /* @__PURE__ */ new Set([
|
|
788
|
+
"eot",
|
|
789
|
+
"otf",
|
|
505
790
|
"svg",
|
|
506
791
|
"ttf",
|
|
507
|
-
"eot",
|
|
508
792
|
"woff",
|
|
509
793
|
"woff2"
|
|
510
|
-
],
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
normalize: !1,
|
|
520
|
-
prependUnicode: !1,
|
|
521
|
-
round: 0x9184e72a000,
|
|
522
|
-
sort: !0,
|
|
523
|
-
startUnicode: 59905,
|
|
524
|
-
templateFontPath: "./",
|
|
525
|
-
unicodeRange: !1,
|
|
526
|
-
verbose: !1
|
|
527
|
-
}), $e = (e) => {
|
|
528
|
-
if (!e?.files) throw Error("You must pass webfont a `files` glob");
|
|
529
|
-
return {
|
|
530
|
-
...Qe(),
|
|
531
|
-
...e
|
|
532
|
-
};
|
|
533
|
-
}, et = () => ({
|
|
534
|
-
multipass: !1,
|
|
535
|
-
plugins: [
|
|
536
|
-
"removeDoctype",
|
|
537
|
-
"removeXMLProcInst",
|
|
538
|
-
"removeComments",
|
|
539
|
-
"removeMetadata",
|
|
540
|
-
"removeEditorsNSData",
|
|
541
|
-
"removeDesc",
|
|
542
|
-
"cleanupAttrs",
|
|
543
|
-
"removeUnusedNS"
|
|
544
|
-
]
|
|
545
|
-
}), tt = (e) => {
|
|
546
|
-
let t = et();
|
|
547
|
-
return e ? {
|
|
548
|
-
...t,
|
|
549
|
-
...e,
|
|
550
|
-
plugins: e.plugins ?? t.plugins
|
|
551
|
-
} : t;
|
|
552
|
-
}, nt = (e, t, n) => oe(e, {
|
|
553
|
-
...tt(n),
|
|
554
|
-
path: t
|
|
555
|
-
}).data, rt = (e, t) => e.map((e) => ({
|
|
556
|
-
...e,
|
|
557
|
-
contents: nt(e.contents, e.srcPath, t)
|
|
558
|
-
})), it = (e, t) => t && e > 2e3, at = (e) => `Warning: ${e} glyphs with ligatures enabled may cause severe browser slowdown or hangs (especially Firefox on Windows). Ligatures are off by default; enable only if needed: --ligatures or ligatures: true. See TROUBLESHOOTING.md and https://github.com/itgalaxy/webfont/issues/558`, ot = /<glyph\b([^>/]*)(?:\/>|>)/giu, st = /\bglyph-name=["']([^"']+)["']/iu, ct = /\bd=["']([^"']*)["']/iu, lt = (e) => {
|
|
559
|
-
let t = [];
|
|
560
|
-
for (let n of e.matchAll(ot)) {
|
|
561
|
-
let e = n[1] ?? "", r = st.exec(e);
|
|
562
|
-
r && (ct.exec(e)?.[1] ?? "").trim().length === 0 && t.push(r[1]);
|
|
563
|
-
}
|
|
564
|
-
return t;
|
|
565
|
-
}, ut = (e, t) => {
|
|
566
|
-
for (let n of t) {
|
|
567
|
-
let t = n.metadata?.name;
|
|
568
|
-
if (t && (e === t || e.startsWith(`${t}-`))) return n.srcPath;
|
|
569
|
-
}
|
|
570
|
-
}, dt = (e, t) => {
|
|
571
|
-
let n = /* @__PURE__ */ new Set(), r = [];
|
|
572
|
-
for (let i of e) {
|
|
573
|
-
let e = ut(i, t), a = e ?? i;
|
|
574
|
-
n.has(a) || (n.add(a), e ? r.push(`${i} (${e})`) : r.push(i));
|
|
575
|
-
}
|
|
576
|
-
return r.join("; ");
|
|
577
|
-
}, ft = (e, t) => {
|
|
578
|
-
let n = lt(e);
|
|
579
|
-
if (n.length === 0) return;
|
|
580
|
-
let r = dt(n, t);
|
|
581
|
-
throw Error(`Empty glyph path(s) in SVG font output for: ${r}. Stroke-only SVGs (fill="none" with stroke) often produce empty glyphs because svgicons2svgfont does not convert strokes. Convert strokes to filled paths in your design tool, preprocess with glyphContentTransformFn (for example svg-outline-stroke), or run with --svg-diagnose for compatibility warnings. See TROUBLESHOOTING.md ("Stroke-only SVGs produce blank icons").`);
|
|
582
|
-
}, pt = /fill-rule\s*:\s*evenodd|fill-rule\s*=\s*["']evenodd["']/iu, mt = (e) => pt.test(e), ht = /\bstroke\s*=|\bstroke\s*:/iu, gt = /fill\s*=\s*["']none["']|fill\s*:\s*none/iu, _t = /<(line|polyline|clipPath)\b/iu, vt = (e) => ht.test(e) ? gt.test(e) : !1, yt = (e) => _t.test(e), U = (e, t) => {
|
|
583
|
-
switch (e) {
|
|
584
|
-
case "evenodd-fill-rule": return `[webfont:diagnose] ${t} uses fill-rule: evenodd. Icon fonts render glyphs with the nonzero fill rule, so holes and counter-shapes can disappear. See TROUBLESHOOTING.md ("Icon details missing after export").`;
|
|
585
|
-
case "stroke-only": return `[webfont:diagnose] ${t} uses stroke-based paths (fill="none"). svgicons2svgfont ignores stroke; outlines may render as solid shapes or lose detail. Preprocess with glyphContentTransformFn (for example svg-outline-stroke) before conversion. See TROUBLESHOOTING.md ("Icon details missing after export").`;
|
|
586
|
-
case "unsupported-element": return `[webfont:diagnose] ${t} contains <line>, <polyline>, or <clipPath>. These elements are poorly supported in icon fonts; results may differ from the browser preview. Convert to filled paths or preprocess with glyphContentTransformFn.`;
|
|
587
|
-
default: return e;
|
|
588
|
-
}
|
|
589
|
-
}, bt = (e, t) => {
|
|
590
|
-
let n = [];
|
|
591
|
-
return mt(t) && n.push({
|
|
592
|
-
code: "evenodd-fill-rule",
|
|
593
|
-
message: U("evenodd-fill-rule", e),
|
|
594
|
-
srcPath: e
|
|
595
|
-
}), vt(t) && n.push({
|
|
596
|
-
code: "stroke-only",
|
|
597
|
-
message: U("stroke-only", e),
|
|
598
|
-
srcPath: e
|
|
599
|
-
}), yt(t) && n.push({
|
|
600
|
-
code: "unsupported-element",
|
|
601
|
-
message: U("unsupported-element", e),
|
|
602
|
-
srcPath: e
|
|
603
|
-
}), n;
|
|
604
|
-
}, xt = (e) => e.flatMap((e) => bt(e.srcPath, e.contents)), St = (e, t) => t.diagnose ? !0 : !!(t.verbose && e.code === "evenodd-fill-rule"), Ct = (e) => {
|
|
605
|
-
if (!e || !e.diagnose) return;
|
|
606
|
-
let t = { diagnose: !0 };
|
|
607
|
-
return e.onMessage && (t.onMessage = e.onMessage), t;
|
|
608
|
-
}, wt = (e, t, n = {}) => {
|
|
609
|
-
let r = Ct(t), i = xt(e), { reporter: a, verbose: o = !1 } = n;
|
|
610
|
-
for (let e of i) St(e, {
|
|
611
|
-
diagnose: r?.diagnose,
|
|
612
|
-
verbose: o
|
|
613
|
-
}) && a?.(e.message);
|
|
614
|
-
let s = [];
|
|
615
|
-
return r?.diagnose && (s = i), {
|
|
616
|
-
diagnostics: s,
|
|
617
|
-
glyphs: e
|
|
618
|
-
};
|
|
619
|
-
}, Tt = (e, t, n = {}) => {
|
|
620
|
-
let { diagnostics: r, glyphs: i } = wt(e, t, n);
|
|
621
|
-
return {
|
|
622
|
-
diagnostics: r,
|
|
623
|
-
glyphs: i
|
|
794
|
+
]), Mn = [...W].join(", "), G = (e) => {
|
|
795
|
+
if (typeof e != "string" || !W.has(e)) throw Error(`Invalid format "${String(e)}". Expected one of: ${Mn}`);
|
|
796
|
+
return e;
|
|
797
|
+
}, K = (e) => {
|
|
798
|
+
if (e.length === 0) throw Error("formats must not be empty");
|
|
799
|
+
return e.map(G);
|
|
800
|
+
}, Nn = (e) => {
|
|
801
|
+
if (!Array.isArray(e)) throw Error("formats must be an array of format names (e.g. [\"woff2\", \"svg\"])");
|
|
802
|
+
return K(e);
|
|
624
803
|
};
|
|
625
|
-
},
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}, a.write(t);
|
|
638
|
-
}), a.end();
|
|
639
|
-
});
|
|
640
|
-
}, Dt = (e, t = {}) => Buffer.from(ce(e, t).buffer), Ot = (e) => M(e), kt = (e, t) => N(e, t), At = (e) => P(e), jt = async (e, t) => {
|
|
641
|
-
let n = (e) => {
|
|
642
|
-
if (t.svgTools?.onMessage) {
|
|
643
|
-
t.svgTools.onMessage(e);
|
|
804
|
+
})), q, Fn, J, In, Ln, Rn, zn = r((() => {
|
|
805
|
+
Pn(), o(), q = (e, t) => {
|
|
806
|
+
if (t !== void 0 && typeof t != "string") throw Error(`${e} must be a string`);
|
|
807
|
+
}, Fn = (e, t) => {
|
|
808
|
+
if (t !== void 0 && typeof t != "boolean" && typeof t != "string") throw Error(`${e} must be a boolean or string`);
|
|
809
|
+
}, J = (e, t) => {
|
|
810
|
+
if (t !== void 0 && typeof t != "boolean") throw Error(`${e} must be a boolean`);
|
|
811
|
+
}, In = (e, t) => {
|
|
812
|
+
if (t !== void 0 && (typeof t != "object" || !t || Array.isArray(t))) throw Error(`${e} must be an object`);
|
|
813
|
+
}, Ln = (e) => {
|
|
814
|
+
if (typeof e == "string") {
|
|
815
|
+
if (e.length === 0) throw Error("files must not be empty");
|
|
644
816
|
return;
|
|
645
817
|
}
|
|
646
|
-
(
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}),
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
818
|
+
if (Array.isArray(e)) {
|
|
819
|
+
if (e.length === 0) throw Error("files must not be empty");
|
|
820
|
+
if (!e.every((e) => typeof e == "string")) throw Error("files must be a string or an array of strings");
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
throw Error("files must be a string or an array of strings");
|
|
824
|
+
}, Rn = (e) => (Ln(e.files), e.formats = Nn(e.formats), q("fontName", e.fontName), Fn("unicodeRange", e.unicodeRange), J("optimizeSvg", e.optimizeSvg), In("svgoConfig", e.svgoConfig), J("templateFontLigatures", e.templateFontLigatures), e.template !== void 0 && i(e.template), q("templateFontPath", e.templateFontPath), e);
|
|
825
|
+
})), Bn, Y, Vn, Hn, Un = r((() => {
|
|
826
|
+
We(), ut(), wt(), Pt(), H(), Rt(), jn(), zn(), Bn = (e) => "filepath" in e, Y = async (e) => {
|
|
827
|
+
let t = ne("webfont", { searchStrategy: "global" });
|
|
828
|
+
if (e.configFile) {
|
|
829
|
+
let n = f.resolve(process.cwd(), e.configFile);
|
|
830
|
+
return await t.load(n) ?? {};
|
|
831
|
+
}
|
|
832
|
+
return await t.search(process.cwd()) ?? {};
|
|
833
|
+
}, Vn = Y, Hn = async (e) => {
|
|
834
|
+
let t = Lt(e);
|
|
835
|
+
delete t.filePath;
|
|
836
|
+
let n = await Y({ configFile: t.configFile }), r;
|
|
837
|
+
Bn(n) && (t = re(t, n.config, { arrayMerge: (e, t) => t }), r = n.filepath), t = Rn(t);
|
|
838
|
+
let i;
|
|
839
|
+
i = Array.isArray(t.files) ? t.files : [t.files];
|
|
840
|
+
let a = await Ue(i), o = $e(a);
|
|
841
|
+
if (o === "mixed") throw Error("Cannot mix SVG icons, TTF fonts, and WOFF/WOFF2 files in the same run");
|
|
842
|
+
if (o === "empty") throw Error("Files glob patterns specified did not match any supported files");
|
|
843
|
+
if (o === "webfont") {
|
|
844
|
+
let e = await Ct(V(a, o), t);
|
|
845
|
+
return r && (e.config = {
|
|
658
846
|
...t,
|
|
659
|
-
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
s = await Promise.all(s.map(async (t) => {
|
|
666
|
-
let n = await e(t.metadata ?? {
|
|
667
|
-
name: "",
|
|
668
|
-
unicode: []
|
|
669
|
-
});
|
|
670
|
-
return {
|
|
847
|
+
filePath: r
|
|
848
|
+
}), e;
|
|
849
|
+
}
|
|
850
|
+
if (o === "ttf") {
|
|
851
|
+
let e = await lt(V(a, o), t);
|
|
852
|
+
return r && (e.config = {
|
|
671
853
|
...t,
|
|
672
|
-
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
t.formatsOptions?.ttf && (c = t.formatsOptions.ttf);
|
|
679
|
-
let l = await Et(s, t);
|
|
680
|
-
ft(l, s);
|
|
681
|
-
let u = Dt(l, c), d = {
|
|
682
|
-
config: t,
|
|
683
|
-
glyphsData: s,
|
|
684
|
-
hash: ae.createHash("md5").update(l).digest("hex"),
|
|
685
|
-
svg: l,
|
|
686
|
-
ttf: u
|
|
687
|
-
};
|
|
688
|
-
a.length > 0 && (d.svgDiagnostics = a);
|
|
689
|
-
let { formats: f } = t;
|
|
690
|
-
if (f.includes("eot") && (d.eot = Ot(u)), f.includes("woff")) {
|
|
691
|
-
let e;
|
|
692
|
-
typeof t.metadata == "string" && (e = t.metadata), d.woff = kt(u, { metadata: e });
|
|
693
|
-
}
|
|
694
|
-
if (f.includes("woff2") && (d.woff2 = Buffer.from(await At(u))), t.template) {
|
|
695
|
-
let { renderTemplates: e } = await import("./renderTemplates-DvRlS58E.mjs"), { templates: n, usedBuildInTemplate: r } = e(t, d, f);
|
|
696
|
-
n.length > 0 && (d.templates = n, d.template = n[0]?.content, d.usedBuildInTemplate = r);
|
|
697
|
-
}
|
|
698
|
-
return f.includes("svg") || delete d.svg, f.includes("ttf") || delete d.ttf, f.includes("otf") || delete d.otf, d;
|
|
699
|
-
}, W = /* @__PURE__ */ new Set([
|
|
700
|
-
"eot",
|
|
701
|
-
"otf",
|
|
702
|
-
"svg",
|
|
703
|
-
"ttf",
|
|
704
|
-
"woff",
|
|
705
|
-
"woff2"
|
|
706
|
-
]), Mt = [...W].join(", "), G = (e) => {
|
|
707
|
-
if (typeof e != "string" || !W.has(e)) throw Error(`Invalid format "${String(e)}". Expected one of: ${Mt}`);
|
|
708
|
-
return e;
|
|
709
|
-
}, K = (e) => {
|
|
710
|
-
if (e.length === 0) throw Error("formats must not be empty");
|
|
711
|
-
return e.map(G);
|
|
712
|
-
}, Nt = (e) => {
|
|
713
|
-
if (!Array.isArray(e)) throw Error("formats must be an array of format names (e.g. [\"woff2\", \"svg\"])");
|
|
714
|
-
return K(e);
|
|
715
|
-
}, q = (e, t) => {
|
|
716
|
-
if (t !== void 0 && typeof t != "string") throw Error(`${e} must be a string`);
|
|
717
|
-
}, Pt = (e, t) => {
|
|
718
|
-
if (t !== void 0 && typeof t != "boolean" && typeof t != "string") throw Error(`${e} must be a boolean or string`);
|
|
719
|
-
}, J = (e, t) => {
|
|
720
|
-
if (t !== void 0 && typeof t != "boolean") throw Error(`${e} must be a boolean`);
|
|
721
|
-
}, Ft = (e, t) => {
|
|
722
|
-
if (t !== void 0 && (typeof t != "object" || !t || Array.isArray(t))) throw Error(`${e} must be an object`);
|
|
723
|
-
}, It = (e) => {
|
|
724
|
-
if (typeof e == "string") {
|
|
725
|
-
if (e.length === 0) throw Error("files must not be empty");
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
if (Array.isArray(e)) {
|
|
729
|
-
if (e.length === 0) throw Error("files must not be empty");
|
|
730
|
-
if (!e.every((e) => typeof e == "string")) throw Error("files must be a string or an array of strings");
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
throw Error("files must be a string or an array of strings");
|
|
734
|
-
}, Lt = (e) => (It(e.files), e.formats = Nt(e.formats), q("fontName", e.fontName), Pt("unicodeRange", e.unicodeRange), J("optimizeSvg", e.optimizeSvg), Ft("svgoConfig", e.svgoConfig), J("templateFontLigatures", e.templateFontLigatures), e.template !== void 0 && n(e.template), q("templateFontPath", e.templateFontPath), e), Rt = (e) => "filepath" in e, Y = async (e) => {
|
|
735
|
-
let t = d("webfont", { searchStrategy: "global" });
|
|
736
|
-
if (e.configFile) {
|
|
737
|
-
let n = c.resolve(process.cwd(), e.configFile);
|
|
738
|
-
return await t.load(n) ?? {};
|
|
739
|
-
}
|
|
740
|
-
return await t.search(process.cwd()) ?? {};
|
|
741
|
-
}, zt = Y, Bt = async (e) => {
|
|
742
|
-
let t = $e(e);
|
|
743
|
-
delete t.filePath;
|
|
744
|
-
let n = await Y({ configFile: t.configFile }), r;
|
|
745
|
-
Rt(n) && (t = f(t, n.config, { arrayMerge: (e, t) => t }), r = n.filepath), t = Lt(t);
|
|
746
|
-
let i;
|
|
747
|
-
i = Array.isArray(t.files) ? t.files : [t.files];
|
|
748
|
-
let a = await E(i), o = Se(a);
|
|
749
|
-
if (o === "mixed") throw Error("Cannot mix SVG icons, TTF fonts, and WOFF/WOFF2 files in the same run");
|
|
750
|
-
if (o === "empty") throw Error("Files glob patterns specified did not match any supported files");
|
|
751
|
-
if (o === "webfont") {
|
|
752
|
-
let e = await We(H(a, o), t);
|
|
753
|
-
return r && (e.config = {
|
|
754
|
-
...t,
|
|
755
|
-
filePath: r
|
|
756
|
-
}), e;
|
|
757
|
-
}
|
|
758
|
-
if (o === "ttf") {
|
|
759
|
-
let e = await Me(H(a, o), t);
|
|
760
|
-
return r && (e.config = {
|
|
854
|
+
filePath: r
|
|
855
|
+
}), e;
|
|
856
|
+
}
|
|
857
|
+
et(t.formats);
|
|
858
|
+
let s = await An(await Nt(V(a, "svg"), t), t);
|
|
859
|
+
return r ? s.config = {
|
|
761
860
|
...t,
|
|
762
861
|
filePath: r
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
862
|
+
} : s.config = t, s;
|
|
863
|
+
};
|
|
864
|
+
})), Wn, Gn = r((() => {
|
|
865
|
+
Wn = (e) => {
|
|
866
|
+
if (e.svgDiagnose) return { diagnose: !0 };
|
|
867
|
+
};
|
|
868
|
+
})), Kn, qn = r((() => {
|
|
869
|
+
Pn(), Kn = (e) => {
|
|
870
|
+
if (e === void 0) return;
|
|
871
|
+
let t = e.trim();
|
|
872
|
+
if (t.length === 0) throw Error("formats must not be empty");
|
|
873
|
+
if (t.startsWith("[") || t.startsWith("{")) {
|
|
874
|
+
let e;
|
|
875
|
+
try {
|
|
876
|
+
e = JSON.parse(t);
|
|
877
|
+
} catch {
|
|
878
|
+
throw Error("formats must be a JSON array (e.g. [\"woff2\",\"svg\"]) or comma-separated list");
|
|
879
|
+
}
|
|
880
|
+
if (!Array.isArray(e)) throw Error("formats must be a JSON array (e.g. [\"woff2\",\"svg\"]) or comma-separated list");
|
|
881
|
+
return K(e);
|
|
783
882
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
883
|
+
return t.split(",").map((e) => e.trim()).filter((e) => e.length > 0).map(G);
|
|
884
|
+
};
|
|
885
|
+
})), Jn, Yn = r((() => {
|
|
886
|
+
o(), Jn = (e) => {
|
|
887
|
+
if (e === void 0) return;
|
|
888
|
+
let t = e.trim();
|
|
889
|
+
if (t.length === 0) throw Error("template must not be empty");
|
|
890
|
+
if (t.startsWith("[") || t.startsWith("{")) {
|
|
891
|
+
let e;
|
|
892
|
+
try {
|
|
893
|
+
e = JSON.parse(t);
|
|
894
|
+
} catch {
|
|
895
|
+
throw Error("template must be a JSON array (e.g. [\"html\",\"scss\"]) or a template name");
|
|
896
|
+
}
|
|
897
|
+
if (!Array.isArray(e)) throw Error("template must be a JSON array (e.g. [\"html\",\"scss\"]) or a template name");
|
|
898
|
+
return i(e);
|
|
899
|
+
}
|
|
900
|
+
return t.includes(",") ? i(t.split(",").map((e) => e.trim()).filter((e) => e.length > 0)) : t;
|
|
901
|
+
};
|
|
902
|
+
})), Xn, X, Zn = r((() => {
|
|
903
|
+
Un(), Xn = (e) => {
|
|
904
|
+
if (!(!("config" in e) || e.config?.files === void 0)) return Array.isArray(e.config.files) ? e.config.files : [e.config.files];
|
|
905
|
+
}, X = async (e, t) => {
|
|
906
|
+
let n = await Vn({ configFile: t.configFile }), r = Xn(n);
|
|
907
|
+
if (e.input.length > 0 && r !== void 0) throw Error("Cannot specify input files on the command line when `files` is set in the config file");
|
|
908
|
+
return e.input.length > 0 ? e.input : r === void 0 ? [] : r;
|
|
909
|
+
};
|
|
910
|
+
})), Qn, $n, Z, er, Q, tr, nr, rr, ir, ar, or, $, sr, cr, lr, ur, dr, fr, pr, mr = r((() => {
|
|
911
|
+
We(), Un(), Gn(), qn(), Yn(), Zn(), Qn = [
|
|
912
|
+
"svg",
|
|
913
|
+
"ttf",
|
|
914
|
+
"otf",
|
|
915
|
+
"eot",
|
|
916
|
+
"woff",
|
|
917
|
+
"woff2",
|
|
918
|
+
"hash",
|
|
919
|
+
"template"
|
|
920
|
+
], $n = (e) => {
|
|
921
|
+
let t = {};
|
|
922
|
+
typeof e.flags.config == "string" && (t.configFile = ee.silent(process.cwd(), e.flags.config) || d.join(process.cwd(), e.flags.config)), e.flags.fontName && (t.fontName = e.flags.fontName), e.flags.formats && (t.formats = Kn(e.flags.formats)), e.flags.dest && (t.dest = e.flags.dest), e.flags.destCreate && (t.destCreate = e.flags.destCreate), e.flags.template && (t.template = Jn(e.flags.template)), e.flags.templateClassName && (t.templateClassName = e.flags.templateClassName), e.flags.templateFontPath && (t.templateFontPath = e.flags.templateFontPath), e.flags.templateFontName && (t.templateFontName = e.flags.templateFontName), e.flags.templateCacheString && (t.templateCacheString = e.flags.templateCacheString), e.flags.destTemplate && (t.destTemplate = e.flags.destTemplate), e.flags.verbose && (t.verbose = e.flags.verbose), e.flags.fontId && (t.fontId = e.flags.fontId), e.flags.fontStyle && (t.fontStyle = e.flags.fontStyle), e.flags.fontWeight && (t.fontWeight = e.flags.fontWeight), e.flags.fixedWidth && (t.fixedWidth = e.flags.fixedWidth), e.flags.centerHorizontally && (t.centerHorizontally = e.flags.centerHorizontally), e.flags.centerVertically && (t.centerVertically = e.flags.centerVertically), e.flags.normalize && (t.normalize = e.flags.normalize), e.flags.optimizeSvg && (t.optimizeSvg = e.flags.optimizeSvg), e.flags.fontHeight && (t.fontHeight = e.flags.fontHeight), e.flags.round && (t.round = e.flags.round), e.flags.descent && (t.descent = e.flags.descent), e.flags.ascent && (t.ascent = e.flags.ascent), e.flags.startUnicode && (t.startUnicode = e.flags.startUnicode), e.flags.prependUnicode && (t.prependUnicode = e.flags.prependUnicode), e.flags.metadata && (t.metadata = e.flags.metadata), e.flags.sort === !1 && (t.sort = e.flags.sort), e.flags.ligatures && (t.ligatures = e.flags.ligatures), e.flags.unicodeRange && (t.unicodeRange = e.flags.unicodeRange), e.flags.templateFontLigatures === !1 && (t.templateFontLigatures = e.flags.templateFontLigatures), e.flags.addHashInFontUrl && (t.addHashInFontUrl = e.flags.addHashInFontUrl);
|
|
923
|
+
let n = Wn(e.flags);
|
|
924
|
+
return n && (t.svgTools = n), t;
|
|
925
|
+
}, Z = (e) => {
|
|
926
|
+
if (!e.config) throw Error("Missing config in webfont result");
|
|
927
|
+
return e.config;
|
|
928
|
+
}, er = (e, t) => (e.config = {
|
|
929
|
+
...Z(e),
|
|
930
|
+
dest: t.dest,
|
|
931
|
+
destTemplate: t.destTemplate
|
|
932
|
+
}, e), Q = (e, t, n) => {
|
|
933
|
+
let r = t.dest ?? process.cwd();
|
|
934
|
+
return typeof t.destTemplate == "string" && (r = t.destTemplate), n ? d.join(r, `${t.fontName}.${e}`) : d.join(r, d.basename(e).replace(".njk", ""));
|
|
935
|
+
}, tr = (e) => Array.isArray(e) ? e[0] : e, nr = (e, t) => {
|
|
936
|
+
if (!e.template) return;
|
|
937
|
+
let n = tr(t.template);
|
|
938
|
+
if (e.usedBuildInTemplate && n) return Q(n, t, !0);
|
|
939
|
+
if (n) return Q(n, t, !1);
|
|
940
|
+
let r = t.dest ?? process.cwd();
|
|
941
|
+
return typeof t.destTemplate == "string" ? t.destTemplate : r;
|
|
942
|
+
}, rr = async (e, t) => {
|
|
943
|
+
await Promise.all(e.map(async (e) => {
|
|
944
|
+
let n = d.resolve(Q(e.template, t, !!e.builtIn));
|
|
945
|
+
await l.promises.mkdir(d.dirname(n), { recursive: !0 }), await l.promises.writeFile(n, e.content);
|
|
946
|
+
}));
|
|
947
|
+
}, ir = (e, t, n, r) => {
|
|
948
|
+
let i = n.fontName, a = n.dest ?? process.cwd();
|
|
949
|
+
return e === "template" ? d.resolve(r ?? a) : e === "hash" ? d.resolve(d.join(a, `${i}.hash`)) : d.resolve(d.join(a, `${i}.${e}`));
|
|
950
|
+
}, ar = (e) => /* @__PURE__ */ Error(`Destination directory "${e}" does not exist. Use --dest-create (-m) to create it.`), or = async (e, t) => {
|
|
794
951
|
try {
|
|
795
|
-
e
|
|
952
|
+
await l.promises.access(e, l.constants.F_OK);
|
|
796
953
|
} catch {
|
|
797
|
-
|
|
954
|
+
if (t) {
|
|
955
|
+
await l.promises.mkdir(e, { recursive: !0 });
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
throw ar(e);
|
|
798
959
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
},
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
"
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
}
|
|
834
|
-
if (!e.template) return;
|
|
835
|
-
let n = Q(t.template);
|
|
836
|
-
if (e.usedBuildInTemplate && n) return Z(n, t, !0);
|
|
837
|
-
if (n) return Z(n, t, !1);
|
|
838
|
-
let r = t.dest ?? process.cwd();
|
|
839
|
-
return typeof t.destTemplate == "string" ? t.destTemplate : r;
|
|
840
|
-
}, Xt = async (e, t) => {
|
|
841
|
-
await Promise.all(e.map(async (e) => {
|
|
842
|
-
let n = s.resolve(Z(e.template, t, !!e.builtIn));
|
|
843
|
-
await a.promises.mkdir(s.dirname(n), { recursive: !0 }), await a.promises.writeFile(n, e.content);
|
|
844
|
-
}));
|
|
845
|
-
}, Zt = (e, t, n, r) => {
|
|
846
|
-
let i = n.fontName, a = n.dest ?? process.cwd();
|
|
847
|
-
return e === "template" ? s.resolve(r ?? a) : e === "hash" ? s.resolve(s.join(a, `${i}.hash`)) : s.resolve(s.join(a, `${i}.${e}`));
|
|
848
|
-
}, Qt = (e) => /* @__PURE__ */ Error(`Destination directory "${e}" does not exist. Use --dest-create (-m) to create it.`), $t = async (e, t) => {
|
|
849
|
-
try {
|
|
850
|
-
await a.promises.access(e, a.constants.F_OK);
|
|
851
|
-
} catch {
|
|
852
|
-
if (t) {
|
|
853
|
-
await a.promises.mkdir(e, { recursive: !0 });
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
throw Qt(e);
|
|
857
|
-
}
|
|
858
|
-
}, $ = (e, t, n) => e.length === 1 && n.fontName ? n.fontName : T(e.map((e) => e.source))[e.indexOf(t)] ?? n.fontName, en = async (e, t, n) => {
|
|
859
|
-
await Promise.all(e.flatMap((r) => {
|
|
860
|
-
let i = $(e, r, t), o = [];
|
|
861
|
-
return r.ttf && o.push(a.promises.writeFile(s.resolve(s.join(n, `${i}.ttf`)), r.ttf)), r.otf && o.push(a.promises.writeFile(s.resolve(s.join(n, `${i}.otf`)), r.otf)), o;
|
|
862
|
-
}));
|
|
863
|
-
}, tn = (e, t, n) => $(e, t, n), nn = async (e, t, n) => {
|
|
864
|
-
await Promise.all(e.flatMap((r) => {
|
|
865
|
-
let i = tn(e, r, t), o = [];
|
|
866
|
-
return r.ttf && o.push(a.promises.writeFile(s.resolve(s.join(n, `${i}.ttf`)), r.ttf)), r.eot && o.push(a.promises.writeFile(s.resolve(s.join(n, `${i}.eot`)), r.eot)), r.woff && o.push(a.promises.writeFile(s.resolve(s.join(n, `${i}.woff`)), r.woff)), r.woff2 && o.push(a.promises.writeFile(s.resolve(s.join(n, `${i}.woff2`)), r.woff2)), o;
|
|
867
|
-
}));
|
|
868
|
-
}, rn = async (e) => {
|
|
869
|
-
let t = X(e), n = t.dest ?? process.cwd(), r = Yt(e, t);
|
|
870
|
-
return e.template && delete e.hash, await $t(n, t.destCreate), e.templates && e.templates.length > 0 && await Xt(e.templates, t), e.transcodedFonts && e.transcodedFonts.length > 1 ? (await nn(e.transcodedFonts, t, n), e) : e.decompressedFonts && e.decompressedFonts.length > 1 ? (await en(e.decompressedFonts, t, n), e) : (await Promise.all(Kt.filter((t) => t === "template" && e.templates && e.templates.length > 0 ? !1 : e[t] !== void 0).map(async (n) => {
|
|
871
|
-
let i = e[n];
|
|
872
|
-
if (i === void 0) return;
|
|
873
|
-
let o = Zt(n, e, t, r);
|
|
874
|
-
await a.promises.writeFile(o, i);
|
|
875
|
-
})), e);
|
|
876
|
-
}, an = (e) => typeof e == "object" && e && "code" in e && typeof e.code == "number" ? e.code : 1, on = (e) => {
|
|
877
|
-
sn(e).catch((e) => {
|
|
878
|
-
console.log(e.stack), process.exit(an(e));
|
|
879
|
-
});
|
|
880
|
-
}, sn = async (e) => {
|
|
881
|
-
e.flags.help && e.showHelp(), e.flags.version && e.showVersion();
|
|
882
|
-
let t = qt(e), n = await Gt(e, t);
|
|
883
|
-
n.length === 0 && e.showHelp();
|
|
884
|
-
let r = {
|
|
885
|
-
...t,
|
|
886
|
-
files: n
|
|
887
|
-
}, i = await Bt(r);
|
|
888
|
-
return Jt(i, r), rn(i);
|
|
889
|
-
};
|
|
890
|
-
//#endregion
|
|
891
|
-
//#region src/cli/index.ts
|
|
892
|
-
on(ye);
|
|
960
|
+
}, $ = (e, t, n) => e.length === 1 && n.fontName ? n.fontName : He(e.map((e) => e.source))[e.indexOf(t)] ?? n.fontName, sr = async (e, t, n) => {
|
|
961
|
+
await Promise.all(e.flatMap((r) => {
|
|
962
|
+
let i = $(e, r, t), a = [];
|
|
963
|
+
return r.ttf && a.push(l.promises.writeFile(d.resolve(d.join(n, `${i}.ttf`)), r.ttf)), r.otf && a.push(l.promises.writeFile(d.resolve(d.join(n, `${i}.otf`)), r.otf)), a;
|
|
964
|
+
}));
|
|
965
|
+
}, cr = (e, t, n) => $(e, t, n), lr = async (e, t, n) => {
|
|
966
|
+
await Promise.all(e.flatMap((r) => {
|
|
967
|
+
let i = cr(e, r, t), a = [];
|
|
968
|
+
return r.ttf && a.push(l.promises.writeFile(d.resolve(d.join(n, `${i}.ttf`)), r.ttf)), r.eot && a.push(l.promises.writeFile(d.resolve(d.join(n, `${i}.eot`)), r.eot)), r.woff && a.push(l.promises.writeFile(d.resolve(d.join(n, `${i}.woff`)), r.woff)), r.woff2 && a.push(l.promises.writeFile(d.resolve(d.join(n, `${i}.woff2`)), r.woff2)), a;
|
|
969
|
+
}));
|
|
970
|
+
}, ur = async (e) => {
|
|
971
|
+
let t = Z(e), n = t.dest ?? process.cwd(), r = nr(e, t);
|
|
972
|
+
return e.template && delete e.hash, await or(n, t.destCreate), e.templates && e.templates.length > 0 && await rr(e.templates, t), e.transcodedFonts && e.transcodedFonts.length > 1 ? (await lr(e.transcodedFonts, t, n), e) : e.decompressedFonts && e.decompressedFonts.length > 1 ? (await sr(e.decompressedFonts, t, n), e) : (await Promise.all(Qn.filter((t) => t === "template" && e.templates && e.templates.length > 0 ? !1 : e[t] !== void 0).map(async (n) => {
|
|
973
|
+
let i = e[n];
|
|
974
|
+
if (i === void 0) return;
|
|
975
|
+
let a = ir(n, e, t, r);
|
|
976
|
+
await l.promises.writeFile(a, i);
|
|
977
|
+
})), e);
|
|
978
|
+
}, dr = (e) => typeof e == "object" && e && "code" in e && typeof e.code == "number" ? e.code : 1, fr = (e) => {
|
|
979
|
+
pr(e).catch((e) => {
|
|
980
|
+
console.log(e.stack), process.exit(dr(e));
|
|
981
|
+
});
|
|
982
|
+
}, pr = async (e) => {
|
|
983
|
+
e.flags.help && e.showHelp(), e.flags.version && e.showVersion();
|
|
984
|
+
let t = $n(e), n = await X(e, t);
|
|
985
|
+
n.length === 0 && e.showHelp();
|
|
986
|
+
let r = {
|
|
987
|
+
...t,
|
|
988
|
+
files: n
|
|
989
|
+
}, i = await Hn(r);
|
|
990
|
+
return er(i, r), ur(i);
|
|
991
|
+
};
|
|
992
|
+
})), hr = /* @__PURE__ */ a((() => {
|
|
993
|
+
Re(), mr(), fr(Le);
|
|
994
|
+
}));
|
|
893
995
|
//#endregion
|
|
996
|
+
export default hr();
|