koishi-plugin-to-image-service-font-cascadia-mono 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
package/lib/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Context, Schema, Service } from "koishi";
2
+ declare class ToImageServiceFontCascadiaMono extends Service {
3
+ private _ctx;
4
+ constructor(ctx: Context, config: ToImageServiceFontCascadiaMono.Config);
5
+ protected start(): Promise<void>;
6
+ private initFonts;
7
+ private fontNames;
8
+ }
9
+ declare namespace ToImageServiceFontCascadiaMono {
10
+ const inject: string[];
11
+ const usage = "<a target=\"_blank\" href=\"https://github.com/microsoft/cascadia-code\">cascadia-code</a>";
12
+ interface Config {
13
+ }
14
+ const Config: Schema<Config>;
15
+ }
16
+ export default ToImageServiceFontCascadiaMono;
package/lib/index.js ADDED
@@ -0,0 +1,86 @@
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 = "toImageServiceFontCascadiaMono";
40
+ var ToImageServiceFontCascadiaMono = class extends import_koishi.Service {
41
+ static {
42
+ __name(this, "ToImageServiceFontCascadiaMono");
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
+ for (let j = 0; j < 2; j++) {
57
+ fonts.push({
58
+ name: "Cascadia Mono",
59
+ weight: (i + 2) * 100,
60
+ style: ["normal", "italic"][j],
61
+ data: await import_promises.default.readFile(
62
+ import_node_path.default.join(
63
+ __dirname,
64
+ `../fonts/CascadiaMono-${j === 0 || fontName !== "Regular" ? fontName : ""}${["", "Italic"][j]}.ttf`
65
+ )
66
+ )
67
+ });
68
+ }
69
+ }
70
+ this._ctx.toImageService.addFont(fonts);
71
+ }
72
+ fontNames = [
73
+ "ExtraLight",
74
+ "Light",
75
+ "SemiLight",
76
+ "Regular",
77
+ "SemiBold",
78
+ "Bold"
79
+ ];
80
+ };
81
+ ((ToImageServiceFontCascadiaMono2) => {
82
+ ToImageServiceFontCascadiaMono2.inject = ["toImageService"];
83
+ ToImageServiceFontCascadiaMono2.usage = '<a target="_blank" href="https://github.com/microsoft/cascadia-code">cascadia-code</a>';
84
+ ToImageServiceFontCascadiaMono2.Config = import_koishi.Schema.object({});
85
+ })(ToImageServiceFontCascadiaMono || (ToImageServiceFontCascadiaMono = {}));
86
+ var src_default = ToImageServiceFontCascadiaMono;
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "koishi-plugin-to-image-service-font-cascadia-mono",
3
+ "description": "Provide Cascadia Mono 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-cascadia-mono",
9
+ "pub": "cd ../../ && yarn pub to-image-service-font-cascadia-mono",
10
+ "fastPub": "cd ../../ && yarn bump -3 to-image-service-font-cascadia-mono && yarn build to-image-service-font-cascadia-mono && yarn pub to-image-service-font-cascadia-mono",
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-cascadia-mono",
22
+ "bugs": {
23
+ "url": "https://github.com/pgnqukezrdxmhjso/koishi-plugin-to-image-service-font-cascadia-mono/issues"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/pgnqukezrdxmhjso/koishi-plugin-to-image-service-font-cascadia-mono.git"
28
+ },
29
+ "license": "MIT",
30
+ "keywords": [
31
+ "chatbot",
32
+ "koishi",
33
+ "plugin",
34
+ "to-image-service",
35
+ "font",
36
+ "Cascadia Mono"
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
+ "toImageServiceFontCascadiaMono"
51
+ ]
52
+ }
53
+ }
54
+ }
package/readme.md ADDED
@@ -0,0 +1,11 @@
1
+ # koishi-plugin-to-image-service-font-cascadia-mono
2
+
3
+ [![npm](https://img.shields.io/npm/v/koishi-plugin-to-image-service-font-cascadia-mono?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-to-image-service-font-cascadia-mono)
4
+
5
+ Provide Cascadia Mono fonts for the to-image-service
6
+
7
+ ---
8
+
9
+ [cascadia-code](https://github.com/microsoft/cascadia-code)
10
+
11
+ ![example.png](example.png)