webfont 12.1.0 → 12.1.1
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 +30 -12
- package/dist/cli.mjs +859 -769
- package/dist/index.js +1 -1
- package/dist/index.mjs +513 -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 +9 -0
- 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 +10 -0
- package/dist/src/types/MetadataProvider.d.mts +5 -0
- package/dist/src/types/OptionsBase.d.mts +39 -0
- 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/WebfontFromGlyphsOptions.d.mts +11 -0
- package/dist/src/types/WebfontOptions.d.mts +43 -0
- package/dist/src/types/index.d.mts +8 -0
- package/dist/templates/index.d.mts +19 -0
- package/package.json +32 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SvgDiagnosticCode = "evenodd-fill-rule" | "stroke-only" | "unsupported-element" | "use-reference";
|
|
2
|
+
export type SvgGlyphDiagnostic = {
|
|
3
|
+
code: SvgDiagnosticCode;
|
|
4
|
+
message: string;
|
|
5
|
+
srcPath: string;
|
|
6
|
+
};
|
|
7
|
+
/** Alpha. SVG diagnostics for the icon-font pipeline (see ADR 0011 — no bundled stroke-to-fill fixes). */
|
|
8
|
+
export type SvgToolsOptions = {
|
|
9
|
+
/** Scan source SVGs for known icon-font incompatibilities and report warnings. */
|
|
10
|
+
diagnose?: boolean;
|
|
11
|
+
/** Optional sink for diagnostic log lines (for example a web worker or test spy). */
|
|
12
|
+
onMessage?: (message: string) => void;
|
|
13
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SvgDiagnosticCode = "evenodd-fill-rule" | "stroke-only" | "unsupported-element";
|
|
1
|
+
export type SvgDiagnosticCode = "evenodd-fill-rule" | "stroke-only" | "unsupported-element" | "use-reference";
|
|
2
2
|
export type SvgGlyphDiagnostic = {
|
|
3
3
|
code: SvgDiagnosticCode;
|
|
4
4
|
message: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GlyphContentTransformFn } from './GlyphContentTransformFn.mjs';
|
|
2
|
+
import { GlyphInput } from './GlyphInput.mjs';
|
|
3
|
+
import { GlyphTransformFn } from './GlyphTransformFn.mjs';
|
|
4
|
+
import { MetadataProvider } from './MetadataProvider.mjs';
|
|
5
|
+
import { OptionsBase } from './OptionsBase.mjs';
|
|
6
|
+
export type WebfontFromGlyphsOptions = OptionsBase & {
|
|
7
|
+
glyphs: GlyphInput[];
|
|
8
|
+
glyphContentTransformFn?: GlyphContentTransformFn;
|
|
9
|
+
glyphTransformFn?: GlyphTransformFn;
|
|
10
|
+
metadataProvider?: MetadataProvider;
|
|
11
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Config as SvgoConfig } from 'svgo';
|
|
2
|
+
import { TemplateOption } from '../lib/parseTemplateOption.mjs';
|
|
3
|
+
import { Formats, FormatsOptions } from './Format.mjs';
|
|
4
|
+
import { GlyphContentTransformFn } from './GlyphContentTransformFn.mjs';
|
|
5
|
+
import { GlyphTransformFn } from './GlyphTransformFn.mjs';
|
|
6
|
+
import { InitialOptions } from './InitialOptions.mjs';
|
|
7
|
+
import { MetadataProvider } from './MetadataProvider.mjs';
|
|
8
|
+
import { SvgToolsOptions } from './SvgToolsOptions.mjs';
|
|
9
|
+
export interface WebfontOptions extends InitialOptions {
|
|
10
|
+
centerHorizontally: boolean;
|
|
11
|
+
descent: number;
|
|
12
|
+
fixedWidth: boolean;
|
|
13
|
+
fontHeight: unknown;
|
|
14
|
+
fontId: unknown;
|
|
15
|
+
fontName: string;
|
|
16
|
+
fontStyle: string;
|
|
17
|
+
fontWeight: string;
|
|
18
|
+
formats: Formats;
|
|
19
|
+
formatsOptions: FormatsOptions;
|
|
20
|
+
glyphTransformFn?: GlyphTransformFn;
|
|
21
|
+
glyphContentTransformFn?: GlyphContentTransformFn;
|
|
22
|
+
ligatures: boolean;
|
|
23
|
+
maxConcurrency: number;
|
|
24
|
+
metadata: unknown;
|
|
25
|
+
metadataProvider?: MetadataProvider;
|
|
26
|
+
normalize: boolean;
|
|
27
|
+
prependUnicode: boolean;
|
|
28
|
+
round: string | number;
|
|
29
|
+
sort: boolean;
|
|
30
|
+
startUnicode: number;
|
|
31
|
+
template?: TemplateOption;
|
|
32
|
+
templateCacheString?: unknown;
|
|
33
|
+
templateClassName?: unknown;
|
|
34
|
+
templateFontName?: unknown;
|
|
35
|
+
templateFontPath: string;
|
|
36
|
+
verbose: boolean;
|
|
37
|
+
addHashInFontUrl?: boolean;
|
|
38
|
+
unicodeRange?: boolean | string;
|
|
39
|
+
optimizeSvg?: boolean;
|
|
40
|
+
svgoConfig?: SvgoConfig;
|
|
41
|
+
templateFontLigatures?: boolean;
|
|
42
|
+
svgTools?: SvgToolsOptions;
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { Format, FormatsOptions } from '../types/Format.mjs';
|
|
2
|
+
export type { GlyphContentTransformFn } from './GlyphContentTransformFn.mjs';
|
|
3
|
+
export type { GlyphData } from './GlyphData.mjs';
|
|
4
|
+
export type { GlyphMetadata } from './GlyphMetadata.mjs';
|
|
5
|
+
export type { GlyphTransformFn } from './GlyphTransformFn.mjs';
|
|
6
|
+
export type { InitialOptions } from './InitialOptions.mjs';
|
|
7
|
+
export type { MetadataProvider } from './MetadataProvider.mjs';
|
|
8
|
+
export type { WebfontOptions } from './WebfontOptions.mjs';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const getTemplateDirectory: () => string;
|
|
2
|
+
export declare const getTemplateFilePath: (template: string) => string;
|
|
3
|
+
export declare const getBuiltInTemplates: () => {
|
|
4
|
+
css: {
|
|
5
|
+
path: string;
|
|
6
|
+
};
|
|
7
|
+
html: {
|
|
8
|
+
path: string;
|
|
9
|
+
};
|
|
10
|
+
json: {
|
|
11
|
+
path: string;
|
|
12
|
+
};
|
|
13
|
+
scss: {
|
|
14
|
+
path: string;
|
|
15
|
+
};
|
|
16
|
+
styl: {
|
|
17
|
+
path: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webfont",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.1",
|
|
4
4
|
"description": "Generator of fonts from SVG icons; decompress WOFF/WOFF2 to embedded TTF/OTF (not TTF↔OTF transcoding)",
|
|
5
5
|
"directories": {
|
|
6
6
|
"lib": "dist",
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"README.md",
|
|
16
16
|
"NOTICE.md"
|
|
17
17
|
],
|
|
18
|
+
"type": "commonjs",
|
|
19
|
+
"sideEffects": false,
|
|
18
20
|
"main": "dist/index.js",
|
|
21
|
+
"module": "dist/index.mjs",
|
|
19
22
|
"browser": "dist/browser.js",
|
|
20
23
|
"bin": "dist/cli.mjs",
|
|
21
24
|
"source": "src/index.ts",
|
|
@@ -23,16 +26,29 @@
|
|
|
23
26
|
"typings": "dist/src/index.d.ts",
|
|
24
27
|
"exports": {
|
|
25
28
|
".": {
|
|
29
|
+
"browser": {
|
|
30
|
+
"types": "./dist/src/index.d.ts",
|
|
31
|
+
"default": "./dist/browser.js"
|
|
32
|
+
},
|
|
26
33
|
"node": {
|
|
27
|
-
"import":
|
|
28
|
-
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/src/index.d.mts",
|
|
36
|
+
"default": "./dist/index.mjs"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/src/index.d.ts",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
}
|
|
29
42
|
},
|
|
30
|
-
"default":
|
|
43
|
+
"default": {
|
|
44
|
+
"types": "./dist/src/index.d.ts",
|
|
45
|
+
"default": "./dist/browser.js"
|
|
46
|
+
}
|
|
31
47
|
},
|
|
32
48
|
"./package.json": "./package.json"
|
|
33
49
|
},
|
|
34
50
|
"scripts": {
|
|
35
|
-
"build": "vite build --mode library && vite build --mode browser && vite build --mode cli",
|
|
51
|
+
"build": "vite build --mode library && vite build --mode library-esm && vite build --mode browser && vite build --mode cli && node scripts/emit-mts-types.mjs",
|
|
36
52
|
"clean": "rm -rf dist/ temp/",
|
|
37
53
|
"demo": "node dist/cli.mjs './src/fixtures/svg-icons/*.svg' -d demo -t html --normalize --center-horizontally",
|
|
38
54
|
"lint": "biome check .",
|
|
@@ -40,14 +56,18 @@
|
|
|
40
56
|
"prebuild": "npm run clean && npm run lint",
|
|
41
57
|
"prepare": "lefthook install",
|
|
42
58
|
"predemo": "npm run build",
|
|
43
|
-
"prepublishOnly": "npm run build",
|
|
59
|
+
"prepublishOnly": "npm run build && npm run test:package",
|
|
44
60
|
"pretest": "npm run build",
|
|
45
61
|
"prettify": "biome check --write .",
|
|
46
62
|
"test": "vitest run src",
|
|
63
|
+
"test:attw": "attw --pack .",
|
|
64
|
+
"test:pack": "node scripts/pack-smoke-test.mjs",
|
|
65
|
+
"test:package": "npm run test:publint && npm run test:attw && npm run test:pack",
|
|
66
|
+
"test:publint": "publint --level=warning",
|
|
47
67
|
"testc": "vitest run src --coverage",
|
|
48
68
|
"test-debug": "vitest run src --no-file-parallelism",
|
|
49
69
|
"testu": "vitest run src -u",
|
|
50
|
-
"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
|
|
70
|
+
"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'"
|
|
51
71
|
},
|
|
52
72
|
"dependencies": {
|
|
53
73
|
"cosmiconfig": "9.0.2",
|
|
@@ -63,21 +83,20 @@
|
|
|
63
83
|
"svgo": "4.0.1",
|
|
64
84
|
"ttf2eot": "3.1.0",
|
|
65
85
|
"ttf2woff": "^3.0.0",
|
|
66
|
-
"wawoff2": "2.0.
|
|
86
|
+
"wawoff2": "2.0.1",
|
|
67
87
|
"xml2js": "0.6.2"
|
|
68
88
|
},
|
|
69
89
|
"devDependencies": {
|
|
90
|
+
"@arethetypeswrong/cli": "0.18.4",
|
|
70
91
|
"@biomejs/biome": "2.5.2",
|
|
71
|
-
"@types/node": "
|
|
92
|
+
"@types/node": "26.1.0",
|
|
72
93
|
"@types/nunjucks": "3.2.6",
|
|
73
|
-
"@types/rimraf": "latest",
|
|
74
94
|
"@types/svg2ttf": "5.0.3",
|
|
75
95
|
"@types/ttf2eot": "2.0.2",
|
|
76
96
|
"@types/ttf2woff": "2.0.4",
|
|
77
97
|
"@types/wawoff2": "1.0.2",
|
|
78
98
|
"@types/xml2js": "0.4.14",
|
|
79
99
|
"@vitest/coverage-v8": "4.1.9",
|
|
80
|
-
"fast-glob": "3.2.12",
|
|
81
100
|
"is-eot": "latest",
|
|
82
101
|
"is-svg": "6.1.0",
|
|
83
102
|
"is-ttf": "latest",
|
|
@@ -85,7 +104,7 @@
|
|
|
85
104
|
"is-woff2": "latest",
|
|
86
105
|
"knip": "6.24.0",
|
|
87
106
|
"lefthook": "2.1.9",
|
|
88
|
-
"
|
|
107
|
+
"publint": "0.3.21",
|
|
89
108
|
"typescript": "6.0.3",
|
|
90
109
|
"vite": "8.1.3",
|
|
91
110
|
"vite-plugin-checker": "0.14.4",
|
|
@@ -93,7 +112,6 @@
|
|
|
93
112
|
"vitest": "4.1.9"
|
|
94
113
|
},
|
|
95
114
|
"overrides": {
|
|
96
|
-
"fast-glob": "3.2.12",
|
|
97
115
|
"minimatch": "10.2.5",
|
|
98
116
|
"test-exclude": "7.0.2",
|
|
99
117
|
"woff2sfnt-sfnt2woff": "1.0.0"
|
|
@@ -121,7 +139,7 @@
|
|
|
121
139
|
},
|
|
122
140
|
"homepage": "https://github.com/itgalaxy/webfont#readme",
|
|
123
141
|
"engines": {
|
|
124
|
-
"node": ">=
|
|
142
|
+
"node": ">=24.14.0"
|
|
125
143
|
},
|
|
126
144
|
"keywords": [
|
|
127
145
|
"cli",
|