@first-ch/tools-mcp 0.34.1 → 0.37.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/README.md +134 -20
- package/apps.mjs +538 -0
- package/base64.mjs +3 -2
- package/case-convert.mjs +3 -2
- package/css-layout.mjs +612 -0
- package/csv-json.mjs +3 -2
- package/dpi.mjs +660 -0
- package/faq-jsonld.mjs +401 -0
- package/fs-safe.mjs +35 -0
- package/html-escape.mjs +3 -2
- package/html-md.mjs +3 -2
- package/htpasswd.mjs +740 -0
- package/json-yaml.mjs +3 -2
- package/lib.mjs +3 -1
- package/lines.mjs +423 -0
- package/markdown-table.mjs +3 -2
- package/marp.mjs +73 -21
- package/openapi-doc.mjs +2954 -0
- package/package.json +68 -6
- package/px-rem.mjs +3 -2
- package/qr.mjs +3 -3
- package/robots-txt.mjs +2 -2
- package/serp.mjs +309 -0
- package/server.mjs +423 -50
- package/sql-format.mjs +3 -2
- package/webp.mjs +4 -3
- package/zenkaku.mjs +3 -2
package/sql-format.mjs
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// 「整形コア」ブロックは site 側の site/sql-format/app.js と同一の実装。
|
|
4
4
|
// 2箇所ルール: 片方を直したらもう片方も同じ内容で直す(site側が正本)。
|
|
5
5
|
// 使っているのは String/RegExp/Array/Set だけなので、ブラウザ版のコードをそのまま持ってこられる。
|
|
6
|
-
import { readFile
|
|
6
|
+
import { readFile } from 'node:fs/promises';
|
|
7
|
+
import { writeOutput } from './fs-safe.mjs';
|
|
7
8
|
import { basename } from 'node:path';
|
|
8
9
|
|
|
9
10
|
/* ==================== ここから整形コア(site / MCP で同一) ==================== */
|
|
@@ -685,7 +686,7 @@ export async function sqlFormatTool(opts = {}) {
|
|
|
685
686
|
notes: r.notes.map((n) => ({ code: n.code, message: noteMessage(n) })),
|
|
686
687
|
};
|
|
687
688
|
if (opts.outputPath) {
|
|
688
|
-
await
|
|
689
|
+
await writeOutput(opts.outputPath, r.text, { overwrite: opts.overwrite });
|
|
689
690
|
result.output = opts.outputPath;
|
|
690
691
|
// ファイルに書けたなら本文は重複した重い情報でしかない
|
|
691
692
|
delete result.text;
|
package/webp.mjs
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// =ブラウザ版と同一品質・同一アルゴリズム。
|
|
5
5
|
// PNG/JPEG のデコードのみ Node に Canvas がないため pure-JS の pngjs / jpeg-js で行う。
|
|
6
6
|
|
|
7
|
-
import { readFile
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
8
|
+
import { writeOutput } from './fs-safe.mjs';
|
|
8
9
|
import path from 'node:path';
|
|
9
10
|
import { PNG } from 'pngjs';
|
|
10
11
|
import jpeg from 'jpeg-js';
|
|
@@ -42,7 +43,7 @@ function decodeImage(buf, file) {
|
|
|
42
43
|
/**
|
|
43
44
|
* 1ファイルをWebPへ変換する。
|
|
44
45
|
* @param {string} input 入力ファイルの絶対パス(PNG/JPEG)
|
|
45
|
-
* @param {object} opts { output?: 出力パス(既定=入力の拡張子を.webpに), quality?: 1-100(既定80
|
|
46
|
+
* @param {object} opts { output?: 出力パス(既定=入力の拡張子を.webpに), quality?: 1-100(既定80・サイト版と同じ), overwrite?: 既存ファイルを上書きするか(既定 false) }
|
|
46
47
|
* @returns {Promise<object>} { input, output, width, height, bytesIn, bytesOut, saving }
|
|
47
48
|
*/
|
|
48
49
|
export async function convertToWebp(input, opts = {}) {
|
|
@@ -54,7 +55,7 @@ export async function convertToWebp(input, opts = {}) {
|
|
|
54
55
|
const result = encoder.encode(image.data, image.width, image.height, { ...defaultOptions, quality });
|
|
55
56
|
if (!result) throw new Error(`${path.basename(input)}: エンコードに失敗しました`);
|
|
56
57
|
const webp = result.buffer;
|
|
57
|
-
await
|
|
58
|
+
await writeOutput(output, Buffer.from(webp), { overwrite: opts.overwrite === true });
|
|
58
59
|
const bytesOut = webp.byteLength;
|
|
59
60
|
return {
|
|
60
61
|
input,
|
package/zenkaku.mjs
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// 「変換コア」ブロックは site 側の site/zenkaku/app.js と同一の実装。
|
|
4
4
|
// 2箇所ルール: 片方を直したらもう片方も同じ内容で直す(site側が正本)。
|
|
5
5
|
// 使っているのは String/RegExp/Map だけなので、ブラウザ版のコードをそのまま持ってこられる。
|
|
6
|
-
import { readFile
|
|
6
|
+
import { readFile } from 'node:fs/promises';
|
|
7
|
+
import { writeOutput } from './fs-safe.mjs';
|
|
7
8
|
import { basename } from 'node:path';
|
|
8
9
|
|
|
9
10
|
/* ==================== ここから変換コア(site / MCP で同一) ==================== */
|
|
@@ -445,7 +446,7 @@ export async function zenkakuConvertTool(opts = {}) {
|
|
|
445
446
|
const i = notes.findIndex((n) => n.code === 'UNCHANGED');
|
|
446
447
|
if (i !== -1) notes.splice(i, 1);
|
|
447
448
|
} else if (opts.outputPath) {
|
|
448
|
-
await
|
|
449
|
+
await writeOutput(opts.outputPath, r.text, { overwrite: opts.overwrite });
|
|
449
450
|
result.output = opts.outputPath;
|
|
450
451
|
} else if ([...r.text].length > MAX_TEXT) {
|
|
451
452
|
result.text = [...r.text].slice(0, MAX_TEXT).join('');
|