webfont 11.2.20 → 12.0.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/NOTICE.md +153 -0
- package/README.md +135 -28
- package/dist/cli.mjs +628 -0
- package/dist/index.js +1 -5022
- package/dist/src/index.d.ts +2 -2
- package/dist/src/lib/execCLI/index.d.ts +3 -4
- package/dist/src/lib/inputSource.d.ts +5 -0
- package/dist/src/lib/p-limit/index.d.ts +2 -0
- package/dist/src/lib/sfnt/flavor.d.ts +2 -0
- package/dist/src/lib/svgicons2svgfont/index.d.ts +9 -0
- package/dist/src/lib/ttf2eot/index.d.ts +2 -0
- package/dist/src/standalone/convertWebfontInput.d.ts +3 -0
- package/dist/src/standalone/fetchWebfontUrl.d.ts +1 -0
- package/dist/src/standalone/glyphsData.d.ts +2 -2
- package/dist/src/standalone/index.d.ts +3 -3
- package/dist/src/standalone/inputMode.d.ts +7 -0
- package/dist/src/standalone/options.d.ts +3 -3
- package/dist/src/standalone/templateFonts.d.ts +3 -0
- package/dist/src/standalone/toTtf.d.ts +4 -0
- package/dist/src/types/DecompressedFont.d.ts +5 -0
- package/dist/src/types/Format.d.ts +4 -4
- package/dist/src/types/GlyphData.d.ts +2 -2
- package/dist/src/types/GlyphMetadata.d.ts +1 -1
- package/dist/src/types/GlyphTransformFn.d.ts +2 -2
- package/dist/src/types/InitialOptions.d.ts +5 -4
- package/dist/src/types/MetadataProvider.d.ts +5 -0
- package/dist/src/types/OptionsBase.d.ts +3 -2
- package/dist/src/types/Result.d.ts +8 -5
- package/dist/src/types/ResultConfig.d.ts +4 -0
- package/dist/src/types/WebfontOptions.d.ts +29 -3
- package/dist/src/types/index.d.ts +7 -6
- package/package.json +52 -57
- package/dist/cli.js +0 -5314
- package/dist/jest.config.d.ts +0 -3
- package/dist/src/cli/index.d.ts +0 -1
- package/dist/src/cli/index.test.d.ts +0 -1
- package/dist/src/cli/meow/index.d.ts +0 -104
- package/dist/src/index.test.d.ts +0 -1
- package/dist/src/standalone/index.test.d.ts +0 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { webfont } from
|
|
2
|
-
export { webfont } from
|
|
1
|
+
import { webfont } from './standalone';
|
|
2
|
+
export { webfont } from './standalone';
|
|
3
3
|
export default webfont;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare type Output = {
|
|
1
|
+
import { ExecException } from 'child_process';
|
|
2
|
+
export type Output = {
|
|
4
3
|
code?: number;
|
|
5
4
|
error: ExecException | null;
|
|
6
5
|
files: string[];
|
|
7
6
|
stderr?: string;
|
|
8
7
|
stdout?: string;
|
|
9
8
|
};
|
|
10
|
-
export
|
|
9
|
+
export type ExecCLI = (_args?: string, _destination?: string) => Promise<Output>;
|
|
11
10
|
/**
|
|
12
11
|
* @name execCLI
|
|
13
12
|
* @description Execute webfont CLI commands using child_process.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const isHttpUrl: (value: string) => boolean;
|
|
2
|
+
export declare const getInputExtension: (source: string) => string;
|
|
3
|
+
export declare const resolveInputSources: (patterns: readonly string[]) => Promise<string[]>;
|
|
4
|
+
export declare const getWebfontSourceBasename: (source: string) => string;
|
|
5
|
+
export declare const resolveDecompressedFontBasenames: (sources: readonly string[]) => string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SVGIcons2SVGFontStreamOptions, fileSorter, getMetadataService, SVGIcons2SVGFontStream } from 'svgicons2svgfont';
|
|
2
|
+
import { WebfontOptions } from '../../types';
|
|
3
|
+
export { fileSorter, getMetadataService, SVGIcons2SVGFontStream };
|
|
4
|
+
type MetadataServiceOptions = {
|
|
5
|
+
prependUnicode: boolean;
|
|
6
|
+
startUnicode: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const getMetadataServiceOptions: (options: WebfontOptions) => MetadataServiceOptions;
|
|
9
|
+
export declare const getFontStreamOptions: (options: WebfontOptions) => Partial<SVGIcons2SVGFontStreamOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchWebfontFromUrl: (url: string) => Promise<Buffer>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { GlyphData, WebfontOptions } from '../types';
|
|
2
|
+
type GlyphsDataGetter = (_files: Array<GlyphData["srcPath"]>, _options: WebfontOptions) => unknown;
|
|
3
3
|
export declare const getGlyphsData: GlyphsDataGetter;
|
|
4
4
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { InitialOptions } from '../types';
|
|
2
|
+
import { Result } from '../types/Result';
|
|
3
|
+
type Webfont = (_initialOptions?: InitialOptions) => Promise<Result>;
|
|
4
4
|
export declare const webfont: Webfont;
|
|
5
5
|
export default webfont;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Format } from '../types/Format';
|
|
2
|
+
export type InputMode = "empty" | "mixed" | "svg" | "webfont";
|
|
3
|
+
export declare const classifyInputFiles: (filePaths: readonly string[]) => InputMode;
|
|
4
|
+
export declare const assertSvgPipelineFormats: (formats: readonly Format[]) => void;
|
|
5
|
+
export declare const filterInputFilesByMode: (filePaths: readonly string[], mode: InputMode) => string[];
|
|
6
|
+
export type ConversionFormat = "otf" | "ttf";
|
|
7
|
+
export declare const resolveWebfontConversionFormats: (formats: readonly Format[]) => ConversionFormat[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { WebfontOptions } from
|
|
3
|
-
|
|
1
|
+
import { InitialOptions } from '../types/InitialOptions';
|
|
2
|
+
import { WebfontOptions } from '../types/WebfontOptions';
|
|
3
|
+
type OptionsGetter = (_initialOptions?: InitialOptions) => WebfontOptions;
|
|
4
4
|
export declare const getOptions: OptionsGetter;
|
|
5
5
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
export type Format = "eot" | "otf" | "woff" | "woff2" | "svg" | "ttf";
|
|
2
|
+
export type Formats = Array<Format>;
|
|
3
|
+
type FormatOption = {
|
|
4
4
|
copyright: null;
|
|
5
5
|
ts: null;
|
|
6
6
|
version: null;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type FormatsOptions = Partial<Record<Format, FormatOption>>;
|
|
9
9
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { GlyphMetadata } from
|
|
2
|
-
export
|
|
1
|
+
import { GlyphMetadata } from './GlyphMetadata';
|
|
2
|
+
export type GlyphTransformFn = (_obj: GlyphMetadata) => GlyphMetadata | Promise<GlyphMetadata>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { GlyphTransformFn } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { GlyphTransformFn } from './GlyphTransformFn';
|
|
2
|
+
import { MetadataProvider } from './MetadataProvider';
|
|
3
|
+
import { OptionsBase } from './OptionsBase';
|
|
4
|
+
export type InitialOptions = OptionsBase & {
|
|
5
5
|
files: string | Array<string>;
|
|
6
6
|
glyphTransformFn?: GlyphTransformFn;
|
|
7
|
+
metadataProvider?: MetadataProvider;
|
|
7
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Formats } from
|
|
2
|
-
export
|
|
1
|
+
import { Formats } from './Format';
|
|
2
|
+
export type OptionsBase = {
|
|
3
3
|
configFile?: string;
|
|
4
4
|
dest?: string;
|
|
5
5
|
destCreate?: boolean;
|
|
@@ -26,5 +26,6 @@ export declare type OptionsBase = {
|
|
|
26
26
|
prependUnicode?: boolean | unknown;
|
|
27
27
|
metadata?: unknown;
|
|
28
28
|
sort?: boolean;
|
|
29
|
+
ligatures?: boolean;
|
|
29
30
|
addHashInFontUrl?: boolean | unknown;
|
|
30
31
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { GlyphData } from
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
|
|
1
|
+
import { DecompressedFont } from './DecompressedFont';
|
|
2
|
+
import { GlyphData } from './GlyphData';
|
|
3
|
+
import { ResultConfig } from './ResultConfig';
|
|
4
|
+
export type { DecompressedFont } from './DecompressedFont';
|
|
5
|
+
export type Result = {
|
|
6
|
+
config?: ResultConfig;
|
|
7
|
+
decompressedFonts?: DecompressedFont[];
|
|
6
8
|
eot?: Buffer;
|
|
7
9
|
glyphsData?: Array<GlyphData>;
|
|
8
10
|
hash?: string;
|
|
11
|
+
otf?: Buffer;
|
|
9
12
|
svg?: string | Buffer;
|
|
10
13
|
template?: string;
|
|
11
14
|
ttf?: Buffer;
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Formats, FormatsOptions } from './Format';
|
|
2
|
+
import { GlyphTransformFn } from './GlyphTransformFn';
|
|
3
|
+
import { InitialOptions } from './InitialOptions';
|
|
4
|
+
import { MetadataProvider } from './MetadataProvider';
|
|
3
5
|
export interface WebfontOptions extends InitialOptions {
|
|
6
|
+
centerHorizontally: boolean;
|
|
7
|
+
descent: number;
|
|
8
|
+
fixedWidth: boolean;
|
|
9
|
+
fontHeight: unknown;
|
|
10
|
+
fontId: unknown;
|
|
11
|
+
fontName: string;
|
|
12
|
+
fontStyle: string;
|
|
13
|
+
fontWeight: string;
|
|
14
|
+
formats: Formats;
|
|
4
15
|
formatsOptions: FormatsOptions;
|
|
16
|
+
glyphTransformFn?: GlyphTransformFn;
|
|
17
|
+
ligatures: boolean;
|
|
5
18
|
maxConcurrency: number;
|
|
6
|
-
|
|
19
|
+
metadata: unknown;
|
|
20
|
+
metadataProvider?: MetadataProvider;
|
|
21
|
+
normalize: boolean;
|
|
22
|
+
prependUnicode: boolean;
|
|
23
|
+
round: number;
|
|
24
|
+
sort: boolean;
|
|
25
|
+
startUnicode: number;
|
|
26
|
+
template?: string;
|
|
27
|
+
templateCacheString?: unknown;
|
|
28
|
+
templateClassName?: unknown;
|
|
29
|
+
templateFontName?: unknown;
|
|
30
|
+
templateFontPath: string;
|
|
31
|
+
verbose: boolean;
|
|
32
|
+
addHashInFontUrl?: boolean;
|
|
7
33
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export type { Format } from
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
5
|
-
export type { InitialOptions } from
|
|
6
|
-
export type {
|
|
1
|
+
export type { Format } from '../types/Format';
|
|
2
|
+
export type { GlyphData } from './GlyphData';
|
|
3
|
+
export type { GlyphMetadata } from './GlyphMetadata';
|
|
4
|
+
export type { GlyphTransformFn } from './GlyphTransformFn';
|
|
5
|
+
export type { InitialOptions } from './InitialOptions';
|
|
6
|
+
export type { MetadataProvider } from './MetadataProvider';
|
|
7
|
+
export type { WebfontOptions } from './WebfontOptions';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webfont",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Generator of fonts from
|
|
3
|
+
"version": "12.0.0",
|
|
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",
|
|
7
7
|
"source": "src"
|
|
@@ -12,83 +12,78 @@
|
|
|
12
12
|
"templates",
|
|
13
13
|
"!**/__tests__",
|
|
14
14
|
"!**/__mocks__",
|
|
15
|
-
"README.md"
|
|
15
|
+
"README.md",
|
|
16
|
+
"NOTICE.md"
|
|
16
17
|
],
|
|
17
18
|
"main": "dist/index.js",
|
|
18
|
-
"bin": "dist/cli.
|
|
19
|
+
"bin": "dist/cli.mjs",
|
|
19
20
|
"source": "src/index.ts",
|
|
20
21
|
"types": "dist/src/index.d.ts",
|
|
21
22
|
"typings": "dist/src/index.d.ts",
|
|
22
23
|
"scripts": {
|
|
23
|
-
"build": "
|
|
24
|
+
"build": "vite build --mode library && vite build --mode cli",
|
|
24
25
|
"clean": "rm -rf dist/ temp/",
|
|
25
|
-
"demo": "node dist/cli.
|
|
26
|
-
"lint": "
|
|
27
|
-
"
|
|
26
|
+
"demo": "node dist/cli.mjs './src/fixtures/svg-icons/*.svg' -d demo -t html --normalize --center-horizontally",
|
|
27
|
+
"lint": "biome check .",
|
|
28
|
+
"depcheck": "knip",
|
|
28
29
|
"prebuild": "npm run clean && npm run lint",
|
|
30
|
+
"prepare": "lefthook install",
|
|
29
31
|
"predemo": "npm run build",
|
|
30
32
|
"prepublishOnly": "npm run build",
|
|
31
|
-
"prerelease": "npm run test",
|
|
32
33
|
"pretest": "npm run build",
|
|
33
|
-
"prettify": "
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"test": "jest src",
|
|
39
|
-
"testc": "npm test -- --coverage",
|
|
40
|
-
"test-debug": "npm test --detectOpenHandles --runInBand",
|
|
41
|
-
"testu": "npm test -- -u"
|
|
34
|
+
"prettify": "biome check --write .",
|
|
35
|
+
"test": "vitest run src",
|
|
36
|
+
"testc": "vitest run src --coverage",
|
|
37
|
+
"test-debug": "vitest run src --no-file-parallelism",
|
|
38
|
+
"testu": "vitest run src -u"
|
|
42
39
|
},
|
|
43
40
|
"dependencies": {
|
|
41
|
+
"cosmiconfig": "9.0.2",
|
|
44
42
|
"deepmerge": "^4.2.2",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
43
|
+
"fontverter": "2.0.0",
|
|
44
|
+
"globby": "16.2.0",
|
|
45
|
+
"meow": "14.1.0",
|
|
46
|
+
"nunjucks": "3.2.4",
|
|
47
|
+
"p-limit": "7.3.0",
|
|
50
48
|
"resolve-from": "^5.0.0",
|
|
51
|
-
"svg2ttf": "^6.0
|
|
52
|
-
"svgicons2svgfont": "^
|
|
53
|
-
"ttf2eot": "
|
|
54
|
-
"ttf2woff": "^
|
|
55
|
-
"wawoff2": "
|
|
56
|
-
"xml2js": "
|
|
49
|
+
"svg2ttf": "^6.1.0",
|
|
50
|
+
"svgicons2svgfont": "^16.0.0",
|
|
51
|
+
"ttf2eot": "3.1.0",
|
|
52
|
+
"ttf2woff": "^3.0.0",
|
|
53
|
+
"wawoff2": "2.0.0",
|
|
54
|
+
"xml2js": "0.6.2"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@rollup/plugin-commonjs": "latest",
|
|
63
|
-
"@rollup/plugin-typescript": "latest",
|
|
64
|
-
"@types/jest": "latest",
|
|
65
|
-
"@types/node": "latest",
|
|
66
|
-
"@types/nunjucks": "latest",
|
|
57
|
+
"@biomejs/biome": "2.5.2",
|
|
58
|
+
"@types/node": "^22.15.0",
|
|
59
|
+
"@types/nunjucks": "3.2.6",
|
|
67
60
|
"@types/rimraf": "latest",
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"eslint-plugin-node": "latest",
|
|
76
|
-
"eslint-plugin-promise": "latest",
|
|
77
|
-
"eslint-plugin-unicorn": "latest",
|
|
78
|
-
"husky": "latest",
|
|
61
|
+
"@types/svg2ttf": "5.0.3",
|
|
62
|
+
"@types/ttf2eot": "2.0.2",
|
|
63
|
+
"@types/ttf2woff": "2.0.4",
|
|
64
|
+
"@types/wawoff2": "1.0.2",
|
|
65
|
+
"@types/xml2js": "0.4.14",
|
|
66
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
67
|
+
"fast-glob": "3.2.12",
|
|
79
68
|
"is-eot": "latest",
|
|
80
|
-
"is-svg": "
|
|
69
|
+
"is-svg": "6.1.0",
|
|
81
70
|
"is-ttf": "latest",
|
|
82
71
|
"is-woff": "latest",
|
|
83
72
|
"is-woff2": "latest",
|
|
84
|
-
"
|
|
85
|
-
"
|
|
73
|
+
"knip": "6.24.0",
|
|
74
|
+
"lefthook": "2.1.9",
|
|
86
75
|
"rimraf": "latest",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
76
|
+
"typescript": "6.0.3",
|
|
77
|
+
"vite": "8.1.3",
|
|
78
|
+
"vite-plugin-checker": "0.14.4",
|
|
79
|
+
"vite-plugin-dts": "5.0.3",
|
|
80
|
+
"vitest": "4.1.9"
|
|
81
|
+
},
|
|
82
|
+
"overrides": {
|
|
83
|
+
"fast-glob": "3.2.12",
|
|
84
|
+
"minimatch": "10.2.5",
|
|
85
|
+
"test-exclude": "7.0.2",
|
|
86
|
+
"woff2sfnt-sfnt2woff": "1.0.0"
|
|
92
87
|
},
|
|
93
88
|
"repository": {
|
|
94
89
|
"type": "git",
|
|
@@ -113,7 +108,7 @@
|
|
|
113
108
|
},
|
|
114
109
|
"homepage": "https://github.com/itgalaxy/webfont#readme",
|
|
115
110
|
"engines": {
|
|
116
|
-
"node": ">=
|
|
111
|
+
"node": ">= 24.14.0"
|
|
117
112
|
},
|
|
118
113
|
"keywords": [
|
|
119
114
|
"cli",
|