@nanawan/webfont 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -122,13 +122,13 @@ var getOptions = (initialOptions) => {
122
122
  // src/index.ts
123
123
  var import_stream = require("stream");
124
124
  var import_shared = require("@nanawan/shared");
125
- var import_svgicons2svgfont = __toESM(require("svgicons2svgfont"), 1);
125
+ var import_svgicons2svgfont = require("svgicons2svgfont");
126
126
  var import_globby = __toESM(require("globby"), 1);
127
127
  var import_svg2ttf = __toESM(require("svg2ttf"), 1);
128
128
  var toSvg = (glyphsData, options) => {
129
129
  let result = "";
130
130
  return new Promise((resolve, reject) => {
131
- const fontStream = new import_svgicons2svgfont.default({
131
+ const fontStream = new import_svgicons2svgfont.SVGIcons2SVGFontStream({
132
132
  ascent: options.ascent,
133
133
  centerHorizontally: options.centerHorizontally,
134
134
  descent: options.descent,
@@ -138,8 +138,6 @@ var toSvg = (glyphsData, options) => {
138
138
  fontName: options.fontName,
139
139
  fontStyle: options.fontStyle,
140
140
  fontWeight: options.fontWeight,
141
- log: () => {
142
- },
143
141
  metadata: options.metadata,
144
142
  normalize: options.normalize,
145
143
  round: options.round
@@ -0,0 +1,61 @@
1
+ type Format = 'svg' | 'ttf';
2
+ type Formats = Array<Format>;
3
+ type FormatOption = {
4
+ copyright: null;
5
+ ts: null;
6
+ version: null;
7
+ };
8
+ type FormatsOptions = Partial<Record<Format, FormatOption>>;
9
+ type Result = {
10
+ config?: OptionsBase;
11
+ glyphsData?: Array<GlyphData>;
12
+ svg?: string | Buffer;
13
+ ttf?: Buffer;
14
+ };
15
+ type GlyphData = {
16
+ contents: string;
17
+ metadata?: GlyphMetadata;
18
+ srcPath: string;
19
+ };
20
+ type GlyphTransformFn = (obj: GlyphMetadata) => GlyphMetadata | Promise<GlyphMetadata>;
21
+ type GlyphMetadata = {
22
+ name: string;
23
+ unicode?: string[];
24
+ };
25
+ type OptionsBase = {
26
+ configFile?: string;
27
+ dest?: string;
28
+ destCreate?: boolean;
29
+ fontName?: string | unknown;
30
+ formats?: Formats;
31
+ fontId?: string | unknown;
32
+ fontStyle?: string | unknown;
33
+ fontWeight?: string | unknown;
34
+ fixedWidth?: string | unknown;
35
+ centerHorizontally?: boolean | unknown;
36
+ normalize?: boolean;
37
+ fontHeight?: string | unknown;
38
+ round?: string | number;
39
+ descent?: string | number;
40
+ ascent?: string;
41
+ startUnicode?: string | unknown;
42
+ prependUnicode?: boolean | unknown;
43
+ metadata?: unknown;
44
+ ligatures?: boolean;
45
+ addHashInFontUrl?: boolean | unknown;
46
+ };
47
+ type InitialOptions = OptionsBase & {
48
+ filePath?: string;
49
+ files: string | Array<string>;
50
+ glyphTransformFn?: GlyphTransformFn;
51
+ };
52
+ interface WebfontOptions extends InitialOptions {
53
+ formatsOptions: FormatsOptions;
54
+ maxConcurrency: number;
55
+ metadataProvider: null;
56
+ }
57
+
58
+ type Webfont = (initialOptions?: InitialOptions) => Promise<Result>;
59
+ declare const webfont: Webfont;
60
+
61
+ export { type Format, type FormatOption, type Formats, type FormatsOptions, type GlyphData, type GlyphMetadata, type GlyphTransformFn, type InitialOptions, type OptionsBase, type Result, type WebfontOptions, webfont };
@@ -0,0 +1,61 @@
1
+ type Format = 'svg' | 'ttf';
2
+ type Formats = Array<Format>;
3
+ type FormatOption = {
4
+ copyright: null;
5
+ ts: null;
6
+ version: null;
7
+ };
8
+ type FormatsOptions = Partial<Record<Format, FormatOption>>;
9
+ type Result = {
10
+ config?: OptionsBase;
11
+ glyphsData?: Array<GlyphData>;
12
+ svg?: string | Buffer;
13
+ ttf?: Buffer;
14
+ };
15
+ type GlyphData = {
16
+ contents: string;
17
+ metadata?: GlyphMetadata;
18
+ srcPath: string;
19
+ };
20
+ type GlyphTransformFn = (obj: GlyphMetadata) => GlyphMetadata | Promise<GlyphMetadata>;
21
+ type GlyphMetadata = {
22
+ name: string;
23
+ unicode?: string[];
24
+ };
25
+ type OptionsBase = {
26
+ configFile?: string;
27
+ dest?: string;
28
+ destCreate?: boolean;
29
+ fontName?: string | unknown;
30
+ formats?: Formats;
31
+ fontId?: string | unknown;
32
+ fontStyle?: string | unknown;
33
+ fontWeight?: string | unknown;
34
+ fixedWidth?: string | unknown;
35
+ centerHorizontally?: boolean | unknown;
36
+ normalize?: boolean;
37
+ fontHeight?: string | unknown;
38
+ round?: string | number;
39
+ descent?: string | number;
40
+ ascent?: string;
41
+ startUnicode?: string | unknown;
42
+ prependUnicode?: boolean | unknown;
43
+ metadata?: unknown;
44
+ ligatures?: boolean;
45
+ addHashInFontUrl?: boolean | unknown;
46
+ };
47
+ type InitialOptions = OptionsBase & {
48
+ filePath?: string;
49
+ files: string | Array<string>;
50
+ glyphTransformFn?: GlyphTransformFn;
51
+ };
52
+ interface WebfontOptions extends InitialOptions {
53
+ formatsOptions: FormatsOptions;
54
+ maxConcurrency: number;
55
+ metadataProvider: null;
56
+ }
57
+
58
+ type Webfont = (initialOptions?: InitialOptions) => Promise<Result>;
59
+ declare const webfont: Webfont;
60
+
61
+ export { type Format, type FormatOption, type Formats, type FormatsOptions, type GlyphData, type GlyphMetadata, type GlyphTransformFn, type InitialOptions, type OptionsBase, type Result, type WebfontOptions, webfont };
package/dist/index.js CHANGED
@@ -86,7 +86,7 @@ var getOptions = (initialOptions) => {
86
86
  // src/index.ts
87
87
  import { Readable } from "stream";
88
88
  import { isFunction, normalizeToArray } from "@nanawan/shared";
89
- import SVGIcons2SVGFontStream from "svgicons2svgfont";
89
+ import { SVGIcons2SVGFontStream } from "svgicons2svgfont";
90
90
  import globby from "globby";
91
91
  import svg2ttf from "svg2ttf";
92
92
  var toSvg = (glyphsData, options) => {
@@ -102,8 +102,6 @@ var toSvg = (glyphsData, options) => {
102
102
  fontName: options.fontName,
103
103
  fontStyle: options.fontStyle,
104
104
  fontWeight: options.fontWeight,
105
- log: () => {
106
- },
107
105
  metadata: options.metadata,
108
106
  normalize: options.normalize,
109
107
  round: options.round
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanawan/webfont",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Generator of fonts from svg icons, svg icons to svg font, svg font to ttf, ttf to eot, ttf to woff, ttf to woff2",
5
5
  "type": "module",
6
6
  "files": [
@@ -27,14 +27,14 @@
27
27
  "fs-extra": "^11.2.0",
28
28
  "globby": "^11.0.0",
29
29
  "p-limit": "^3.1.0",
30
- "svg2ttf": "^6.0.2",
31
- "svgicons2svgfont": "^10.0.3",
30
+ "svg2ttf": "^6.1.0",
31
+ "svgicons2svgfont": "^16.0.0",
32
32
  "xml2js": "^0.4.23"
33
33
  },
34
34
  "devDependencies": {
35
+ "@nanawan/release": "^2.2.8",
35
36
  "@types/fs-extra": "11.0.4",
36
37
  "@types/node": "15.14.9",
37
- "@nanawan/release": "^2.2.8",
38
38
  "rimraf": "5.0.7",
39
39
  "tsup": "^8.0.1",
40
40
  "typescript": "^5.2.2"