@pecot/visual-mcp 1.2.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.
- package/.claude-plugin/plugin.json +1 -1
- package/assets/slidev/deck-lint.config.js +2 -2
- package/assets/slidev/deck-lint.env.config.js +2 -2
- package/assets/slidev/package.json +1 -1
- package/assets/slidev/scripts/eslint/_shared/dist/lib/drawio-geometry.js +10 -10
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.d.ts +2 -2
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.js +4 -4
- package/assets/slidev/scripts/eslint/_shared/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/_shared/lib/drawio-geometry.ts +10 -10
- package/assets/slidev/scripts/eslint/_shared/lib/text-measurer.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-content-before-frontmatter.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-marker-cell.js +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-page.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-asset-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-filename-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-scaled-drawio.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-triple-hyphen-in-frontmatter.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-unknown-props.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/one-slide-per-file.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-matching-length.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-slides-entry.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/validate-clicks.js +7 -7
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-content-before-frontmatter.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-marker-cell.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-page.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-asset-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-filename-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-scaled-drawio.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-triple-hyphen-in-frontmatter.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-unknown-props.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/one-slide-per-file.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-matching-length.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-slides-entry.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/validate-clicks.ts +7 -7
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/max-chars.js +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint-body.js +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint.js +2 -2
- package/assets/slidev/scripts/eslint/text-constraints/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/max-chars.ts +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint-body.ts +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint.ts +2 -2
- package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/lib/semantic-validator.js +12 -12
- package/assets/slidev/scripts/eslint/validate-references/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/validate-references/index.ts +1 -1
- package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
- package/cli/dist/cli.js +8 -8
- package/cli/dist/commands/chromium/host-dependencies.js +3 -3
- package/cli/dist/commands/drawio/export.js +15 -15
- package/cli/dist/commands/drawio/theme.js +7 -7
- package/cli/dist/commands/drawio/url.js +14 -14
- package/cli/dist/commands/evidence-xlsx/create.js +11 -11
- package/cli/dist/commands/pptx-ooxml/preview.js +13 -13
- package/cli/dist/commands/slidev-project/create.js +12 -12
- package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
- package/cli/dist/commands/slidev-project/lint.js +13 -13
- package/cli/dist/commands/slidev-project/sync.js +19 -19
- package/cli/dist/commands/slidev-project/theme.js +9 -9
- package/cli/dist/commands/slidev-to-pptx/convert.js +47 -47
- package/cli/dist/domain/_shared/text-check.js +2 -2
- package/cli/dist/domain/drawio/export.js +4 -4
- package/cli/dist/domain/drawio/label-text.js +1 -1
- package/cli/dist/domain/drawio/url.js +27 -27
- package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
- package/cli/dist/domain/evidence-xlsx/spec-schema.js +26 -26
- package/cli/dist/domain/pptx-ooxml/merge.js +3 -3
- package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
- package/cli/dist/domain/slidev-project/generated-files.js +34 -34
- package/cli/dist/domain/slidev-project/initial-pages.js +4 -4
- package/cli/dist/domain/slidev-project/lint.js +11 -11
- package/cli/dist/domain/slidev-project/sync.js +13 -13
- package/cli/dist/domain/slidev-project/warnings.js +4 -4
- package/cli/dist/domain/slidev-theme/declaration.js +9 -9
- package/cli/dist/domain/slidev-theme/references.js +10 -10
- package/cli/dist/domain/slidev-theme/store-layout.js +6 -6
- package/cli/dist/domain/slidev-theme/talk-theme.js +13 -13
- package/cli/dist/domain/slidev-theme/theme-spec.js +5 -5
- package/cli/dist/domain/slidev-to-pptx/errors.js +3 -3
- package/cli/dist/infra/_shared/dependency-root.js +4 -4
- package/cli/dist/infra/_shared/patch-apply.js +6 -5
- package/cli/dist/infra/_shared/runtime-install.js +4 -3
- package/cli/dist/infra/_shared/slidev-bin.js +1 -1
- package/cli/dist/infra/drawio/icons.js +3 -3
- package/cli/dist/infra/drawio/pdf.js +1 -1
- package/cli/dist/infra/drawio/screenshot.js +10 -9
- package/cli/dist/infra/evidence-xlsx/workbook-writer.js +2 -2
- package/cli/dist/infra/playwright/chromium.js +4 -3
- package/cli/dist/infra/playwright/host-dependencies.js +8 -8
- package/cli/dist/infra/playwright/launch.js +5 -5
- package/cli/dist/infra/pptx-ooxml/soffice.js +2 -2
- package/cli/dist/infra/slidev-project/eslint-runner.js +10 -9
- package/cli/dist/infra/slidev-project/fs.js +6 -6
- package/cli/dist/infra/slidev-theme/store.js +18 -15
- package/cli/dist/infra/slidev-to-pptx/cache-store.js +6 -6
- package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
- package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +1 -1
- package/cli/dist/infra/slidev-to-pptx/pipeline.js +54 -54
- package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +14 -14
- package/cli/dist/infra/slidev-to-pptx/prerender.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/runner.js +1 -0
- package/cli/dist/infra/slidev-to-pptx/scanner.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/server.js +2 -2
- package/cli/dist/infra/slidev-to-pptx/single-pass-worker.js +39 -39
- package/cli/dist/infra/slidev-to-pptx/slide-worker.js +3 -3
- package/cli/dist/infra/slidev-to-pptx/visibility-helpers.js +8 -8
- package/cli/dist/mcp/dev-server-registry.js +10 -9
- package/cli/dist/mcp/queue.js +1 -1
- package/cli/dist/mcp/result.js +4 -4
- package/cli/dist/mcp/serve.js +1 -1
- package/cli/dist/mcp/server.js +2 -2
- package/cli/dist/mcp/tools/_shared.d.ts +1 -1
- package/cli/dist/mcp/tools/_shared.js +36 -37
- package/cli/dist/mcp/tools/drawio.js +22 -22
- package/cli/dist/mcp/tools/evidence.js +8 -8
- package/cli/dist/mcp/tools/setup.js +26 -26
- package/cli/dist/mcp/tools/slide-dev.js +20 -20
- package/cli/dist/mcp/tools/slide-page.js +36 -36
- package/cli/dist/mcp/tools/slide-theme.js +6 -6
- package/cli/dist/mcp/tools/slide.js +49 -49
- package/cli/dist/mcp/windows-path.js +8 -7
- package/cli/dist/node-runtime.d.ts +6 -1
- package/cli/dist/node-runtime.js +16 -8
- package/npm-shrinkwrap.json +3 -3
- package/package.json +2 -2
- package/vendor/text-rules/dist/source-hash +1 -1
|
@@ -32,9 +32,9 @@ eslint 自身の exit 2(設定エラー)は domain で `SlideLintRuntimeErro
|
|
|
32
32
|
*/
|
|
33
33
|
export function createSlideLintCommand(buildDependencies) {
|
|
34
34
|
const command = new Command('lint')
|
|
35
|
-
.description('talk-dir
|
|
36
|
-
.requiredOption('--dir <path>', '
|
|
37
|
-
.option('--json', 'machine-readable
|
|
35
|
+
.description('lint the whole talk-dir (pages/**/*.md and slides.md)')
|
|
36
|
+
.requiredOption('--dir <path>', 'absolute path of the talk-dir to lint')
|
|
37
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
38
38
|
.exitOverride()
|
|
39
39
|
.configureOutput({
|
|
40
40
|
writeErr: (string_) => {
|
|
@@ -62,7 +62,7 @@ export function createSlideLintCommand(buildDependencies) {
|
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
64
|
// 件数行を読まずに成否が分かるよう見出し行に結果を載せる(no-target は exit 0 側)。
|
|
65
|
-
const outcomeLabel = summary.outcome === 'violations' ? '
|
|
65
|
+
const outcomeLabel = summary.outcome === 'violations' ? 'violations' : 'success';
|
|
66
66
|
writeData(dependencies.stdout, `slide lint: ${outcomeLabel} (${summary.directory})`);
|
|
67
67
|
writeSummaryLines(summary, dependencies);
|
|
68
68
|
}
|
|
@@ -81,7 +81,7 @@ export function createSlideLintCommand(buildDependencies) {
|
|
|
81
81
|
}));
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
|
-
createDiagnostics(dependencies.stderr).error(`slide lint
|
|
84
|
+
createDiagnostics(dependencies.stderr).error(`slide lint failed: ${detail}`);
|
|
85
85
|
}
|
|
86
86
|
process.exitCode = toExitCode(error);
|
|
87
87
|
}
|
|
@@ -138,15 +138,15 @@ dependencies) {
|
|
|
138
138
|
// 走査抜けの警告は lint 対象 0 件でも出す必要があるため no-target の早期 return より前に置く。
|
|
139
139
|
const diagnostics = createDiagnostics(dependencies.stderr);
|
|
140
140
|
for (const skipped of summary.skippedSymlinkDirectories) {
|
|
141
|
-
diagnostics.warning(`${skipped}
|
|
142
|
-
+ '
|
|
141
|
+
diagnostics.warning(`${skipped} is a symlink and is not scanned by eslint`
|
|
142
|
+
+ ' (files under it may not be linted)');
|
|
143
143
|
}
|
|
144
144
|
if (summary.outcome === 'no-target') {
|
|
145
|
-
writeData(dependencies.stdout, `
|
|
145
|
+
writeData(dependencies.stdout, ` linted 0 files (no pages/**/*.md or slides.md found)`);
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
writeData(dependencies.stdout, `
|
|
149
|
-
+ ` /
|
|
148
|
+
writeData(dependencies.stdout, ` linted ${String(summary.lintedFileCount)} files / ${String(summary.errorCount)} errors`
|
|
149
|
+
+ ` / ${String(summary.warningCount)} warnings`);
|
|
150
150
|
for (const violation of summary.violations) {
|
|
151
151
|
writeData(dependencies.stdout, ` ${violation.file}:${String(violation.line)}:${String(violation.column)}`
|
|
152
152
|
+ ` ${violation.rule} ${violation.message}`);
|
|
@@ -179,13 +179,13 @@ export function writeAutoDeckLintReport(report, talkDirectory,
|
|
|
179
179
|
dependencies) {
|
|
180
180
|
const { summary } = report;
|
|
181
181
|
if (summary === undefined) {
|
|
182
|
-
createDiagnostics(dependencies.stderr).warning(`deck lint
|
|
182
|
+
createDiagnostics(dependencies.stderr).warning(`deck lint skipped: ${report.failure ?? ''}`);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
writeData(dependencies.stdout, 'deck lint:');
|
|
186
186
|
writeSummaryLines(summary, dependencies);
|
|
187
187
|
if (summary.outcome === 'violations') {
|
|
188
|
-
writeData(dependencies.stdout, `
|
|
188
|
+
writeData(dependencies.stdout, ` the violations above do not affect this command's result; after fixing, run pecotv slide lint --dir ${talkDirectory} to recheck`);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
@@ -258,7 +258,7 @@ export function slideLintDefaultDependencies() {
|
|
|
258
258
|
const pluginRoot = process.env['CLAUDE_PLUGIN_ROOT'];
|
|
259
259
|
/* c8 ignore next 3 -- bin/pecotv が CLAUDE_PLUGIN_ROOT を必ず export するため未設定ルートは実運用で発生しない */
|
|
260
260
|
if (pluginRoot === undefined || pluginRoot === '') {
|
|
261
|
-
throw new SlideLintRuntimeError('CLAUDE_PLUGIN_ROOT
|
|
261
|
+
throw new SlideLintRuntimeError('CLAUDE_PLUGIN_ROOT is not set', 'unknown');
|
|
262
262
|
}
|
|
263
263
|
const runtimeDirectory = runningMirrorDirectory();
|
|
264
264
|
return {
|
|
@@ -54,14 +54,14 @@ commander コマンドファクトリ。コマンド名は `sync`、`slide` グ
|
|
|
54
54
|
*/
|
|
55
55
|
export function createSlideSyncCommand(buildDependencies) {
|
|
56
56
|
const command = new Command('sync')
|
|
57
|
-
.description('talk-dir
|
|
58
|
-
+ '
|
|
59
|
-
+ '
|
|
60
|
-
+ '
|
|
61
|
-
.requiredOption('--dir <path>', '
|
|
62
|
-
.option('--theme <spec>', '
|
|
63
|
-
.option('--node-modules-only', 'node_modules
|
|
64
|
-
.option('--json', 'machine-readable
|
|
57
|
+
.description('sync a talk-dir; a pre-migration talk-dir that holds a template copy is moved to reference the theme given by --theme'
|
|
58
|
+
+ ' (template-derived files are removed; slides.md, pages/*.md and public/slides/ are kept); '
|
|
59
|
+
+ 'a migrated talk-dir fetches the theme at the version in package.json dependencies and rebuilds node_modules; '
|
|
60
|
+
+ 'generated files (vite.config.ts, start.mjs) are aligned with the current plugin output; nothing else changes')
|
|
61
|
+
.requiredOption('--dir <path>', 'absolute path of the talk-dir to sync')
|
|
62
|
+
.option('--theme <spec>', 'theme referenced by a pre-migration talk-dir (git+https://<host>/<owner>/<repo>.git#<tag> or file:<path>)')
|
|
63
|
+
.option('--node-modules-only', 'rebuild node_modules only (a normal sync of a migrated talk-dir does the same)', false)
|
|
64
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
65
65
|
.exitOverride()
|
|
66
66
|
.configureOutput({
|
|
67
67
|
writeErr: (string_) => {
|
|
@@ -112,7 +112,7 @@ export function createSlideSyncCommand(buildDependencies) {
|
|
|
112
112
|
}));
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
createDiagnostics(dependencies.stderr).error(`slide sync
|
|
115
|
+
createDiagnostics(dependencies.stderr).error(`slide sync failed: ${detail}`);
|
|
116
116
|
}
|
|
117
117
|
process.exitCode = toExitCode(error);
|
|
118
118
|
}
|
|
@@ -130,27 +130,27 @@ function writeSyncSummary(summary,
|
|
|
130
130
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
131
131
|
stdout) {
|
|
132
132
|
const { theme } = summary;
|
|
133
|
-
const themeLine = theme === undefined ? undefined : `
|
|
133
|
+
const themeLine = theme === undefined ? undefined : ` theme: ${theme.name} (${theme.spec})`;
|
|
134
134
|
if (summary.nodeModulesOnly) {
|
|
135
|
-
writeData(stdout, `slide sync (node_modules
|
|
135
|
+
writeData(stdout, `slide sync (node_modules only): success (${summary.directory})`);
|
|
136
136
|
if (themeLine !== undefined)
|
|
137
137
|
writeData(stdout, themeLine);
|
|
138
138
|
writeData(stdout, ` node_modules → ${summary.nodeModulesTarget}`);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
writeData(stdout, `slide sync:
|
|
141
|
+
writeData(stdout, `slide sync: success (${summary.directory})`);
|
|
142
142
|
if (themeLine !== undefined)
|
|
143
143
|
writeData(stdout, themeLine);
|
|
144
144
|
if (summary.mode === 'relink') {
|
|
145
145
|
if (theme !== undefined)
|
|
146
|
-
writeData(stdout, `
|
|
146
|
+
writeData(stdout, ` location: ${theme.directory}`);
|
|
147
147
|
writeData(stdout, ` node_modules → ${summary.nodeModulesTarget}`);
|
|
148
|
-
writeData(stdout, ' node_modules
|
|
148
|
+
writeData(stdout, ' nothing changed except node_modules');
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
writeData(stdout, ` node_modules → ${summary.nodeModulesTarget}`);
|
|
152
|
-
writeData(stdout, `
|
|
153
|
-
writeData(stdout, '
|
|
152
|
+
writeData(stdout, ` removed (${String(summary.removed.length)}): ${summary.removed.join(', ')}`);
|
|
153
|
+
writeData(stdout, ' kept slides.md, pages/*.md and public/slides/; rewrote theme: in slides.md and the dependency in package.json');
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
`slide sync` の実処理と機械可読な結果組み立て。CLI action と MCP ツールの双方がここを通る。
|
|
@@ -209,7 +209,7 @@ stderr) {
|
|
|
209
209
|
}
|
|
210
210
|
catch (error) {
|
|
211
211
|
// 移行前の形 (theme: none) もここに来る。一覧を空にして、同期の成否は変えない。
|
|
212
|
-
createDiagnostics(stderr).warning(`layout catalog
|
|
212
|
+
createDiagnostics(stderr).warning(`cannot read layout catalog: ${directory}: ${formatError(error)}`);
|
|
213
213
|
return { categories: [], layouts: [] };
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -250,7 +250,7 @@ async function prepareMigrationTheme(themeOption, talkDirectory, context) {
|
|
|
250
250
|
assertDependencyRootAvailable(dependencyRoot);
|
|
251
251
|
const storeRoot = context.storeRoot();
|
|
252
252
|
if (storeRoot === undefined) {
|
|
253
|
-
throw new SlideCreateRuntimeError('
|
|
253
|
+
throw new SlideCreateRuntimeError('cannot determine the theme location (fix: check the data directory CLAUDE_PLUGIN_DATA)', 'theme-unknown');
|
|
254
254
|
}
|
|
255
255
|
const fetched = await context.fetch(spec, {
|
|
256
256
|
storeRoot,
|
|
@@ -317,7 +317,7 @@ export function slideSyncDefaultDependencies() {
|
|
|
317
317
|
const pluginRoot = process.env['CLAUDE_PLUGIN_ROOT'];
|
|
318
318
|
/* c8 ignore next 3 -- bin/pecotv が CLAUDE_PLUGIN_ROOT を必ず export するため未設定ルートは実運用で発生しない */
|
|
319
319
|
if (pluginRoot === undefined || pluginRoot === '') {
|
|
320
|
-
throw new SlideSyncRuntimeError('CLAUDE_PLUGIN_ROOT
|
|
320
|
+
throw new SlideSyncRuntimeError('CLAUDE_PLUGIN_ROOT is not set', 'unknown');
|
|
321
321
|
}
|
|
322
322
|
const dependencyRoot = pluginDependencyRoot();
|
|
323
323
|
return {
|
|
@@ -18,8 +18,8 @@ import { themeErrorReason } from '../../domain/slidev-theme/error-reason.js';
|
|
|
18
18
|
import { buildLayoutCatalog, readLayoutCategories, resolveLayoutReferences, } from '../../domain/slidev-theme/references.js';
|
|
19
19
|
import { resolveTalkTheme } from '../../domain/slidev-theme/talk-theme.js';
|
|
20
20
|
import { NodeThemeFiles } from '../../infra/slidev-theme/fs.js';
|
|
21
|
-
const LINK_COLOR_WARNING = 'pptx.linkColor
|
|
22
|
-
+
|
|
21
|
+
const LINK_COLOR_WARNING = 'pptx.linkColor is omitted, so links are not converted in PPTX (no hyperlinks are added) '
|
|
22
|
+
+ `(fix: set pptx.linkColor in ${THEME_DECLARATION_FILE_NAME} to a 6-digit hex value to convert links)`;
|
|
23
23
|
/**
|
|
24
24
|
`slide theme` の実処理。CLI action と MCP ツール(slide_theme)、lint・page・convert もここを通る。
|
|
25
25
|
|
|
@@ -87,9 +87,9 @@ stdout,
|
|
|
87
87
|
stderr) {
|
|
88
88
|
const { theme } = data;
|
|
89
89
|
writeData(stdout, `slide theme: ${theme.name} (${theme.spec})`);
|
|
90
|
-
writeData(stdout, `
|
|
91
|
-
writeData(stdout, `
|
|
92
|
-
writeData(stdout, `
|
|
90
|
+
writeData(stdout, ` theme root: ${theme.directory}`);
|
|
91
|
+
writeData(stdout, ` declaration: ${theme.declared ? 'present' : 'absent'}`);
|
|
92
|
+
writeData(stdout, ` layouts: ${String(data.layouts.length)}`);
|
|
93
93
|
for (const category of data.categories) {
|
|
94
94
|
writeData(stdout, ` --- ${category.label}: ${category.question} ---`);
|
|
95
95
|
const members = data.layouts.filter(entry => entry.category === category.id);
|
|
@@ -112,9 +112,9 @@ exit code: 成功 = 0 / 解決・宣言の失敗 = 1 / usage error = 2(command
|
|
|
112
112
|
*/
|
|
113
113
|
export function createSlideThemeCommand(buildDependencies) {
|
|
114
114
|
const command = new Command('theme')
|
|
115
|
-
.description('talk-dir
|
|
116
|
-
.option('--dir <path>', 'talk-dir
|
|
117
|
-
.option('--json', 'machine-readable
|
|
115
|
+
.description('print the theme declaration and layout list referenced by a talk-dir')
|
|
116
|
+
.option('--dir <path>', 'talk-dir path (default: current directory)')
|
|
117
|
+
.option('--json', 'print machine-readable JSON to stdout', false)
|
|
118
118
|
.exitOverride()
|
|
119
119
|
.configureOutput({
|
|
120
120
|
writeErr: (string_) => {
|
|
@@ -151,7 +151,7 @@ export function createSlideThemeCommand(buildDependencies) {
|
|
|
151
151
|
writeData(dependencies.stdout, JSON.stringify({ event: 'slide.theme.error', reason, detail }));
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
|
-
createDiagnostics(dependencies.stderr).error(`slide theme
|
|
154
|
+
createDiagnostics(dependencies.stderr).error(`slide theme failed: ${detail}`);
|
|
155
155
|
}
|
|
156
156
|
process.exitCode = 1;
|
|
157
157
|
}
|
|
@@ -41,7 +41,7 @@ const MORPH_OPTIONS = ['byObject', 'byWord', 'byChar'];
|
|
|
41
41
|
*/
|
|
42
42
|
export function formatConvertProgress(completed, total) {
|
|
43
43
|
const percent = total === 0 ? 0 : Math.floor((completed / total) * 100);
|
|
44
|
-
return
|
|
44
|
+
return `converting ${String(completed)}/${String(total)} (${String(percent)}%)`;
|
|
45
45
|
}
|
|
46
46
|
export class SlideConvertUsageError extends Error {
|
|
47
47
|
reason;
|
|
@@ -81,7 +81,7 @@ const PPTX_CONVERT_IDLE_TIMEOUT_MS = 600_000;
|
|
|
81
81
|
const THEME_PATTERN = /^[\w@/.-]+$/;
|
|
82
82
|
export function validateTheme(theme) {
|
|
83
83
|
if (!THEME_PATTERN.test(theme)) {
|
|
84
|
-
throw new SlideConvertUsageError(`--theme
|
|
84
|
+
throw new SlideConvertUsageError(`--theme accepts only [a-zA-Z0-9@/_.-]: ${theme}`, 'invalid-theme');
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -89,7 +89,7 @@ export function validateTheme(theme) {
|
|
|
89
89
|
*/
|
|
90
90
|
function throwIfCancelled(signal) {
|
|
91
91
|
if (signal?.aborted === true) {
|
|
92
|
-
throw new SlideConvertRuntimeError('
|
|
92
|
+
throw new SlideConvertRuntimeError('cancelled', 'cancelled');
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
async function ensureProjectDirectory(projectDirectory) {
|
|
@@ -98,17 +98,17 @@ async function ensureProjectDirectory(projectDirectory) {
|
|
|
98
98
|
stats = await stat(projectDirectory);
|
|
99
99
|
}
|
|
100
100
|
catch {
|
|
101
|
-
throw new SlideConvertRuntimeError(`
|
|
101
|
+
throw new SlideConvertRuntimeError(`directory not found: ${projectDirectory}`, 'project-not-found');
|
|
102
102
|
}
|
|
103
103
|
if (!stats.isDirectory()) {
|
|
104
|
-
throw new SlideConvertRuntimeError(`
|
|
104
|
+
throw new SlideConvertRuntimeError(`not a directory: ${projectDirectory}`, 'project-not-found');
|
|
105
105
|
}
|
|
106
106
|
const slidesMd = path.join(projectDirectory, 'slides.md');
|
|
107
107
|
try {
|
|
108
108
|
await stat(slidesMd);
|
|
109
109
|
}
|
|
110
110
|
catch {
|
|
111
|
-
throw new SlideConvertRuntimeError(`slides.md
|
|
111
|
+
throw new SlideConvertRuntimeError(`slides.md not found: ${slidesMd}`, 'project-not-found');
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
async function cleanBuildArtifacts(projectDirectory) {
|
|
@@ -200,15 +200,15 @@ dependencies) {
|
|
|
200
200
|
buildOptions.stderr = dependencies.stderr;
|
|
201
201
|
}
|
|
202
202
|
const buildStart = dependencies.now();
|
|
203
|
-
dependencies.onProgress?.('slidev build
|
|
203
|
+
dependencies.onProgress?.('running slidev build');
|
|
204
204
|
const buildResult = await dependencies.slidevRunner.build(projectAbs, buildOptions);
|
|
205
205
|
const slidevBuildMs = dependencies.now() - buildStart;
|
|
206
206
|
throwIfCancelled(dependencies.signal);
|
|
207
207
|
if (buildResult.timedOut) {
|
|
208
|
-
throw new SlideConvertRuntimeError(`slidev build
|
|
208
|
+
throw new SlideConvertRuntimeError(`slidev build timed out after ${String(SLIDEV_BUILD_TIMEOUT_MS)}ms: ${formatStderrTail(buildResult.stderr)}`, 'slidev-build-timeout');
|
|
209
209
|
}
|
|
210
210
|
if (didExitNonZero(buildResult)) {
|
|
211
|
-
throw new SlideConvertRuntimeError(`slidev build
|
|
211
|
+
throw new SlideConvertRuntimeError(`slidev build failed (exit ${String(buildResult.exitCode)}): ${formatStderrTail(buildResult.stderr)}`, 'slidev-build-failed');
|
|
212
212
|
}
|
|
213
213
|
// in-process pipeline は skipPostprocess 指定時、staging/slides/<prefix><N>.pptx のみを出力する。
|
|
214
214
|
// Phase 2+3 は skip する。
|
|
@@ -246,7 +246,7 @@ dependencies) {
|
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
// スキャンが終わるまでステップ総数は決まらないため、それまでは工程名だけを出す。
|
|
249
|
-
report?.('
|
|
249
|
+
report?.('scanning slides');
|
|
250
250
|
let pipelineResult;
|
|
251
251
|
const pipelineStart = dependencies.now();
|
|
252
252
|
try {
|
|
@@ -255,28 +255,28 @@ dependencies) {
|
|
|
255
255
|
catch (error) {
|
|
256
256
|
throwIfCancelled(dependencies.signal);
|
|
257
257
|
if (error instanceof PipelineTimeoutError) {
|
|
258
|
-
throw withPipelineDiagnostics(new SlideConvertRuntimeError(`pptx convert
|
|
258
|
+
throw withPipelineDiagnostics(new SlideConvertRuntimeError(`pptx convert timed out: ${error.message}`, 'pptx-convert-timeout'), { warnings: error.warnings, errors: error.errors });
|
|
259
259
|
}
|
|
260
260
|
// InProcessSlidevPptxPipeline.convert() が throw するのは、PipelineTimeoutError か PipelineRuntimeError のみ。
|
|
261
261
|
// これは二重 wrap 防止と、内部例外の wrap 済を前提にした契約。
|
|
262
262
|
// それ以外のルートは無いため、ここでは PipelineRuntimeError として処理する。
|
|
263
263
|
if (error instanceof PipelineRuntimeError) {
|
|
264
|
-
throw withPipelineDiagnostics(new SlideConvertRuntimeError(`pptx convert
|
|
264
|
+
throw withPipelineDiagnostics(new SlideConvertRuntimeError(`pptx convert failed: ${error.message}`, 'pptx-convert-failed'), { warnings: error.warnings, errors: error.errors });
|
|
265
265
|
}
|
|
266
266
|
/* c8 ignore start -- defensive: SlidevPptxPipeline 契約上、上 2 例外型以外は到達不能。test fake が直 throw した場合の最終 net。 */
|
|
267
|
-
throw new SlideConvertRuntimeError(`pptx convert
|
|
267
|
+
throw new SlideConvertRuntimeError(`pptx convert failed: ${formatError(error)}`, 'pptx-convert-failed');
|
|
268
268
|
/* c8 ignore stop */
|
|
269
269
|
}
|
|
270
270
|
// pipeline がキャンセルに間に合わず完走した場合も、PPTX は書き出さない。
|
|
271
271
|
throwIfCancelled(dependencies.signal);
|
|
272
272
|
const mergeStart = dependencies.now();
|
|
273
273
|
const pipelineMs = mergeStart - pipelineStart;
|
|
274
|
-
report?.('PPTX
|
|
274
|
+
report?.('merging PPTX');
|
|
275
275
|
// pipeline が完走している以降の失敗でも、pipeline が積んだ警告・エラーは失われないよう
|
|
276
276
|
// catch で error へ引き継ぐ。
|
|
277
277
|
try {
|
|
278
278
|
if (!pipelineResult.success) {
|
|
279
|
-
throw new SlideConvertRuntimeError(`pptx convert
|
|
279
|
+
throw new SlideConvertRuntimeError(`pptx convert failed: ${formatPipelineErrors(pipelineResult.errors)}`, 'pptx-convert-failed');
|
|
280
280
|
}
|
|
281
281
|
// staging/slides/<prefix><N>.pptx 群を読み込み、TS 側 merge ロジックで結合する。
|
|
282
282
|
// staging から letter-spacing.json / href-map.json を auto-detect (priority: flag > staging > empty)。
|
|
@@ -321,7 +321,7 @@ dependencies) {
|
|
|
321
321
|
// wrap しないと reason が unknown になり、利用者が原因を特定できない。
|
|
322
322
|
const converted = error instanceof SlideConvertRuntimeError
|
|
323
323
|
? error
|
|
324
|
-
: new SlideConvertRuntimeError(`PPTX
|
|
324
|
+
: new SlideConvertRuntimeError(`PPTX generation failed: ${formatError(error)}`, 'merge-failed');
|
|
325
325
|
throw withPipelineDiagnostics(converted, {
|
|
326
326
|
warnings: pipelineResult.warnings,
|
|
327
327
|
errors: pipelineResult.errors,
|
|
@@ -366,7 +366,7 @@ async function readSidecarObject(sourcePath, label) {
|
|
|
366
366
|
text = await readFile(sourcePath, 'utf8');
|
|
367
367
|
}
|
|
368
368
|
catch (error) {
|
|
369
|
-
throw new SlideConvertRuntimeError(
|
|
369
|
+
throw new SlideConvertRuntimeError(`cannot read ${label}: ${sourcePath}: ${formatError(error)}`, 'invalid-staging-json');
|
|
370
370
|
}
|
|
371
371
|
let raw;
|
|
372
372
|
try {
|
|
@@ -374,10 +374,10 @@ async function readSidecarObject(sourcePath, label) {
|
|
|
374
374
|
raw = JSON.parse(text);
|
|
375
375
|
}
|
|
376
376
|
catch (error) {
|
|
377
|
-
throw new SlideConvertRuntimeError(
|
|
377
|
+
throw new SlideConvertRuntimeError(`cannot parse ${label}: ${sourcePath}: ${formatError(error)}`, 'invalid-staging-json');
|
|
378
378
|
}
|
|
379
379
|
if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
|
|
380
|
-
throw new SlideConvertRuntimeError(`${label}
|
|
380
|
+
throw new SlideConvertRuntimeError(`${label} must be a plain object: ${sourcePath}`, 'invalid-staging-json');
|
|
381
381
|
}
|
|
382
382
|
// eslint-disable-next-line no-restricted-syntax -- 直前の type guard 後の narrowing
|
|
383
383
|
return raw;
|
|
@@ -394,14 +394,14 @@ async function resolveLetterSpacingMap(flagPath, stagingPath) {
|
|
|
394
394
|
const map = new Map();
|
|
395
395
|
for (const [key, value] of Object.entries(raw)) {
|
|
396
396
|
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
397
|
-
throw new SlideConvertRuntimeError(`letter-spacing JSON
|
|
397
|
+
throw new SlideConvertRuntimeError(`letter-spacing JSON entry must be an object: ${key}`, 'invalid-staging-json');
|
|
398
398
|
}
|
|
399
399
|
// eslint-disable-next-line no-restricted-syntax -- entry value narrowing
|
|
400
400
|
const entry = value;
|
|
401
401
|
const letterSpacing = entry['letterSpacing'];
|
|
402
402
|
const fontSize = entry['fontSize'];
|
|
403
403
|
if (typeof letterSpacing !== 'string' || typeof fontSize !== 'string') {
|
|
404
|
-
throw new SlideConvertRuntimeError(`letter-spacing JSON
|
|
404
|
+
throw new SlideConvertRuntimeError(`letter-spacing JSON entry must be { letterSpacing: string, fontSize: string }: ${key}`, 'invalid-staging-json');
|
|
405
405
|
}
|
|
406
406
|
map.set(key, { letterSpacing, fontSize });
|
|
407
407
|
}
|
|
@@ -419,7 +419,7 @@ async function resolveHrefMap(flagPath, stagingPath) {
|
|
|
419
419
|
const map = new Map();
|
|
420
420
|
for (const [key, value] of Object.entries(raw)) {
|
|
421
421
|
if (typeof value !== 'string') {
|
|
422
|
-
throw new SlideConvertRuntimeError(`href JSON
|
|
422
|
+
throw new SlideConvertRuntimeError(`href JSON entry must be a string: ${key}`, 'invalid-staging-json');
|
|
423
423
|
}
|
|
424
424
|
map.set(key, value);
|
|
425
425
|
}
|
|
@@ -444,17 +444,17 @@ async function resolveKeepTimingSteps(stagingPath) {
|
|
|
444
444
|
const raw = await readSidecarObject(sourcePath, 'animation-policy JSON');
|
|
445
445
|
const schemaVersion = raw['schemaVersion'];
|
|
446
446
|
if (schemaVersion !== ANIMATION_POLICY_SCHEMA_VERSION) {
|
|
447
|
-
const mismatch =
|
|
448
|
-
throw new SlideConvertRuntimeError(`animation-policy JSON
|
|
447
|
+
const mismatch = `expected ${String(ANIMATION_POLICY_SCHEMA_VERSION)}, got ${String(schemaVersion)}, path ${sourcePath}`;
|
|
448
|
+
throw new SlideConvertRuntimeError(`animation-policy JSON schemaVersion mismatch: ${mismatch}`, 'invalid-staging-json');
|
|
449
449
|
}
|
|
450
450
|
const steps = raw['keepTimingSteps'];
|
|
451
451
|
if (!Array.isArray(steps)) {
|
|
452
|
-
throw new SlideConvertRuntimeError(`animation-policy JSON
|
|
452
|
+
throw new SlideConvertRuntimeError(`animation-policy JSON keepTimingSteps must be an array: ${sourcePath}`, 'invalid-staging-json');
|
|
453
453
|
}
|
|
454
454
|
const result = new Set();
|
|
455
455
|
for (const step of steps) {
|
|
456
456
|
if (typeof step !== 'number' || !Number.isSafeInteger(step)) {
|
|
457
|
-
throw new SlideConvertRuntimeError(`animation-policy JSON
|
|
457
|
+
throw new SlideConvertRuntimeError(`animation-policy JSON keepTimingSteps must be an array of integers: ${sourcePath}`, 'invalid-staging-json');
|
|
458
458
|
}
|
|
459
459
|
result.add(step);
|
|
460
460
|
}
|
|
@@ -495,7 +495,7 @@ dependencies) {
|
|
|
495
495
|
const slidesDirectory = path.join(stagingDirectory, 'slides');
|
|
496
496
|
const { inputs, originalSlideNumbers } = await loadSingleSlidePptxes(slidesDirectory, dependencies.archive);
|
|
497
497
|
if (inputs.length === 0) {
|
|
498
|
-
throw new SlideConvertRuntimeError(`pptx convert
|
|
498
|
+
throw new SlideConvertRuntimeError(`pptx convert reported success but no slide-<N>.pptx exists in ${slidesDirectory}`, 'pptx-convert-failed');
|
|
499
499
|
}
|
|
500
500
|
let merged;
|
|
501
501
|
try {
|
|
@@ -503,7 +503,7 @@ dependencies) {
|
|
|
503
503
|
}
|
|
504
504
|
/* c8 ignore start -- mergePptxFiles 内部の throw は事前に inputs.length>0 で防御済 */
|
|
505
505
|
catch (error) {
|
|
506
|
-
throw new SlideConvertRuntimeError(`PPTX merge
|
|
506
|
+
throw new SlideConvertRuntimeError(`PPTX merge failed: ${formatError(error)}`, 'merge-failed');
|
|
507
507
|
}
|
|
508
508
|
/* c8 ignore stop */
|
|
509
509
|
// mergePptxFiles の戻り値は、フラットな配列 (slide / rels / その他)。
|
|
@@ -707,10 +707,10 @@ function formatCacheSummary(cache) {
|
|
|
707
707
|
const missSteps = cache.perStep.filter(entry => entry.cache === 'miss');
|
|
708
708
|
const hitCount = cache.perStep.length - missSteps.length;
|
|
709
709
|
if (missSteps.length === 0) {
|
|
710
|
-
return `${summaryLine}cache steps: ${String(hitCount)}
|
|
710
|
+
return `${summaryLine}cache steps: ${String(hitCount)} hit\n`;
|
|
711
711
|
}
|
|
712
712
|
const missList = missSteps.map(entry => `#${entry.key}`).join(', ');
|
|
713
|
-
const hitSuffix = hitCount === 0 ? '' : ` (
|
|
713
|
+
const hitSuffix = hitCount === 0 ? '' : ` (${String(hitCount)} more hit)`;
|
|
714
714
|
return `${summaryLine}cache steps: miss ${missList}${hitSuffix}\n`;
|
|
715
715
|
}
|
|
716
716
|
function doesArgvWantJson(argv) {
|
|
@@ -742,7 +742,7 @@ stderr) {
|
|
|
742
742
|
// slides.md 不在 (ENOENT) は basename fallback の正常系のため警告しない。
|
|
743
743
|
// それ以外の読取失敗 (permission 等) は診断を stderr に残す (stdout の JSON イベント契約を汚さない)。
|
|
744
744
|
if (error.code !== 'ENOENT') {
|
|
745
|
-
createDiagnostics(stderr).warning(`slides.md
|
|
745
|
+
createDiagnostics(stderr).warning(`cannot read slides.md; deriving the default output name from the basename`
|
|
746
746
|
+ ` (${slidesPath}): ${error.message}`);
|
|
747
747
|
}
|
|
748
748
|
});
|
|
@@ -814,18 +814,18 @@ function buildConvertDoneData(summary) {
|
|
|
814
814
|
}
|
|
815
815
|
export function createSlideConvertCommand(buildDependencies) {
|
|
816
816
|
const command = new Command('convert')
|
|
817
|
-
.description('Slidev
|
|
818
|
-
.argument('<project-dir>', 'Slidev
|
|
819
|
-
.option('--out <path>', 'output .pptx path (
|
|
820
|
-
.option('--theme <name>', 'slidev
|
|
821
|
-
.option('--spacing-json <path>', 'letter-spacing JSON path (
|
|
822
|
-
.option('--href-json <path>', 'hyperlink JSON path (
|
|
823
|
-
.option('--transition-type <type>', 'transition
|
|
824
|
-
.option('--transition-duration-ms <ms>', 'transition
|
|
817
|
+
.description('convert a Slidev project to PPTX')
|
|
818
|
+
.argument('<project-dir>', 'Slidev project directory')
|
|
819
|
+
.option('--out <path>', 'output .pptx path (default: <project-dir>/pptx/<slides.md title | basename>.pptx)')
|
|
820
|
+
.option('--theme <name>', 'name passed to slidev --theme (allowed characters: [a-zA-Z0-9@/_.-])')
|
|
821
|
+
.option('--spacing-json <path>', 'letter-spacing JSON path (default: auto-detect staging/slides/letter-spacing.json)')
|
|
822
|
+
.option('--href-json <path>', 'hyperlink JSON path (default: auto-detect staging/slides/href-map.json)')
|
|
823
|
+
.option('--transition-type <type>', 'transition type (fade|morph)')
|
|
824
|
+
.option('--transition-duration-ms <ms>', 'transition duration (ms)')
|
|
825
825
|
.option('--morph-option <option>', 'morph option (byObject|byWord|byChar)')
|
|
826
|
-
.option('--no-cache', '
|
|
827
|
-
.option('--no-single-pass', '
|
|
828
|
-
.addOption(new Option('--log-level <level>', '
|
|
826
|
+
.option('--no-cache', 'convert all slides without reading the cache (the cache is rebuilt on completion)')
|
|
827
|
+
.option('--no-single-pass', 'convert with the per-step route that opens a page for each slide step, not the single-pass route')
|
|
828
|
+
.addOption(new Option('--log-level <level>', 'progress detail (verbose and debug write progress to stderr)').choices(['normal', 'verbose', 'debug']))
|
|
829
829
|
.option('--json', 'emit machine-readable progress on stdout', false)
|
|
830
830
|
.exitOverride()
|
|
831
831
|
.configureOutput({
|
|
@@ -926,8 +926,8 @@ export function createSlideConvertCommand(buildDependencies) {
|
|
|
926
926
|
+ ` (${String(Math.round(summary.durationMs))}ms)`);
|
|
927
927
|
// 0 件のときは出さない(除去が起きなかった run で行数を増やさない)。
|
|
928
928
|
if (summary.animationTimingRemovedSlides > 0) {
|
|
929
|
-
writeData(dependencies.stdout, `animation: ${String(summary.animationTimingRemovedSlides)}
|
|
930
|
-
+ `
|
|
929
|
+
writeData(dependencies.stdout, `animation: removed p:timing from ${String(summary.animationTimingRemovedSlides)} slides`
|
|
930
|
+
+ ` (slides with an explicit setting are kept)`);
|
|
931
931
|
}
|
|
932
932
|
if (summary.cache !== undefined) {
|
|
933
933
|
writeData(dependencies.stdout, formatCacheSummary(summary.cache));
|
|
@@ -978,7 +978,7 @@ function optionalTransitionType(raw, key) {
|
|
|
978
978
|
if (value === undefined)
|
|
979
979
|
return undefined;
|
|
980
980
|
if (!isTransitionType(value)) {
|
|
981
|
-
throw new SlideConvertUsageError(`option --${kebab(key)}
|
|
981
|
+
throw new SlideConvertUsageError(`option --${kebab(key)} accepts only ${TRANSITION_TYPES.join('|')}: ${value}`, 'invalid-transition-type');
|
|
982
982
|
}
|
|
983
983
|
return value;
|
|
984
984
|
}
|
|
@@ -987,7 +987,7 @@ function optionalMorphOption(raw, key) {
|
|
|
987
987
|
if (value === undefined)
|
|
988
988
|
return undefined;
|
|
989
989
|
if (!isMorphOption(value)) {
|
|
990
|
-
throw new SlideConvertUsageError(`option --${kebab(key)}
|
|
990
|
+
throw new SlideConvertUsageError(`option --${kebab(key)} accepts only ${MORPH_OPTIONS.join('|')}: ${value}`, 'invalid-morph-option');
|
|
991
991
|
}
|
|
992
992
|
return value;
|
|
993
993
|
}
|
|
@@ -997,7 +997,7 @@ function optionalPositiveInt(raw, key, reason) {
|
|
|
997
997
|
return undefined;
|
|
998
998
|
const parsed = Math.trunc(Number(value));
|
|
999
999
|
if (!Number.isFinite(parsed) || parsed <= 0 || String(parsed) !== value.trim()) {
|
|
1000
|
-
throw new SlideConvertUsageError(`option --${kebab(key)}
|
|
1000
|
+
throw new SlideConvertUsageError(`option --${kebab(key)} must be a positive integer: ${value}`, reason);
|
|
1001
1001
|
}
|
|
1002
1002
|
return parsed;
|
|
1003
1003
|
}
|
|
@@ -18,7 +18,7 @@ export async function collectTextViolations(items, lintText) {
|
|
|
18
18
|
違反を人が読む形に整える。
|
|
19
19
|
*/
|
|
20
20
|
export function formatTextViolations(violations) {
|
|
21
|
-
const lines = violations.map(violation => ` - ${violation.item}: ${violation.message}
|
|
22
|
-
return
|
|
21
|
+
const lines = violations.map(violation => ` - ${violation.item}: ${violation.message} (${violation.ruleId})`);
|
|
22
|
+
return `${violations.length.toString()} text violation(s)\n${lines.join('\n')}`;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=text-check.js.map
|
|
@@ -145,7 +145,7 @@ PDF の用紙寸法に使う。属性が無い・px 以外の単位 (%, pt, mm
|
|
|
145
145
|
export function readSvgPixelSize(svg) {
|
|
146
146
|
const match = ROOT_SVG_TAG_REGEX.exec(svg);
|
|
147
147
|
if (match === null) {
|
|
148
|
-
throw new Error('
|
|
148
|
+
throw new Error('no SVG root element in the exported content');
|
|
149
149
|
}
|
|
150
150
|
return {
|
|
151
151
|
width: readPixelAttribute(match[0], 'width'),
|
|
@@ -156,12 +156,12 @@ function readPixelAttribute(tag, name) {
|
|
|
156
156
|
const attribute = (name === 'width' ? WIDTH_ATTRIBUTE_REGEX : HEIGHT_ATTRIBUTE_REGEX).exec(tag);
|
|
157
157
|
const raw = attribute?.groups?.['value'];
|
|
158
158
|
if (raw === undefined) {
|
|
159
|
-
throw new Error(`SVG
|
|
159
|
+
throw new Error(`SVG root element has no ${name} attribute`);
|
|
160
160
|
}
|
|
161
161
|
const pixel = PIXEL_LENGTH_REGEX.exec(raw.trim())?.groups?.['number'];
|
|
162
162
|
const value = pixel === undefined ? NaN : Number(pixel);
|
|
163
163
|
if (!(value > 0)) {
|
|
164
|
-
throw new Error(`SVG
|
|
164
|
+
throw new Error(`SVG root element ${name} is not a positive px value: ${raw}`);
|
|
165
165
|
}
|
|
166
166
|
return value;
|
|
167
167
|
}
|
|
@@ -186,7 +186,7 @@ export function readSourceHash(svg) {
|
|
|
186
186
|
function replaceRootSvgTag(svg, transform) {
|
|
187
187
|
const match = ROOT_SVG_TAG_REGEX.exec(svg);
|
|
188
188
|
if (match === null) {
|
|
189
|
-
throw new Error('
|
|
189
|
+
throw new Error('no SVG root element in the exported content');
|
|
190
190
|
}
|
|
191
191
|
// replacement は data URI や style 値をそのまま含むため、`$&` 等の展開が起きない
|
|
192
192
|
// 関数形式で渡す。
|
|
@@ -54,7 +54,7 @@ function expandedDocument(id, data) {
|
|
|
54
54
|
expanded = undefined;
|
|
55
55
|
}
|
|
56
56
|
if (expanded === undefined) {
|
|
57
|
-
throw new Error(
|
|
57
|
+
throw new Error(`cannot check the text: compressed diagram (id="${id}") could not be expanded`);
|
|
58
58
|
}
|
|
59
59
|
return expanded;
|
|
60
60
|
}
|