@pecot/visual-mcp 1.1.0 → 1.3.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.
Files changed (145) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/assets/slidev/deck-lint.config.js +2 -2
  3. package/assets/slidev/deck-lint.env.config.js +2 -2
  4. package/assets/slidev/package.json +7 -7
  5. package/assets/slidev/runtime/package.json +11 -11
  6. package/assets/slidev/scripts/eslint/_shared/dist/lib/drawio-geometry.js +10 -10
  7. package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.d.ts +2 -2
  8. package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.js +4 -4
  9. package/assets/slidev/scripts/eslint/_shared/dist/tsconfig.tsbuildinfo +1 -1
  10. package/assets/slidev/scripts/eslint/_shared/lib/drawio-geometry.ts +10 -10
  11. package/assets/slidev/scripts/eslint/_shared/lib/text-measurer.ts +4 -4
  12. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-content-before-frontmatter.js +1 -1
  13. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-marker-cell.js +4 -4
  14. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-page.js +1 -1
  15. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-asset-prefix.js +1 -1
  16. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-filename-prefix.js +1 -1
  17. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-scaled-drawio.js +3 -3
  18. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-triple-hyphen-in-frontmatter.js +3 -3
  19. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-unknown-props.js +3 -3
  20. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/one-slide-per-file.js +1 -1
  21. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-matching-length.js +1 -1
  22. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-slides-entry.js +1 -1
  23. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/validate-clicks.js +7 -7
  24. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/tsconfig.tsbuildinfo +1 -1
  25. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-content-before-frontmatter.ts +1 -1
  26. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-marker-cell.ts +4 -4
  27. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-page.ts +1 -1
  28. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-asset-prefix.ts +1 -1
  29. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-filename-prefix.ts +1 -1
  30. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-scaled-drawio.ts +3 -3
  31. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-triple-hyphen-in-frontmatter.ts +3 -3
  32. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-unknown-props.ts +3 -3
  33. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/one-slide-per-file.ts +1 -1
  34. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-matching-length.ts +1 -1
  35. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-slides-entry.ts +1 -1
  36. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/validate-clicks.ts +7 -7
  37. package/assets/slidev/scripts/eslint/slidev-pages-lint/package.json +1 -1
  38. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/max-chars.js +6 -6
  39. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint-body.js +3 -3
  40. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint.js +2 -2
  41. package/assets/slidev/scripts/eslint/text-constraints/dist/tsconfig.tsbuildinfo +1 -1
  42. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/max-chars.ts +6 -6
  43. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint-body.ts +3 -3
  44. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint.ts +2 -2
  45. package/assets/slidev/scripts/eslint/text-constraints/package.json +1 -1
  46. package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
  47. package/assets/slidev/scripts/eslint/validate-references/dist/lib/schema-validator.js +1 -1
  48. package/assets/slidev/scripts/eslint/validate-references/dist/lib/semantic-validator.js +12 -12
  49. package/assets/slidev/scripts/eslint/validate-references/dist/tsconfig.tsbuildinfo +1 -1
  50. package/assets/slidev/scripts/eslint/validate-references/index.ts +1 -1
  51. package/assets/slidev/scripts/eslint/validate-references/lib/schema-validator.ts +2 -2
  52. package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
  53. package/assets/slidev/scripts/eslint/validate-references/package.json +1 -1
  54. package/cli/dist/cli.js +11 -10
  55. package/cli/dist/commands/chromium/host-dependencies.js +14 -7
  56. package/cli/dist/commands/drawio/export.js +27 -24
  57. package/cli/dist/commands/drawio/theme.js +8 -8
  58. package/cli/dist/commands/drawio/url.js +40 -32
  59. package/cli/dist/commands/evidence-xlsx/create.js +19 -18
  60. package/cli/dist/commands/pptx-ooxml/preview.js +26 -30
  61. package/cli/dist/commands/slidev-project/create.js +27 -26
  62. package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
  63. package/cli/dist/commands/slidev-project/lint.js +29 -27
  64. package/cli/dist/commands/slidev-project/sync.js +35 -34
  65. package/cli/dist/commands/slidev-project/theme.js +19 -18
  66. package/cli/dist/commands/slidev-to-pptx/convert.d.ts +4 -0
  67. package/cli/dist/commands/slidev-to-pptx/convert.js +88 -75
  68. package/cli/dist/diagnostics.d.ts +38 -0
  69. package/cli/dist/diagnostics.js +46 -0
  70. package/cli/dist/domain/_shared/ports.d.ts +0 -1
  71. package/cli/dist/domain/_shared/text-check.js +2 -2
  72. package/cli/dist/domain/drawio/export.js +4 -4
  73. package/cli/dist/domain/drawio/label-text.js +1 -1
  74. package/cli/dist/domain/drawio/url.d.ts +11 -7
  75. package/cli/dist/domain/drawio/url.js +67 -45
  76. package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
  77. package/cli/dist/domain/evidence-xlsx/spec-schema.js +26 -26
  78. package/cli/dist/domain/pptx-ooxml/merge.js +3 -3
  79. package/cli/dist/domain/pptx-ooxml/prerender-replace.d.ts +1 -0
  80. package/cli/dist/domain/pptx-ooxml/prerender-replace.js +3 -3
  81. package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
  82. package/cli/dist/domain/slidev-project/generated-files.js +36 -36
  83. package/cli/dist/domain/slidev-project/initial-pages.js +4 -4
  84. package/cli/dist/domain/slidev-project/lint.js +11 -11
  85. package/cli/dist/domain/slidev-project/sync.js +13 -13
  86. package/cli/dist/domain/slidev-project/warnings.js +4 -4
  87. package/cli/dist/domain/slidev-theme/declaration.js +9 -9
  88. package/cli/dist/domain/slidev-theme/references.js +10 -10
  89. package/cli/dist/domain/slidev-theme/store-layout.js +6 -6
  90. package/cli/dist/domain/slidev-theme/talk-theme.js +13 -13
  91. package/cli/dist/domain/slidev-theme/theme-spec.js +5 -5
  92. package/cli/dist/domain/slidev-to-pptx/errors.js +3 -3
  93. package/cli/dist/infra/_shared/dependency-root.js +4 -4
  94. package/cli/dist/infra/_shared/patch-apply.js +6 -5
  95. package/cli/dist/infra/_shared/runtime-install.d.ts +12 -84
  96. package/cli/dist/infra/_shared/runtime-install.js +74 -108
  97. package/cli/dist/infra/_shared/slidev-bin.js +1 -1
  98. package/cli/dist/infra/drawio/icons.js +3 -3
  99. package/cli/dist/infra/drawio/pdf.js +1 -1
  100. package/cli/dist/infra/drawio/screenshot.js +10 -9
  101. package/cli/dist/infra/evidence-xlsx/workbook-writer.js +2 -2
  102. package/cli/dist/infra/playwright/chromium.js +4 -3
  103. package/cli/dist/infra/playwright/host-dependencies.js +8 -8
  104. package/cli/dist/infra/playwright/launch.js +5 -5
  105. package/cli/dist/infra/pptx-ooxml/soffice.js +2 -2
  106. package/cli/dist/infra/slidev-project/eslint-runner.js +10 -9
  107. package/cli/dist/infra/slidev-project/fs.js +6 -6
  108. package/cli/dist/infra/slidev-theme/store.js +18 -15
  109. package/cli/dist/infra/slidev-to-pptx/cache-store.js +6 -6
  110. package/cli/dist/infra/slidev-to-pptx/console-logger.d.ts +5 -5
  111. package/cli/dist/infra/slidev-to-pptx/console-logger.js +19 -20
  112. package/cli/dist/infra/slidev-to-pptx/dom-converter.d.ts +1 -1
  113. package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
  114. package/cli/dist/infra/slidev-to-pptx/index.js +1 -9
  115. package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +2 -2
  116. package/cli/dist/infra/slidev-to-pptx/pipeline.js +56 -56
  117. package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +14 -14
  118. package/cli/dist/infra/slidev-to-pptx/prerender.js +10 -10
  119. package/cli/dist/infra/slidev-to-pptx/runner.js +1 -0
  120. package/cli/dist/infra/slidev-to-pptx/scanner.js +10 -10
  121. package/cli/dist/infra/slidev-to-pptx/server.d.ts +2 -1
  122. package/cli/dist/infra/slidev-to-pptx/server.js +3 -3
  123. package/cli/dist/infra/slidev-to-pptx/single-pass-worker.js +39 -39
  124. package/cli/dist/infra/slidev-to-pptx/slide-worker.js +3 -3
  125. package/cli/dist/infra/slidev-to-pptx/visibility-helpers.js +8 -8
  126. package/cli/dist/mcp/dev-server-registry.js +10 -9
  127. package/cli/dist/mcp/queue.js +1 -1
  128. package/cli/dist/mcp/result.js +4 -4
  129. package/cli/dist/mcp/serve.js +5 -3
  130. package/cli/dist/mcp/server.js +2 -2
  131. package/cli/dist/mcp/tools/_shared.d.ts +1 -1
  132. package/cli/dist/mcp/tools/_shared.js +47 -38
  133. package/cli/dist/mcp/tools/drawio.js +23 -22
  134. package/cli/dist/mcp/tools/evidence.js +8 -8
  135. package/cli/dist/mcp/tools/setup.js +26 -26
  136. package/cli/dist/mcp/tools/slide-dev.js +20 -20
  137. package/cli/dist/mcp/tools/slide-page.js +39 -37
  138. package/cli/dist/mcp/tools/slide-theme.js +6 -6
  139. package/cli/dist/mcp/tools/slide.js +52 -50
  140. package/cli/dist/mcp/windows-path.js +8 -7
  141. package/cli/dist/node-runtime.d.ts +6 -1
  142. package/cli/dist/node-runtime.js +16 -8
  143. package/npm-shrinkwrap.json +46 -52
  144. package/package.json +6 -6
  145. package/vendor/text-rules/dist/source-hash +1 -1
@@ -21,7 +21,7 @@ export function createIconResolver(iconRoot, options = {}) {
21
21
  return (relativePath, color) => {
22
22
  // 空文字 / `/` 単独は `.svg` 単一ファイル名 (`iconRoot/.svg`) を解決してしまうため早期 reject
23
23
  if (relativePath === '' || relativePath === '/') {
24
- options.warn?.(`空のアイコンパスが指定されました: '${relativePath}'`);
24
+ options.warn?.(`empty icon path: ${relativePath}`);
25
25
  return undefined;
26
26
  }
27
27
  const withExtension = relativePath.endsWith('.svg') ? relativePath : `${relativePath}.svg`;
@@ -29,11 +29,11 @@ export function createIconResolver(iconRoot, options = {}) {
29
29
  const resolved = path.resolve(iconRoot, withExtension);
30
30
  const normalizedRoot = path.resolve(iconRoot);
31
31
  if (resolved !== normalizedRoot && !resolved.startsWith(`${normalizedRoot}${path.sep}`)) {
32
- options.warn?.(`アイコンパスが iconRoot 外に解決されました: ${relativePath}`);
32
+ options.warn?.(`icon path resolves outside iconRoot: ${relativePath}`);
33
33
  return undefined;
34
34
  }
35
35
  if (!existsSync(resolved)) {
36
- options.warn?.(`アイコンが見つかりません: ${resolved}`);
36
+ options.warn?.(`icon not found: ${resolved}`);
37
37
  return undefined;
38
38
  }
39
39
  let svgText = readFileSync(resolved, 'utf8');
@@ -54,7 +54,7 @@ export async function exportPdf(svg, outputPath) {
54
54
  async function withTimeout(promise, milliseconds) {
55
55
  let timer;
56
56
  const timeout = new Promise((_resolve, reject) => {
57
- timer = setTimeout(() => { reject(new Error(`PDF 印刷が ${(milliseconds / 1000).toString()}s 以内に終わりませんでした`)); }, milliseconds);
57
+ timer = setTimeout(() => { reject(new Error(`PDF printing did not finish within ${(milliseconds / 1000).toString()}s`)); }, milliseconds);
58
58
  });
59
59
  try {
60
60
  return await Promise.race([promise, timeout]);
@@ -43,6 +43,7 @@ viewer で `xmlString` を描いて `outputPath` に PNG を書く。
43
43
  fonts は読み込む書体名(テーマの宣言の本文の書体と和文の書体)。総称の書体だけなら Web フォントを読み込まない。
44
44
  */
45
45
  export async function capturePng(xmlString, outputPath, fonts) {
46
+ // interface-env: PECOTV_FORCE_PNG_FAIL PECOTV_FORCE_SVG_FAIL
46
47
  if (process.env[FORCE_FAIL_ENV.xmlpng] === '1') {
47
48
  throw new Error(`forced XMLPNG failure (${FORCE_FAIL_ENV.xmlpng}=1)`);
48
49
  }
@@ -101,7 +102,7 @@ function processViewerElements() {
101
102
  // eslint-disable-next-line no-restricted-syntax -- viewer-static が window に生やす GraphViewer を narrowing
102
103
  const viewer = globalThis.GraphViewer;
103
104
  if (viewer === undefined)
104
- throw new Error('GraphViewer が読み込まれていません');
105
+ throw new Error('GraphViewer is not loaded');
105
106
  viewer.processElements();
106
107
  }
107
108
  async function waitFontsReady() {
@@ -126,8 +127,8 @@ data URI の base64 部分のみを扱う(editor は png / svg いずれも ba
126
127
  */
127
128
  export async function exportViaEmbed(xmlString, options) {
128
129
  const failFlagName = FORCE_FAIL_ENV[options.format];
129
- // eslint-disable-next-line security/detect-object-injection -- key は EmbedExportFormat union で本ファイル内固定
130
- if (process.env[failFlagName] === '1') {
130
+ // interface-env: PECOTV_FORCE_PNG_FAIL PECOTV_FORCE_SVG_FAIL
131
+ if (process.env[failFlagName] === '1') { // eslint-disable-line security/detect-object-injection -- key は EmbedExportFormat union で本ファイル内固定
131
132
  throw new Error(`forced ${options.format.toUpperCase()} failure (${failFlagName}=1)`);
132
133
  }
133
134
  const browser = await launchChromium();
@@ -146,7 +147,7 @@ export async function exportViaEmbed(xmlString, options) {
146
147
  let contentLoadSeconds;
147
148
  let handshakeSeconds;
148
149
  // 完了した段だけ「<動詞> <秒>s」と書く。未完了の段は単位を付けない。
149
- const describeStage = (name, done, seconds) => (seconds === undefined ? `${name} 未完了` : `${name} ${done} ${seconds.toFixed(1)}s`);
150
+ const describeStage = (name, done, seconds) => (seconds === undefined ? `${name} not done` : `${name} ${done} ${seconds.toFixed(1)}s`);
150
151
  // 時間切れは export の応答待ちだけでなく、setContent / evaluate などの各段も打ち切る。
151
152
  // `expired` は reject 専用で、各段と Promise.race で競わせる。
152
153
  // race が各 promise に handler を付けるので、負けた段が後から reject しても unhandled rejection にならない。
@@ -157,11 +158,11 @@ export async function exportViaEmbed(xmlString, options) {
157
158
  void ignoreRejection(expired);
158
159
  const withinDeadline = async (stage) => await Promise.race([stage, expired]);
159
160
  const timer = setTimeout(() => {
160
- const last = progress.at(-1) ?? 'なし';
161
+ const last = progress.at(-1) ?? 'none';
161
162
  expire(new Error(`embed protocol timeout (${(EXPORT_TIMEOUT_MS / 1000).toString()}s)`
162
- + `: 最後に受けたイベント=${last}`
163
- + ` (${describeStage('setContent', '完了', contentLoadSeconds)} / ${describeStage('handshake', '設置', handshakeSeconds)}`
164
- + ` / 受信 ${progress.join(' → ') || 'なし'})`));
163
+ + `; last event: ${last}`
164
+ + ` (${describeStage('setContent', 'done', contentLoadSeconds)} / ${describeStage('handshake', 'ready', handshakeSeconds)}`
165
+ + ` / received: ${progress.join(' → ') || 'none'})`));
165
166
  }, EXPORT_TIMEOUT_MS);
166
167
  try {
167
168
  await withinDeadline(page.exposeFunction('__pecotvOnExport', (data) => {
@@ -220,7 +221,7 @@ async function headedUserAgent(browser) {
220
221
  function decodeExportDataUri(dataUri) {
221
222
  const match = /^data:[^;,]+;base64,(?<payload>.*)$/s.exec(dataUri);
222
223
  if (match?.groups?.['payload'] === undefined) {
223
- throw new Error(`embed export の応答が base64 data URI ではありません: ${dataUri.slice(0, 60)}`);
224
+ throw new Error(`embed export response is not a base64 data URI: ${dataUri.slice(0, 60)}`);
224
225
  }
225
226
  return Buffer.from(match.groups['payload'], 'base64');
226
227
  }
@@ -56,7 +56,7 @@ export async function writeEvidenceWorkbook(spec, outPath) {
56
56
  });
57
57
  }
58
58
  if (loaded.length === 0) {
59
- throw new EvidenceWorkbookError(`配置できる画像がありません (${spec.items.length.toString()} 件すべて除外)`, 'no-valid-images');
59
+ throw new EvidenceWorkbookError(`no images can be placed (all ${spec.items.length.toString()} items excluded)`, 'no-valid-images');
60
60
  }
61
61
  // media 名と No.<n> は、「有効画像だけの連番」で振り直す (contracts §3: 欠番なし)。
62
62
  const media = loaded.map((image, offset) => ({
@@ -89,7 +89,7 @@ export async function writeEvidenceWorkbook(spec, outPath) {
89
89
  await finishZip(zip, outPath);
90
90
  }
91
91
  catch (error) {
92
- throw new EvidenceWorkbookError(`xlsx を書き出せません: ${outPath} (${formatError(error)})`, 'output-write-failed');
92
+ throw new EvidenceWorkbookError(`cannot write xlsx: ${outPath} (${formatError(error)})`, 'output-write-failed');
93
93
  }
94
94
  return {
95
95
  outPath,
@@ -97,8 +97,8 @@ export async function isChromiumInstalled() {
97
97
  PECOTV_AUTO_INSTALL_BROWSER による自動取得が有効か。
98
98
  */
99
99
  export function isAutoInstallEnabled() {
100
- // eslint-disable-next-line security/detect-object-injection -- キーは本モジュールの定数
101
- return process.env[AUTO_INSTALL_ENV] === '1';
100
+ // interface-env: PECOTV_AUTO_INSTALL_BROWSER
101
+ return process.env[AUTO_INSTALL_ENV] === '1'; // eslint-disable-line security/detect-object-injection -- キーは本モジュールの定数
102
102
  }
103
103
  /**
104
104
  `playwright` パッケージの CLI エントリの絶対パス。
@@ -161,12 +161,13 @@ export async function installChromium(options = {}) {
161
161
  // eslint-disable-next-line unicorn/no-null -- 同上
162
162
  signal: null,
163
163
  stdout: '',
164
- stderr: `playwright パッケージを解決できません: ${detail}`,
164
+ stderr: `cannot resolve the playwright package: ${detail}`,
165
165
  timedOut: false,
166
166
  };
167
167
  }
168
168
  const locked = withFlock(installLockPath(), process.execPath, [cli, 'install', 'chromium']);
169
169
  return await spawnPromise(locked.command, locked.commandArguments, {
170
+ // interface-env: none
170
171
  env: process.env,
171
172
  timeoutMs: INSTALL_TIMEOUT_MS,
172
173
  signal: options.signal,
@@ -150,7 +150,7 @@ export function hostDependenciesDefaultDependencies() {
150
150
  }
151
151
  function spawnDetail(result) {
152
152
  const output = `${result.stderr}\n${result.stdout}`.trim();
153
- return result.timedOut ? `時間内に終わりませんでした: ${output}` : output;
153
+ return result.timedOut ? `did not finish in time: ${output}` : output;
154
154
  }
155
155
  /**
156
156
  Chromium が起動できる状態にする。
@@ -179,7 +179,7 @@ signal) {
179
179
  status: 'missing',
180
180
  libraries,
181
181
  packages,
182
- detail: `Chromium の起動に要る OS のライブラリが足りません${libraryList}。${reason}`,
182
+ detail: `OS libraries required to launch Chromium are missing${libraryList}; ${reason}`,
183
183
  });
184
184
  // -n: パスワードを求めずに使えるときだけ通す (devcontainer 等)。対話で止めない。
185
185
  const sudo = dependencies.isRoot ? undefined : await dependencies.run('sudo', ['-n', 'true'], SHORT_TIMEOUT_MS, signal);
@@ -196,10 +196,10 @@ signal) {
196
196
  const update = { done: false, failure: undefined };
197
197
  const runUpdate = async () => {
198
198
  if (!update.done)
199
- dependencies.notify('Chromium の起動に要る OS のライブラリが足りないため、apt-get で入れます (数分かかることがあります)。');
199
+ dependencies.notify('OS libraries required to launch Chromium are missing; installing them with apt-get (this can take a few minutes)');
200
200
  update.done = true;
201
201
  const result = await dependencies.run(command, [...aptGet, 'update'], APT_TIMEOUT_MS, signal);
202
- update.failure = result.exitCode === 0 ? undefined : `apt-get update が失敗しました: ${spawnDetail(result)}`;
202
+ update.failure = result.exitCode === 0 ? undefined : `apt-get update failed: ${spawnDetail(result)}`;
203
203
  };
204
204
  const dryRun = async () => {
205
205
  const result = await dependencies.run(dependencies.nodePath, [dependencies.playwrightCli(), 'install-deps', '--dry-run', 'chromium'], SHORT_TIMEOUT_MS, signal);
@@ -213,24 +213,24 @@ signal) {
213
213
  const { packages } = found;
214
214
  if (packages.length === 0) {
215
215
  const reasons = [spawnDetail(found.result), update.failure].filter(text => text !== undefined && text !== '').join('\n');
216
- return missing([], `この OS では入れるパッケージを割り出せませんでした。OS のパッケージ管理で上記のライブラリを入れてください: ${reasons}`);
216
+ return missing([], `cannot determine the packages to install on this OS; install the libraries above with the OS package manager: ${reasons}`);
217
217
  }
218
218
  if (!canElevate) {
219
- return missing(packages, `root 権限が無いため自動では入れられません。次を実行してください: ${aptInstallCommand(packages)}`);
219
+ return missing(packages, `cannot install automatically without root privileges; run: ${aptInstallCommand(packages)}`);
220
220
  }
221
221
  if (!update.done)
222
222
  await runUpdate();
223
223
  const install = await dependencies.run(command, [...aptGet, 'install', '-y', '--no-install-recommends', ...packages], APT_TIMEOUT_MS, signal);
224
224
  if (install.exitCode !== 0) {
225
225
  const reasons = [spawnDetail(install), update.failure].filter(text => text !== undefined && text !== '').join('\n');
226
- return missing(packages, `apt-get install に失敗しました。ネットワークとプロキシ設定を確認し、次を実行してください: ${aptInstallCommand(packages)}\n${reasons}`);
226
+ return missing(packages, `apt-get install failed; check the network and proxy settings, then run: ${aptInstallCommand(packages)}\n${reasons}`);
227
227
  }
228
228
  const retry = await dependencies.probe();
229
229
  if (retry === undefined)
230
230
  return { status: 'installed', packages };
231
231
  if (!isMissingHostDependencies(retry))
232
232
  return { status: 'launch-failed', detail: retry };
233
- return missing(packages, `${packages.join(' ')} を入れましたが、まだ起動できません: ${retry}`);
233
+ return missing(packages, `installed ${packages.join(' ')}, but Chromium still cannot launch: ${retry}`);
234
234
  }
235
235
  /**
236
236
  今の Playwright が使う Chromium のリビジョン。解決できないときは undefined。
@@ -15,13 +15,13 @@ export function chromiumLaunchError(message, cause) {
15
15
  if (isMissingHostDependencies(message)) {
16
16
  const libraries = missingSharedLibraries(message);
17
17
  const libraryList = libraries.length > 0 ? ` (${libraries.join(', ')})` : '';
18
- return new Error(`Playwright Chromium の起動に要る OS のライブラリが足りません${libraryList}: ${message}\n`
19
- + ' pecotv の setup (plugins/pecot-visual/setup.sh、MCP では setup ツール) を実行すると、sudo を使える環境では自動で入ります。'
20
- + ' sudo を使えない環境では、setup が示すコマンドを管理者に実行してもらってください。', { cause });
18
+ return new Error(`Playwright Chromium cannot launch because OS libraries are missing${libraryList}: ${message}\n`
19
+ + ' run the pecotv setup (plugins/pecot-visual/setup.sh, or the setup tool in MCP); it installs them automatically where sudo is available;'
20
+ + ' where sudo is not available, ask an administrator to run the command that setup shows', { cause });
21
21
  }
22
22
  return /Executable doesn't exist|browserType\.launch|playwright\S*chromium/i.test(message)
23
- ? new Error(`Playwright Chromium が起動できません: ${message}\n`
24
- + ' pnpm --filter @pecot/pecotv-cli exec playwright install chromium を実行してください。', { cause })
23
+ ? new Error(`Playwright Chromium cannot launch: ${message}\n`
24
+ + ' run: pnpm --filter @pecot/pecotv-cli exec playwright install chromium', { cause })
25
25
  : undefined;
26
26
  }
27
27
  /**
@@ -81,7 +81,7 @@ commands 層が soffice-not-found にマップする。
81
81
  export class SofficeSpawnError extends Error {
82
82
  stderr;
83
83
  constructor(stderr) {
84
- super(`soffice の起動に失敗しました: ${stderr}`);
84
+ super(`soffice failed to start: ${stderr}`);
85
85
  this.stderr = stderr;
86
86
  this.name = 'SofficeSpawnError';
87
87
  }
@@ -94,7 +94,7 @@ commands 層が soffice-timeout にマップする。SofficeSpawnError (起動
94
94
  export class SofficeTimeoutError extends Error {
95
95
  timeoutMs;
96
96
  constructor(timeoutMs) {
97
- super(`soffice の PDF 変換が ${String(timeoutMs)}ms でタイムアウトしました`);
97
+ super(`soffice PDF conversion timed out after ${String(timeoutMs)}ms`);
98
98
  this.timeoutMs = timeoutMs;
99
99
  this.name = 'SofficeTimeoutError';
100
100
  }
@@ -45,8 +45,8 @@ export function resolveEslintBin(assetsDirectory) {
45
45
  packageJsonPath = requireFromAssets.resolve('eslint/package.json');
46
46
  }
47
47
  catch (error) {
48
- throw new SlideLintRuntimeError(`'${assetsRoot}' から eslint を解決できませんでした`
49
- + `(本体の依存が未 install の可能性があります): ${formatError(error)}`, 'eslint-not-launched');
48
+ throw new SlideLintRuntimeError(`cannot resolve eslint from ${assetsRoot}`
49
+ + ` (the core dependencies may not be installed): ${formatError(error)}`, 'eslint-not-launched');
50
50
  }
51
51
  // eslint-disable-next-line no-restricted-syntax -- require 戻り値 (any) の narrowing
52
52
  const packageJson = requireFromAssets(packageJsonPath);
@@ -78,8 +78,8 @@ requireFromAssets, assetsRoot) {
78
78
  manifest = requireFromAssets(path.join(assetsRoot, 'package.json'));
79
79
  }
80
80
  catch (error) {
81
- throw new SlideLintRuntimeError(`'${assetsRoot}' の package.json を読めませんでした`
82
- + `(どの eslint で lint すべきか決められないため中止します): ${formatError(error)}`, 'eslint-not-launched');
81
+ throw new SlideLintRuntimeError(`cannot read package.json in ${assetsRoot}`
82
+ + ` (aborting because the eslint to lint with cannot be decided): ${formatError(error)}`, 'eslint-not-launched');
83
83
  }
84
84
  /* c8 ignore next -- object 以外の package.json は、手前の require.resolve が node の package 検証で弾くため到達不能 */
85
85
  const devDependencies = isRecord(manifest) ? manifest['devDependencies'] : undefined;
@@ -88,16 +88,16 @@ requireFromAssets, assetsRoot) {
88
88
  }
89
89
  function assertEslintMatchesAssets(context) {
90
90
  if (context.wantRange === '') {
91
- throw new SlideLintRuntimeError(`'${context.assetsRoot}' の package.json が devDependencies.eslint を宣言していません。`
92
- + ' どの eslint で lint すべきか決められないため中止します。', 'eslint-not-launched');
91
+ throw new SlideLintRuntimeError(`package.json in ${context.assetsRoot} does not declare devDependencies.eslint;`
92
+ + ' aborting because the eslint to lint with cannot be decided', 'eslint-not-launched');
93
93
  }
94
94
  /* c8 ignore next -- split の先頭要素は常に文字列で、空文字への代替の右辺は到達不能 */
95
95
  const majorText = context.resolvedVersion.split('.', 1)[0] ?? '';
96
96
  const resolvedMajor = majorText === '' ? NaN : Number(majorText);
97
97
  if (Number.isNaN(resolvedMajor) || !doesRangeAllowMajor(context.wantRange, resolvedMajor)) {
98
- throw new SlideLintRuntimeError(`eslint bin '${context.binPath}' のバージョン '${context.resolvedVersion}' が`
99
- + ` assets/slidev の要求 '${context.wantRange}' とメジャー違いです。`
100
- + ' 本体が想定する eslint 以外では lint 結果が保証できないため中止します。', 'eslint-not-launched');
98
+ throw new SlideLintRuntimeError(`eslint bin ${context.binPath} is version ${context.resolvedVersion},`
99
+ + ` a different major from ${context.wantRange} required by assets/slidev;`
100
+ + ' aborting because lint results are not guaranteed with an eslint other than the one the core expects', 'eslint-not-launched');
101
101
  }
102
102
  }
103
103
  export class ChildProcessEslintRunner {
@@ -131,6 +131,7 @@ export class ChildProcessEslintRunner {
131
131
  return spawnPromise(process.execPath, spawnArguments, {
132
132
  cwd: arguments_.talkDirectory,
133
133
  // deck lint の設定は、宣言を読まずこの JSON を受ける。create / sync の自動 lint も同じ設定で動く。
134
+ // interface-env: none
134
135
  env: { ...process.env, PECOTV_DECK_LINT: JSON.stringify(arguments_.lint) },
135
136
  timeoutMs: ESLINT_TIMEOUT_MS,
136
137
  });
@@ -32,7 +32,7 @@ export async function setupPublicSlides(destinationDirectory) {
32
32
  function requireDependencyNodeModules(dependencyRoot) {
33
33
  const resolved = resolveTalkDirectoryNodeModules(dependencyRoot);
34
34
  if (resolved === undefined) {
35
- throw new SlideCreateRuntimeError(`実行時依存の node_modules が見つかりません (探索先: ${dependencyRoot})。${DEPENDENCY_RECOVERY_HINT}`, 'symlink-failed');
35
+ throw new SlideCreateRuntimeError(`runtime dependencies node_modules not found (searched: ${dependencyRoot}); ${DEPENDENCY_RECOVERY_HINT}`, 'symlink-failed');
36
36
  }
37
37
  return resolved;
38
38
  }
@@ -405,7 +405,7 @@ async function lstatIfExists(target) {
405
405
  catch (error) {
406
406
  /* c8 ignore start -- ENOENT 以外で lstat が失敗するのは EACCES 等の防御網 */
407
407
  if (!isNotFound(error)) {
408
- throw new SlideCreateRuntimeError(`node_modules の lstat に失敗しました: ${formatError(error)}`, 'symlink-failed');
408
+ throw new SlideCreateRuntimeError(`lstat of node_modules failed: ${formatError(error)}`, 'symlink-failed');
409
409
  }
410
410
  /* c8 ignore stop */
411
411
  return undefined;
@@ -422,7 +422,7 @@ export async function talkDirectoryExists(talkDirectory) {
422
422
  catch (error) {
423
423
  /* c8 ignore start -- ENOENT 以外で stat が失敗するのは EACCES 等の防御網 */
424
424
  if (!isNotFound(error)) {
425
- throw new SlideCreateRuntimeError(`talk-dir の確認に失敗しました: ${formatError(error)}`, 'copy-failed');
425
+ throw new SlideCreateRuntimeError(`checking the talk-dir failed: ${formatError(error)}`, 'copy-failed');
426
426
  }
427
427
  /* c8 ignore stop */
428
428
  return { exists: false, isDirectory: false };
@@ -440,7 +440,7 @@ export async function hasSlidesMd(talkDirectory) {
440
440
  catch (error) {
441
441
  /* c8 ignore start -- ENOENT 以外で stat が失敗するのは EACCES 等の防御網 */
442
442
  if (!isNotFound(error)) {
443
- throw new SlideCreateRuntimeError(`slides.md の確認に失敗しました: ${formatError(error)}`, 'copy-failed');
443
+ throw new SlideCreateRuntimeError(`checking slides.md failed: ${formatError(error)}`, 'copy-failed');
444
444
  }
445
445
  /* c8 ignore stop */
446
446
  return false;
@@ -483,7 +483,7 @@ found) {
483
483
  catch (error) {
484
484
  /* c8 ignore start -- ENOENT 以外で readdir が失敗するのは EACCES 等の防御網 */
485
485
  if (!isNotFound(error)) {
486
- throw new SlideCreateRuntimeError(`pages 配下の走査に失敗しました: ${formatError(error)}`, 'copy-failed');
486
+ throw new SlideCreateRuntimeError(`scanning under pages failed: ${formatError(error)}`, 'copy-failed');
487
487
  }
488
488
  /* c8 ignore stop */
489
489
  return;
@@ -511,7 +511,7 @@ async function isDirectoryTarget(target) {
511
511
  catch (error) {
512
512
  /* c8 ignore start -- ENOENT 以外で stat が失敗するのは EACCES 等の防御網 */
513
513
  if (!isNotFound(error)) {
514
- throw new SlideCreateRuntimeError(`pages 配下の symlink 解決に失敗しました: ${formatError(error)}`, 'copy-failed');
514
+ throw new SlideCreateRuntimeError(`resolving symlinks under pages failed: ${formatError(error)}`, 'copy-failed');
515
515
  }
516
516
  /* c8 ignore stop */
517
517
  // dangling symlink。lint 対象が消えるわけではないので報告しない。
@@ -82,10 +82,10 @@ function parseManifest(text) {
82
82
  }
83
83
  function requireName(manifest, directory) {
84
84
  if (manifest.name === undefined) {
85
- throw new ThemeFetchError(`テーマの package.json に name がありません (${directory})`, 'unknown');
85
+ throw new ThemeFetchError(`theme package.json has no name: ${directory}`, 'unknown');
86
86
  }
87
87
  if (!isPackageName(manifest.name)) {
88
- throw new ThemeFetchError(`テーマの package.json の name がパッケージ名として使えません (${manifest.name})`, 'unknown');
88
+ throw new ThemeFetchError(`theme package.json name is not a valid package name: ${manifest.name}`, 'unknown');
89
89
  }
90
90
  return manifest.name;
91
91
  }
@@ -100,11 +100,11 @@ async function referenceLocalTheme(themePath, options) {
100
100
  text = await readFile(path.join(directory, 'package.json'), 'utf8');
101
101
  }
102
102
  catch {
103
- throw new ThemeFetchError(`テーマのディレクトリに package.json がありません (${directory})`, 'unknown');
103
+ throw new ThemeFetchError(`theme directory has no package.json: ${directory}`, 'unknown');
104
104
  }
105
105
  const manifest = parseManifest(text);
106
106
  if (manifest.dependencyNames.length > 0 && !existsSync(path.join(directory, 'node_modules'))) {
107
- throw new ThemeFetchError(`テーマのディレクトリで install を実行してください (${directory} に node_modules がありません)`, 'install');
107
+ throw new ThemeFetchError(`node_modules not found in the theme directory: ${directory} (fix: run install there)`, 'install');
108
108
  }
109
109
  return { name: requireName(manifest, directory), directory, reused: false };
110
110
  }
@@ -134,6 +134,7 @@ async function reusableName(directory, spec) {
134
134
  return manifest.dependencyNames.length > 0 && !existsSync(path.join(directory, 'package', 'node_modules', '.modules.yaml')) ? undefined : manifest.name;
135
135
  }
136
136
  function gitEnvironment() {
137
+ // interface-env: none
137
138
  const environment = { ...process.env, LC_ALL: 'C', GIT_TERMINAL_PROMPT: '0' };
138
139
  for (const name of GIT_ENVIRONMENT_REMOVED)
139
140
  Reflect.deleteProperty(environment, name);
@@ -212,10 +213,12 @@ options) {
212
213
  const pnpm = resolvePnpmCommand(pluginRoot, packageDirectory);
213
214
  // cwd がテーマ側のため、テーマの packageManager で corepack が止まらないようにする。
214
215
  // npx を使うときは cwd を / にする(テーマの devEngines で npm が止まらないようにする)。対象は --dir で渡す。
215
- const installed = await run(pnpm.command, [...pnpm.commandArguments, ...PNPM_INSTALL_ARGUMENTS], { ...process.env, COREPACK_ENABLE_STRICT: '0' }, pnpm.cwd);
216
+ const installed = await run(pnpm.command, [...pnpm.commandArguments, ...PNPM_INSTALL_ARGUMENTS],
217
+ // interface-env: none
218
+ { ...process.env, COREPACK_ENABLE_STRICT: '0' }, pnpm.cwd);
216
219
  assertStarted(installed, 'pnpm', 'install');
217
220
  if (installed.exitCode !== 0)
218
- throw installFailure('テーマの依存を pnpm で取得できませんでした', installed);
221
+ throw installFailure('failed to fetch the theme dependencies with pnpm', installed);
219
222
  const patchesDirectory = path.join(packageDirectory, 'patches');
220
223
  const scan = scanPatchDigests(patchesDirectory);
221
224
  if (scan.error !== undefined)
@@ -260,7 +263,7 @@ async function readManifestText(packageDirectory) {
260
263
  return await readFile(path.join(packageDirectory, 'package.json'), 'utf8');
261
264
  }
262
265
  catch {
263
- throw new ThemeFetchError('テーマのリポジトリ直下に package.json がありません', 'install');
266
+ throw new ThemeFetchError('theme repository has no package.json at its root', 'install');
264
267
  }
265
268
  }
266
269
  function installFailure(summary, result) {
@@ -272,15 +275,15 @@ timedOutReason は時間切れの分類。git は接続の待ちなので connec
272
275
  */
273
276
  function assertStarted(result, tool, timedOutReason) {
274
277
  if (result.exitCode === LOCK_CONFLICT_EXIT_CODE) {
275
- throw new ThemeFetchError('別のプロセスが同じテーマを取得中です。完了を待って再実行してください', 'install');
278
+ throw new ThemeFetchError('another process is fetching the same theme; wait for it to finish and run again', 'install');
276
279
  }
277
280
  if (result.timedOut) {
278
- throw new ThemeFetchError(`${tool} が時間切れで中断しました。ネットワークを確認して再実行してください`, timedOutReason);
281
+ throw new ThemeFetchError(`${tool} timed out; check the network and run again`, timedOutReason);
279
282
  }
280
283
  if (result.exitCode !== null)
281
284
  return;
282
285
  const detail = result.stderr.trim();
283
- throw new ThemeFetchError(`${tool} を起動できません。導入を確認してください${detail === '' ? '' : `\n${detail}`}`, 'install');
286
+ throw new ThemeFetchError(`cannot start ${tool}; check that it is installed${detail === '' ? '' : `\n${detail}`}`, 'install');
284
287
  }
285
288
  /**
286
289
  package/patches/ のパッチを当てる。パッチが無ければ何もしない。
@@ -294,7 +297,7 @@ options) {
294
297
  const manifestPath = resolveDependency('patch-package/package.json', import.meta.url);
295
298
  /* c8 ignore start -- 本体の依存に patch-package を同梱しているため、テストでは再現できない防御網 */
296
299
  if (manifestPath === undefined) {
297
- throw new ThemeFetchError('patch-package を本体の依存から解決できないため、テーマの patch を当てられません', 'install');
300
+ throw new ThemeFetchError('cannot apply the theme patches because patch-package cannot be resolved from the core dependencies', 'install');
298
301
  }
299
302
  /* c8 ignore stop */
300
303
  const result = await applyPatches({
@@ -309,7 +312,7 @@ options) {
309
312
  if (result !== undefined)
310
313
  assertStarted(result, 'patch-package', 'install');
311
314
  if (result !== undefined && result.exitCode !== 0)
312
- throw installFailure('テーマの patch を当てられませんでした', result);
315
+ throw installFailure('failed to apply the theme patches', result);
313
316
  }
314
317
  /**
315
318
  node_modules 直下のパッケージ名。`@scope` は配下の名前まで展開し、`.` 始まりの項目は数えない。
@@ -355,8 +358,8 @@ options) {
355
358
  const overlapping = declared.filter(name => base.has(name)).toSorted((left, right) => compareStrings(left, right));
356
359
  if (overlapping.length === 0)
357
360
  return;
358
- options.warn(`テーマの dependencies に本体と同名のパッケージがあります: ${overlapping.join(', ')}。`
359
- + '本体の 1 つに寄せるには、テーマの package.json で peerDependencies へ移してください。');
361
+ options.warn(`theme dependencies contain packages with the same names as the core: ${overlapping.join(', ')}`
362
+ + ' (fix: move them to peerDependencies in the theme package.json so that only the core copy is used)');
360
363
  }
361
364
  /**
362
365
  一時ディレクトリを `<tag>/` へ置く。
@@ -383,7 +386,7 @@ async function place(temporary, directory, storeSpec, name) {
383
386
  /* c8 ignore start -- 消した直後に別プロセスが置く競合で、テストでは再現できない */
384
387
  catch {
385
388
  // 消した直後に別プロセスが置いた。読めない置き場として止め、利用者の再実行に任せる。
386
- throw new ThemeFetchError(`テーマの置き場を置き直せません。${directory} を削除してやり直してください`, 'unknown');
389
+ throw new ThemeFetchError(`cannot recreate the theme directory: ${directory} (fix: delete it and run again)`, 'unknown');
387
390
  }
388
391
  /* c8 ignore stop */
389
392
  }
@@ -197,13 +197,13 @@ function isDeckLoader(value) {
197
197
  const slidevParserLoad = memoizeAsync(async () => {
198
198
  const entry = resolveDependency('@slidev/parser/fs', import.meta.url);
199
199
  if (entry === undefined) {
200
- throw new Error(`@slidev/parser が解決できません。${DEPENDENCY_RECOVERY_HINT}`);
200
+ throw new Error(`cannot resolve @slidev/parser; ${DEPENDENCY_RECOVERY_HINT}`);
201
201
  }
202
202
  const module_ = await import(pathToFileURL(entry).href);
203
203
  const loader = isRecord(module_) ? module_['load'] : undefined;
204
204
  /* c8 ignore next 3 -- 解決できた @slidev/parser/fs が load を持たないのは防御網 */
205
205
  if (!isDeckLoader(loader)) {
206
- throw new Error(`@slidev/parser/fs が load を公開していません (${entry})`);
206
+ throw new Error(`@slidev/parser/fs does not export load: ${entry}`);
207
207
  }
208
208
  return loader;
209
209
  });
@@ -238,7 +238,7 @@ export async function computeDeckCacheKeys(options) {
238
238
  return {
239
239
  ok: false,
240
240
  failure: 'invalid-environment',
241
- message: 'Chromium / プラグインのバージョンが空のためキャッシュキーを算出できません',
241
+ message: 'cannot compute the cache key because the Chromium or plugin version is empty',
242
242
  };
243
243
  }
244
244
  let deck;
@@ -258,7 +258,7 @@ export async function computeDeckCacheKeys(options) {
258
258
  return {
259
259
  ok: false,
260
260
  failure: 'slides-load-failed',
261
- message: `slides.md を分解できません (${options.slidesPath}): ${errorMessage(error)}`,
261
+ message: `cannot parse slides.md: ${options.slidesPath}: ${errorMessage(error)}`,
262
262
  };
263
263
  }
264
264
  // load() は parse エラーを throw せず errors に積む。src 先が無いスライドは通知なしに
@@ -268,7 +268,7 @@ export async function computeDeckCacheKeys(options) {
268
268
  return {
269
269
  ok: false,
270
270
  failure: 'slides-has-errors',
271
- message: `slides.md に解析エラーがあります: ${deckErrors}`,
271
+ message: `slides.md has parse errors: ${deckErrors}`,
272
272
  };
273
273
  }
274
274
  const bundleHash = await sha256OfFile(options.domToPptxBundlePath);
@@ -276,7 +276,7 @@ export async function computeDeckCacheKeys(options) {
276
276
  return {
277
277
  ok: false,
278
278
  failure: 'bundle-unreadable',
279
- message: `dom-to-pptx.bundle.js を読めません: ${options.domToPptxBundlePath}`,
279
+ message: `cannot read dom-to-pptx.bundle.js: ${options.domToPptxBundlePath}`,
280
280
  };
281
281
  }
282
282
  const envHash = computeEnvHash({
@@ -1,14 +1,14 @@
1
1
  import type { Logger } from '../../domain/slidev-to-pptx/logger.js';
2
+ import { type DiagnosticStream } from '../../diagnostics.js';
2
3
  export interface LoggerSink {
3
- readonly stdout: NodeJS.WritableStream;
4
- readonly stderr: NodeJS.WritableStream;
4
+ readonly stderr: DiagnosticStream;
5
5
  }
6
6
  /**
7
- 指定 level の Logger を生成する。sink 未指定時は process.stdout / process.stderr を使う。
7
+ 指定 level の Logger を生成する。sink 未指定時は process.stderr を使う。
8
8
 
9
- @param level 'normal' (info のみ) / 'verbose' (info + verbose) / 'debug' (全 level)。
9
+ @param level 'normal' (warn / error のみ) / 'verbose' (info + verbose も note) / 'debug' (全 level)。
10
10
  未知の level は 'normal' 扱い。
11
- @param sink 注入する WritableStream ペア。省略時は process.stdout / process.stderr。
11
+ @param sink 注入する stderr。省略時は process.stderr。
12
12
  */
13
13
  export declare function createLogger(level?: string, sink?: LoggerSink): Logger;
14
14
  //# sourceMappingURL=console-logger.d.ts.map
@@ -1,36 +1,35 @@
1
- // Slidev PPTX pipeline 用の Logger 実装。sink (stdout / stderr WritableStream) を注入できる。
2
- // sink 未指定時は process.stdout / process.stderr を使う。
1
+ // Slidev PPTX pipeline 用の Logger 実装。出力はすべて stderr の診断行(note / warning / error)にする。
2
+ // sink 未指定時は process.stderr を使う。
3
3
  import { format } from 'node:util';
4
+ import { createDiagnostics } from '../../diagnostics.js';
5
+ // 区切りのための先頭の改行は、空の note の行になるので落とす。
6
+ // eslint-disable-next-line unicorn/name-replacements -- args は console.log と同じ可変長引数の慣習名を維持
7
+ function text(...args) {
8
+ return format(...args).replace(/^\n+/, '');
9
+ }
4
10
  const LOG_LEVELS = { normal: 0, verbose: 1, debug: 2 };
5
11
  /**
6
- 指定 level の Logger を生成する。sink 未指定時は process.stdout / process.stderr を使う。
12
+ 指定 level の Logger を生成する。sink 未指定時は process.stderr を使う。
7
13
 
8
- @param level 'normal' (info のみ) / 'verbose' (info + verbose) / 'debug' (全 level)。
14
+ @param level 'normal' (warn / error のみ) / 'verbose' (info + verbose も note) / 'debug' (全 level)。
9
15
  未知の level は 'normal' 扱い。
10
- @param sink 注入する WritableStream ペア。省略時は process.stdout / process.stderr。
16
+ @param sink 注入する stderr。省略時は process.stderr。
11
17
  */
12
- export function createLogger(level = 'normal',
13
- // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types -- stream は mutable 型
14
- sink) {
15
- const resolvedSink = sink ?? { stdout: process.stdout, stderr: process.stderr };
18
+ export function createLogger(level = 'normal', sink) {
19
+ const diagnostics = createDiagnostics((sink ?? { stderr: process.stderr }).stderr);
16
20
  // LOG_LEVELS の lookup に失敗したときは、`?? 0` で normal にフォールバックする。
17
21
  // eslint-disable-next-line security/detect-object-injection -- level は CLI flag 経由の限定値
18
22
  const threshold = LOG_LEVELS[level] ?? 0;
19
23
  /* eslint-disable unicorn/name-replacements -- args は console.log と同じ可変長引数の慣習名を維持 */
20
- const writeOut = (...args) => {
21
- resolvedSink.stdout.write(format(...args) + '\n');
22
- };
23
- const writeErr = (...args) => {
24
- resolvedSink.stderr.write(format(...args) + '\n');
25
- };
26
24
  return {
27
- info: (...args) => { writeOut(...args); },
25
+ info: (...args) => { if (threshold >= 1)
26
+ diagnostics.note(text(...args)); },
28
27
  verbose: (...args) => { if (threshold >= 1)
29
- writeOut(...args); },
28
+ diagnostics.note(text(...args)); },
30
29
  debug: (...args) => { if (threshold >= 2)
31
- writeOut(...args); },
32
- warn: (...args) => { writeErr(...args); },
33
- error: (...args) => { writeErr(...args); },
30
+ diagnostics.note(text(...args)); },
31
+ warn: (...args) => { diagnostics.warning(text(...args)); },
32
+ error: (...args) => { diagnostics.error(text(...args)); },
34
33
  };
35
34
  /* eslint-enable unicorn/name-replacements */
36
35
  }
@@ -6,7 +6,7 @@ slides.md の frontmatter から title を読み取る。取得できない場
6
6
  ファイル読取 + title 抽出は、共通ヘルパー readSlidesTitleFromFile に委譲する。
7
7
  ここでは、読取失敗時の warn と自契約 (undefined → null 写像) のみを担う。
8
8
  */
9
- export declare function readSlidesTitle(distDir: string, logger?: Logger): Promise<string | null>;
9
+ export declare function readSlidesTitle(distDir: string, logger: Logger): Promise<string | null>;
10
10
  /**
11
11
  dom-to-pptx ライブラリをページに注入する。
12
12
  addScriptTag は script の実行まで待つため、定義の確認は直後の 1 回で足りる。