koishi-plugin-to-image-service-font-honor-sans-cn 0.0.2

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/lib/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Context, Schema, Service } from "koishi";
2
+ declare class ToImageServiceFontHonorSansCn extends Service {
3
+ private _ctx;
4
+ constructor(ctx: Context, config: ToImageServiceFontHonorSansCn.Config);
5
+ protected start(): Promise<void>;
6
+ private initFonts;
7
+ private fontNames;
8
+ }
9
+ declare namespace ToImageServiceFontHonorSansCn {
10
+ const inject: string[];
11
+ const usage = "<a target=\"_blank\" href=\"https://developer.honor.com/cn/doc/guides/100681\">HONOR Sans CN</a>";
12
+ interface Config {
13
+ }
14
+ const Config: Schema<Config>;
15
+ }
16
+ export default ToImageServiceFontHonorSansCn;
package/lib/index.js ADDED
@@ -0,0 +1,84 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ default: () => src_default
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+ var import_koishi = require("koishi");
37
+ var import_promises = __toESM(require("node:fs/promises"));
38
+ var import_node_path = __toESM(require("node:path"));
39
+ var serviceName = "toImageServiceFontHonorSansCn";
40
+ var ToImageServiceFontHonorSansCn = class extends import_koishi.Service {
41
+ static {
42
+ __name(this, "ToImageServiceFontHonorSansCn");
43
+ }
44
+ _ctx;
45
+ constructor(ctx, config) {
46
+ super(ctx, serviceName);
47
+ this._ctx = ctx;
48
+ }
49
+ async start() {
50
+ await this.initFonts();
51
+ }
52
+ async initFonts() {
53
+ const fonts = [];
54
+ for (let i = 0; i < this.fontNames.length; i++) {
55
+ const fontName = this.fontNames[i];
56
+ fonts.push({
57
+ name: "HONOR Sans CN",
58
+ weight: (i + 1) * 100,
59
+ style: "normal",
60
+ data: await import_promises.default.readFile(
61
+ import_node_path.default.join(__dirname, `../fonts/HONORSansCN-${fontName}.ttf`)
62
+ )
63
+ });
64
+ }
65
+ this._ctx.toImageService.addFont(fonts);
66
+ }
67
+ fontNames = [
68
+ "Thin",
69
+ "ExtraLight",
70
+ "Light",
71
+ "Regular",
72
+ "Medium",
73
+ "DemiBold",
74
+ "Bold",
75
+ "ExtraBold",
76
+ "Heavy"
77
+ ];
78
+ };
79
+ ((ToImageServiceFontHonorSansCn2) => {
80
+ ToImageServiceFontHonorSansCn2.inject = ["toImageService"];
81
+ ToImageServiceFontHonorSansCn2.usage = '<a target="_blank" href="https://developer.honor.com/cn/doc/guides/100681">HONOR Sans CN</a>';
82
+ ToImageServiceFontHonorSansCn2.Config = import_koishi.Schema.object({});
83
+ })(ToImageServiceFontHonorSansCn || (ToImageServiceFontHonorSansCn = {}));
84
+ var src_default = ToImageServiceFontHonorSansCn;
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "koishi-plugin-to-image-service-font-honor-sans-cn",
3
+ "description": "Provide HONOR Sans CN fonts for the to-image-service",
4
+ "version": "0.0.2",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "scripts": {
8
+ "build": "cd ../../ && yarn build to-image-service-font-honor-sans-cn",
9
+ "pub": "cd ../../ && yarn pub to-image-service-font-honor-sans-cn",
10
+ "fastPub": "cd ../../ && yarn bump -3 to-image-service-font-honor-sans-cn && yarn build to-image-service-font-honor-sans-cn && yarn pub to-image-service-font-honor-sans-cn",
11
+ "test": "node ./test/test.js"
12
+ },
13
+ "files": [
14
+ "lib",
15
+ "dist",
16
+ "fonts"
17
+ ],
18
+ "contributors": [
19
+ "pgnqukezrdxmhjso"
20
+ ],
21
+ "homepage": "https://github.com/pgnqukezrdxmhjso/koishi-plugin-to-image-service-font-honor-sans-cn",
22
+ "bugs": {
23
+ "url": "https://github.com/pgnqukezrdxmhjso/koishi-plugin-to-image-service-font-honor-sans-cn/issues"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/pgnqukezrdxmhjso/koishi-plugin-to-image-service-font-honor-sans-cn.git"
28
+ },
29
+ "license": "MIT",
30
+ "keywords": [
31
+ "chatbot",
32
+ "koishi",
33
+ "plugin",
34
+ "to-image-service",
35
+ "font",
36
+ "HONOR Sans CN"
37
+ ],
38
+ "peerDependencies": {
39
+ "koishi": "^4.18.5"
40
+ },
41
+ "devDependencies": {
42
+ "koishi-plugin-to-image-service": "^0.0.1"
43
+ },
44
+ "koishi": {
45
+ "service": {
46
+ "required": [
47
+ "toImageService"
48
+ ],
49
+ "implements": [
50
+ "toImageServiceFontHonorSansCn"
51
+ ]
52
+ }
53
+ }
54
+ }
package/readme.md ADDED
@@ -0,0 +1,11 @@
1
+ # koishi-plugin-to-image-service-font-honor-sans-cn
2
+
3
+ [![npm](https://img.shields.io/npm/v/koishi-plugin-to-image-service-font-honor-sans-cn?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-to-image-service-font-honor-sans-cn)
4
+
5
+ Provide HONOR Sans CN fonts for the to-image-service
6
+
7
+ ---
8
+
9
+ [HONOR Sans CN](https://developer.honor.com/cn/doc/guides/100681)
10
+
11
+ ![example.png](example.png)