@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.
- 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 +7 -7
- package/assets/slidev/runtime/package.json +11 -11
- 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/slidev-pages-lint/package.json +1 -1
- 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/text-constraints/package.json +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/lib/schema-validator.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/schema-validator.ts +2 -2
- package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
- package/assets/slidev/scripts/eslint/validate-references/package.json +1 -1
- package/cli/dist/cli.js +11 -10
- package/cli/dist/commands/chromium/host-dependencies.js +14 -7
- package/cli/dist/commands/drawio/export.js +27 -24
- package/cli/dist/commands/drawio/theme.js +8 -8
- package/cli/dist/commands/drawio/url.js +40 -32
- package/cli/dist/commands/evidence-xlsx/create.js +19 -18
- package/cli/dist/commands/pptx-ooxml/preview.js +26 -30
- package/cli/dist/commands/slidev-project/create.js +27 -26
- package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
- package/cli/dist/commands/slidev-project/lint.js +29 -27
- package/cli/dist/commands/slidev-project/sync.js +35 -34
- package/cli/dist/commands/slidev-project/theme.js +19 -18
- package/cli/dist/commands/slidev-to-pptx/convert.d.ts +4 -0
- package/cli/dist/commands/slidev-to-pptx/convert.js +88 -75
- package/cli/dist/diagnostics.d.ts +38 -0
- package/cli/dist/diagnostics.js +46 -0
- package/cli/dist/domain/_shared/ports.d.ts +0 -1
- 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.d.ts +11 -7
- package/cli/dist/domain/drawio/url.js +67 -45
- 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/pptx-ooxml/prerender-replace.d.ts +1 -0
- package/cli/dist/domain/pptx-ooxml/prerender-replace.js +3 -3
- package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
- package/cli/dist/domain/slidev-project/generated-files.js +36 -36
- 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.d.ts +12 -84
- package/cli/dist/infra/_shared/runtime-install.js +74 -108
- 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/console-logger.d.ts +5 -5
- package/cli/dist/infra/slidev-to-pptx/console-logger.js +19 -20
- package/cli/dist/infra/slidev-to-pptx/dom-converter.d.ts +1 -1
- package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
- package/cli/dist/infra/slidev-to-pptx/index.js +1 -9
- package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +2 -2
- package/cli/dist/infra/slidev-to-pptx/pipeline.js +56 -56
- 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.d.ts +2 -1
- package/cli/dist/infra/slidev-to-pptx/server.js +3 -3
- 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 +5 -3
- 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 +47 -38
- package/cli/dist/mcp/tools/drawio.js +23 -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 +39 -37
- package/cli/dist/mcp/tools/slide-theme.js +6 -6
- package/cli/dist/mcp/tools/slide.js +52 -50
- 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 +46 -52
- package/package.json +6 -6
- package/vendor/text-rules/dist/source-hash +1 -1
|
@@ -160,7 +160,7 @@ export async function applyPrerenderImageReplace(slide, rels, partMap, entries,
|
|
|
160
160
|
highResolutionBuffer = await io.readFile(entry.imagePath);
|
|
161
161
|
}
|
|
162
162
|
catch (error) {
|
|
163
|
-
|
|
163
|
+
io.warn(`prerender image read failed: ${entry.imagePath}: ${String(error)}`);
|
|
164
164
|
continue;
|
|
165
165
|
}
|
|
166
166
|
// 1 段目: 座標 + サイズ。matchPrerenderToMedia は matched 済 mediaPart を
|
|
@@ -222,13 +222,13 @@ async function loadMeta(metaPath, io) {
|
|
|
222
222
|
return undefined;
|
|
223
223
|
}
|
|
224
224
|
if (!isRecord(parsed)) {
|
|
225
|
-
|
|
225
|
+
io.warn(`prerender meta unrecognized: ${metaPath} (not a JSON object)`);
|
|
226
226
|
return undefined;
|
|
227
227
|
}
|
|
228
228
|
const width = parsed['width'];
|
|
229
229
|
const height = parsed['height'];
|
|
230
230
|
if (typeof width !== 'number' || typeof height !== 'number') {
|
|
231
|
-
|
|
231
|
+
io.warn(`prerender meta unrecognized: ${metaPath} (width/height missing or non-numeric)`);
|
|
232
232
|
return undefined;
|
|
233
233
|
}
|
|
234
234
|
const meta = { width, height };
|
|
@@ -23,10 +23,10 @@ vite-plugin-static-copy は、talk-dir からの相対パスの先頭の `../`
|
|
|
23
23
|
function themePublicLines(themeName) {
|
|
24
24
|
return [
|
|
25
25
|
'',
|
|
26
|
-
'// talk-dir
|
|
26
|
+
'// location of the talk-dir, next to this config file.',
|
|
27
27
|
'const talkDirectory = path.dirname(fileURLToPath(import.meta.url))',
|
|
28
28
|
'',
|
|
29
|
-
'//
|
|
29
|
+
'// resolve the real path; return undefined when it is missing and leave it to the Slidev default.',
|
|
30
30
|
'function resolveRealPath(...segments: string[]): string | undefined {',
|
|
31
31
|
' try {',
|
|
32
32
|
' return realpathSync(path.join(...segments))',
|
|
@@ -36,20 +36,20 @@ function themePublicLines(themeName) {
|
|
|
36
36
|
' }',
|
|
37
37
|
'}',
|
|
38
38
|
'',
|
|
39
|
-
'// glob
|
|
39
|
+
'// make glob special characters match literally; normalize the Windows separator to /.',
|
|
40
40
|
'function escapeGlob(value: string): string {',
|
|
41
41
|
' const posixPath = path.sep === \'\\\\\' ? value.replaceAll(\'\\\\\', \'/\') : value',
|
|
42
42
|
' const specials = path.sep === \'\\\\\' ? /[()[\\]{}!+@]/gu : /[\\\\()[\\]{}!*?|+@]/gu',
|
|
43
43
|
' return posixPath.replaceAll(specials, \'\\\\$&\')',
|
|
44
44
|
'}',
|
|
45
45
|
'',
|
|
46
|
-
'//
|
|
46
|
+
'// real path of the theme and its public/.',
|
|
47
47
|
`const themeRoot = resolveRealPath(talkDirectory, 'node_modules', ${quoted(themeName)})`,
|
|
48
48
|
'const themePublic = themeRoot === undefined ? undefined : resolveRealPath(themeRoot, \'public\')',
|
|
49
49
|
'',
|
|
50
|
-
'//
|
|
51
|
-
'// optional
|
|
52
|
-
'//
|
|
50
|
+
'// names in the theme peerDependencies that resolve from node_modules of the talk-dir.',
|
|
51
|
+
'// optional ones are excluded; Vite resolves dedupe names from the root only and fails to start when one is not found.',
|
|
52
|
+
'// return an empty list when the file is unreadable or not JSON, so loading the config does not stop.',
|
|
53
53
|
'function readThemePeers(): string[] {',
|
|
54
54
|
' if (themeRoot === undefined) return []',
|
|
55
55
|
' try {',
|
|
@@ -68,7 +68,7 @@ function themePublicLines(themeName) {
|
|
|
68
68
|
'',
|
|
69
69
|
'const themePeers = readThemePeers()',
|
|
70
70
|
'',
|
|
71
|
-
'// talk-dir
|
|
71
|
+
'// number of segments from the talk-dir to the theme public/ (leading ../ are not counted).',
|
|
72
72
|
'const themePublicDepth = themePublic === undefined',
|
|
73
73
|
' ? 0',
|
|
74
74
|
' : path.relative(talkDirectory, themePublic).split(/[\\\\/]/u).filter(segment => segment !== \'..\').length',
|
|
@@ -87,9 +87,9 @@ function themePublicLines(themeName) {
|
|
|
87
87
|
' },',
|
|
88
88
|
' }',
|
|
89
89
|
'',
|
|
90
|
-
'//
|
|
91
|
-
'// node_modules
|
|
92
|
-
'// talk-dir
|
|
90
|
+
'// transform theme layouts, components and styles in the warmup at dev start.',
|
|
91
|
+
'// Vite ignores globs under node_modules, so write them with the real path of the theme.',
|
|
92
|
+
'// files of the same name on the talk-dir side override the theme and belong to the user, so list them with relative globs.',
|
|
93
93
|
'const themeServer = themeRoot === undefined',
|
|
94
94
|
' ? {}',
|
|
95
95
|
' : {',
|
|
@@ -108,7 +108,7 @@ function themePublicLines(themeName) {
|
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
`vite.config.ts` の中身。
|
|
111
|
-
|
|
111
|
+
中身は 1 行 1 要素の配列で組み立てる。
|
|
112
112
|
*/
|
|
113
113
|
export function viteConfigSource(options) {
|
|
114
114
|
const themeName = options.themeName;
|
|
@@ -124,41 +124,41 @@ export function viteConfigSource(options) {
|
|
|
124
124
|
const slidevLines = themeName === undefined
|
|
125
125
|
? []
|
|
126
126
|
: [
|
|
127
|
-
' //
|
|
127
|
+
' // serve the theme public/ at /theme/.',
|
|
128
128
|
' slidev: themeStaticCopy,',
|
|
129
129
|
];
|
|
130
130
|
const serverSpread = themeName === undefined ? [] : [' ...themeServer,'];
|
|
131
131
|
return [
|
|
132
|
-
'//
|
|
133
|
-
'// Vite
|
|
132
|
+
'// generated by pecotv; rewritten when pecotv is updated.',
|
|
133
|
+
'// put extra Vite settings in setup/vite-plugins.ts.',
|
|
134
134
|
'/// <reference types="@slidev/types" />',
|
|
135
135
|
...importLines,
|
|
136
136
|
'import { defineConfig } from \'vite\'',
|
|
137
137
|
...themeLines,
|
|
138
138
|
'',
|
|
139
139
|
'export default defineConfig({',
|
|
140
|
-
' //
|
|
141
|
-
' // node_modules/.vite
|
|
140
|
+
' // keep the cache inside the talk-dir.',
|
|
141
|
+
' // sharing node_modules/.vite causes conflicts.',
|
|
142
142
|
' cacheDir: \'./.vite\',',
|
|
143
143
|
' resolve: {',
|
|
144
|
-
' // node_modules
|
|
145
|
-
' // Vite
|
|
144
|
+
' // node_modules and the theme are linked with symlinks.',
|
|
145
|
+
' // with the Vite default (false), scoped CSS of Vue files behind a symlink is left out of the build.',
|
|
146
146
|
' preserveSymlinks: true,',
|
|
147
|
-
' //
|
|
147
|
+
' // dedupe the theme peerDependencies to the single copy of the main package.',
|
|
148
148
|
dedupeLine,
|
|
149
149
|
' },',
|
|
150
150
|
...slidevLines,
|
|
151
151
|
' server: {',
|
|
152
152
|
...serverSpread,
|
|
153
|
-
' // dev
|
|
154
|
-
' //
|
|
153
|
+
' // keep the browser from using stale transform results after the dev server restarts.',
|
|
154
|
+
' // with stale results, CSS outside the allow list is rejected with 403 and the preview stays blank.',
|
|
155
155
|
' headers: { \'Cache-Control\': \'no-cache\' },',
|
|
156
156
|
' },',
|
|
157
157
|
' define: {',
|
|
158
|
-
' // pecotv
|
|
159
|
-
' //
|
|
160
|
-
' // Slidev
|
|
161
|
-
' //
|
|
158
|
+
' // pecotv slide convert loads the print page once and converts all pages.',
|
|
159
|
+
' // this setting puts the print route into the built SPA.',
|
|
160
|
+
' // it is a Slidev-internal define, not a public API.',
|
|
161
|
+
' // when this flag has no effect on a build, pecotv warns and converts the old way.',
|
|
162
162
|
' __SLIDEV_FEATURE_PRINT__: \'true\',',
|
|
163
163
|
' },',
|
|
164
164
|
'})',
|
|
@@ -173,14 +173,14 @@ export const START_SCRIPT_SOURCE = [
|
|
|
173
173
|
'#!/usr/bin/env node',
|
|
174
174
|
'',
|
|
175
175
|
'/**',
|
|
176
|
-
' * OS
|
|
176
|
+
' * OS-independent Slidev start script (generated by pecotv).',
|
|
177
177
|
' *',
|
|
178
|
-
' * MCP
|
|
179
|
-
' *
|
|
180
|
-
' *
|
|
181
|
-
' * node_modules
|
|
182
|
-
' *
|
|
183
|
-
' * Slidev
|
|
178
|
+
' * A way to preview manually in environments that do not use MCP.',
|
|
179
|
+
' * It targets editors and plain terminals that have not registered the pecot-visual server.',
|
|
180
|
+
' * The directory of this script is the working root.',
|
|
181
|
+
' * node_modules is prepared by pecotv slide create and pecotv slide sync.',
|
|
182
|
+
' * When it is missing, the script points to sync and exits.',
|
|
183
|
+
' * It starts the Slidev bin directly with node.',
|
|
184
184
|
' */',
|
|
185
185
|
'',
|
|
186
186
|
'import { fileURLToPath } from \'node:url\'',
|
|
@@ -194,8 +194,8 @@ export const START_SCRIPT_SOURCE = [
|
|
|
194
194
|
'const slidevBin = join(__dirname, \'node_modules\', \'@slidev\', \'cli\', \'bin\', \'slidev.mjs\')',
|
|
195
195
|
'',
|
|
196
196
|
'if (!existsSync(slidevBin)) {',
|
|
197
|
-
' console.error(\'@slidev/cli not found at \' + slidevBin + \'.\')',
|
|
198
|
-
' console.error(\'pecotv slide sync --dir \' + __dirname + \' --node-modules-only
|
|
197
|
+
' console.error(\'error: @slidev/cli not found at \' + slidevBin + \'.\')',
|
|
198
|
+
' console.error(\' run pecotv slide sync --dir \' + __dirname + \' --node-modules-only\')',
|
|
199
199
|
' process.exit(1)',
|
|
200
200
|
'}',
|
|
201
201
|
'',
|
|
@@ -211,7 +211,7 @@ export const START_SCRIPT_SOURCE = [
|
|
|
211
211
|
'})',
|
|
212
212
|
'',
|
|
213
213
|
'slidev.on(\'error\', (error) => {',
|
|
214
|
-
' console.error(\'Failed to start Slidev:\', error)',
|
|
214
|
+
' console.error(\'error: Failed to start Slidev:\', error)',
|
|
215
215
|
' process.exit(1)',
|
|
216
216
|
'})',
|
|
217
217
|
'',
|
|
@@ -31,7 +31,7 @@ export async function buildInitialPages(references, files) {
|
|
|
31
31
|
const usable = references.filter((entry) => {
|
|
32
32
|
const isUsable = PAGE_STEM.test(entry.name);
|
|
33
33
|
if (!isUsable)
|
|
34
|
-
warnings.push(
|
|
34
|
+
warnings.push(`layout name cannot be used as a page file name, so it is left out of the initial pages: ${entry.name}`);
|
|
35
35
|
return isUsable;
|
|
36
36
|
});
|
|
37
37
|
const sorted = usable.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
@@ -56,15 +56,15 @@ export async function buildInitialPages(references, files) {
|
|
|
56
56
|
if (first === undefined) {
|
|
57
57
|
return {
|
|
58
58
|
pages: [],
|
|
59
|
-
warnings: [...warnings, '
|
|
59
|
+
warnings: [...warnings, 'the theme has no layouts, so no initial page was created (fix: check layouts/ in the theme)'],
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
return {
|
|
63
63
|
pages: [{ filename: `${first.name}.md`, content: `---\nlayout: ${first.name}\n---\n` }],
|
|
64
64
|
warnings: [
|
|
65
65
|
...warnings,
|
|
66
|
-
|
|
67
|
-
+ '
|
|
66
|
+
`the theme reference has no examples, so the initial page has only layout: ${first.name}; `
|
|
67
|
+
+ 'add examples to references/ in the theme to create initial pages with a skeleton',
|
|
68
68
|
],
|
|
69
69
|
};
|
|
70
70
|
}
|
|
@@ -37,19 +37,19 @@ talk-dir マーカー検証。振り分けは domain/slidev-project/sync.ts の
|
|
|
37
37
|
*/
|
|
38
38
|
export async function assertTalkDirectory(directory, fs) {
|
|
39
39
|
if (!path.isAbsolute(directory)) {
|
|
40
|
-
throw new SlideLintUsageError(`--dir
|
|
40
|
+
throw new SlideLintUsageError(`--dir must be an absolute path: ${directory}`, 'relative-dir');
|
|
41
41
|
}
|
|
42
42
|
const info = await fs.talkDirectoryExists(directory);
|
|
43
43
|
if (!info.exists) {
|
|
44
|
-
throw new SlideLintRuntimeError(`
|
|
44
|
+
throw new SlideLintRuntimeError(`directory not found: ${directory}`, 'dir-not-found');
|
|
45
45
|
}
|
|
46
46
|
if (!info.isDirectory) {
|
|
47
|
-
throw new SlideLintRuntimeError(`
|
|
47
|
+
throw new SlideLintRuntimeError(`not a directory: ${directory}`, 'not-a-directory');
|
|
48
48
|
}
|
|
49
49
|
const hasSlidesMd = await fs.doesSlidesMdExist(directory);
|
|
50
50
|
if (!hasSlidesMd) {
|
|
51
|
-
throw new SlideLintRuntimeError(`
|
|
52
|
-
+ ' pecotv slide create
|
|
51
|
+
throw new SlideLintRuntimeError(`not a talk-dir (no slides.md): ${directory}; `
|
|
52
|
+
+ 'specify a talk-dir created by pecotv slide create', 'not-talk-dir');
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
@@ -71,13 +71,13 @@ export async function runSlideLint(options, dependencies) {
|
|
|
71
71
|
});
|
|
72
72
|
// timedOut 時も SIGTERM で exitCode は null になるため、起動失敗より先に判定する。
|
|
73
73
|
if (result.timedOut) {
|
|
74
|
-
throw new SlideLintRuntimeError(`eslint
|
|
74
|
+
throw new SlideLintRuntimeError(`eslint did not finish in time: ${summarizeStderr(result.stderr)}`, 'eslint-timeout');
|
|
75
75
|
}
|
|
76
76
|
if (result.exitCode === null) {
|
|
77
|
-
throw new SlideLintRuntimeError(`eslint
|
|
77
|
+
throw new SlideLintRuntimeError(`eslint failed to start: ${summarizeStderr(result.stderr)}`, 'eslint-not-launched');
|
|
78
78
|
}
|
|
79
79
|
if (result.exitCode !== 0 && result.exitCode !== 1) {
|
|
80
|
-
throw new SlideLintRuntimeError(`eslint
|
|
80
|
+
throw new SlideLintRuntimeError(`eslint exited abnormally (exit ${String(result.exitCode)}): ${summarizeStderr(result.stderr)}`, 'eslint-failed');
|
|
81
81
|
}
|
|
82
82
|
// eslint が辿れなかった symlink dir の検出は lint 結果と独立。走査失敗以外で
|
|
83
83
|
// outcome / exit code を動かさないため、集計の外側で合流させる。
|
|
@@ -90,10 +90,10 @@ function parseEslintReport(stdout) {
|
|
|
90
90
|
parsed = JSON.parse(stdout);
|
|
91
91
|
}
|
|
92
92
|
catch (error) {
|
|
93
|
-
throw new SlideLintRuntimeError(`eslint
|
|
93
|
+
throw new SlideLintRuntimeError(`cannot parse the eslint JSON output: ${formatError(error)}`, 'invalid-report');
|
|
94
94
|
}
|
|
95
95
|
if (!Array.isArray(parsed)) {
|
|
96
|
-
throw new SlideLintRuntimeError('eslint
|
|
96
|
+
throw new SlideLintRuntimeError('eslint JSON output is not an array', 'invalid-report');
|
|
97
97
|
}
|
|
98
98
|
// eslint-disable-next-line no-restricted-syntax -- JSON.parse 戻り値の narrowing
|
|
99
99
|
return parsed;
|
|
@@ -147,7 +147,7 @@ const STDERR_EXCERPT_LIMIT = 400;
|
|
|
147
147
|
function summarizeStderr(stderr) {
|
|
148
148
|
const trimmed = stderr.trim();
|
|
149
149
|
if (trimmed === '')
|
|
150
|
-
return '(stderr
|
|
150
|
+
return '(no stderr)';
|
|
151
151
|
if (trimmed.length <= STDERR_EXCERPT_LIMIT)
|
|
152
152
|
return trimmed;
|
|
153
153
|
return `${trimmed.slice(0, STDERR_EXCERPT_LIMIT)}...`;
|
|
@@ -39,28 +39,28 @@ talk-dir マーカー検証。
|
|
|
39
39
|
*/
|
|
40
40
|
export async function assertTalkDirectory(directory, fs) {
|
|
41
41
|
if (!path.isAbsolute(directory)) {
|
|
42
|
-
throw new SlideSyncUsageError(`--dir
|
|
42
|
+
throw new SlideSyncUsageError(`--dir must be an absolute path: ${directory}`, 'relative-dir');
|
|
43
43
|
}
|
|
44
44
|
const info = await fs.talkDirectoryExists(directory);
|
|
45
45
|
if (!info.exists) {
|
|
46
|
-
throw new SlideSyncRuntimeError(`
|
|
46
|
+
throw new SlideSyncRuntimeError(`directory not found: ${directory}`, 'dir-not-found');
|
|
47
47
|
}
|
|
48
48
|
if (!info.isDirectory) {
|
|
49
|
-
throw new SlideSyncRuntimeError(`
|
|
49
|
+
throw new SlideSyncRuntimeError(`not a directory: ${directory}`, 'not-a-directory');
|
|
50
50
|
}
|
|
51
51
|
const hasSlidesMd = await fs.doesSlidesMdExist(directory);
|
|
52
52
|
if (!hasSlidesMd) {
|
|
53
|
-
throw new SlideSyncRuntimeError(`
|
|
54
|
-
+ ' pecotv slide create
|
|
53
|
+
throw new SlideSyncRuntimeError(`not a talk-dir (no slides.md): ${directory}; `
|
|
54
|
+
+ 'specify a talk-dir created by pecotv slide create', 'not-talk-dir');
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
function themeRequiredMessage(directory) {
|
|
58
|
-
return `${directory}
|
|
58
|
+
return `${directory} is a talk-dir from before migration that does not reference a theme; specify the theme to migrate to: `
|
|
59
59
|
+ `slide sync --dir ${directory} --theme <theme-spec>`
|
|
60
|
-
+
|
|
60
|
+
+ ` (MCP: slide_sync with dir: ${directory}, theme: <theme-spec>)`;
|
|
61
61
|
}
|
|
62
|
-
const IGNORED_THEME_WARNING = '--theme
|
|
63
|
-
+ '
|
|
62
|
+
const IGNORED_THEME_WARNING = '--theme was not used because this talk-dir already references a theme; '
|
|
63
|
+
+ 'to change the theme or its version, edit the dependency in package.json and run sync';
|
|
64
64
|
/**
|
|
65
65
|
sync の工程。talk-dir を 3 通りに分けて進める。
|
|
66
66
|
|
|
@@ -81,8 +81,8 @@ export async function runSlideSync(options, dependencies) {
|
|
|
81
81
|
await assertTalkDirectory(options.directory, dependencies.fs);
|
|
82
82
|
if (options.nodeModulesOnly) {
|
|
83
83
|
if (options.theme !== undefined) {
|
|
84
|
-
throw new SlideSyncUsageError('--node-modules-only
|
|
85
|
-
+ '
|
|
84
|
+
throw new SlideSyncUsageError('--node-modules-only and --theme cannot be used together; '
|
|
85
|
+
+ 'use --node-modules-only to relink node_modules only, or --theme to migrate', 'theme-with-node-modules-only');
|
|
86
86
|
}
|
|
87
87
|
return await relink(options, dependencies, []);
|
|
88
88
|
}
|
|
@@ -151,7 +151,7 @@ async function migrate(directory, themeSpec, dependencies) {
|
|
|
151
151
|
catch (error) {
|
|
152
152
|
if (error instanceof SlideSyncRuntimeError || error instanceof SlideSyncUsageError)
|
|
153
153
|
throw error;
|
|
154
|
-
throw new SlideSyncRuntimeError(
|
|
154
|
+
throw new SlideSyncRuntimeError(`migration failed: ${formatError(error)}`, 'migrate-failed');
|
|
155
155
|
}
|
|
156
156
|
let nodeModulesTarget;
|
|
157
157
|
try {
|
|
@@ -183,7 +183,7 @@ function wrapLinkError(error) {
|
|
|
183
183
|
// theme-name-mismatch など、原因の文言を持つ例外は包み直さない。
|
|
184
184
|
if (error instanceof SlideCreateRuntimeError)
|
|
185
185
|
return error;
|
|
186
|
-
return new SlideSyncRuntimeError(`node_modules
|
|
186
|
+
return new SlideSyncRuntimeError(`relinking node_modules failed: ${formatError(error)}`, 'symlink-failed');
|
|
187
187
|
}
|
|
188
188
|
/* c8 ignore start -- 非 Error 例外 (string throw 等) は本実装範囲では未発生、防御網のみ */
|
|
189
189
|
function formatError(error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 利用者に伝える警告の文言。create・convert が同じ文言を使う。
|
|
2
|
-
export const LINK_COLOR_OMITTED_WARNING = 'pptx.linkColor
|
|
3
|
-
+ '
|
|
4
|
-
export const EAST_ASIAN_FONT_OMITTED_WARNING = 'pptx.eastAsianFont
|
|
5
|
-
+ '
|
|
2
|
+
export const LINK_COLOR_OMITTED_WARNING = 'pptx.linkColor is omitted, so links are not converted in the PPTX (no hyperlinks are added); '
|
|
3
|
+
+ 'to convert links, set pptx.linkColor in pecot-theme.json to 6 hex digits';
|
|
4
|
+
export const EAST_ASIAN_FONT_OMITTED_WARNING = 'pptx.eastAsianFont is omitted, so no East Asian font is written to the PPTX; '
|
|
5
|
+
+ 'to set the Japanese font, set pptx.eastAsianFont in pecot-theme.json to a font name';
|
|
6
6
|
//# sourceMappingURL=warnings.js.map
|
|
@@ -10,7 +10,7 @@ export const THEME_DECLARATION_FILE_NAME = 'pecot-theme.json';
|
|
|
10
10
|
export const SUPPORTED_SCHEMA = 1;
|
|
11
11
|
// 誤りの文言に添える、契約の節の案内。
|
|
12
12
|
const CONTRACT_FILE = 'contracts/theme-declaration.md';
|
|
13
|
-
const SHAPE_SECTION =
|
|
13
|
+
const SHAPE_SECTION = `the \`${THEME_DECLARATION_FILE_NAME}\` section of ${CONTRACT_FILE}`;
|
|
14
14
|
export class ThemeDeclarationError extends Error {
|
|
15
15
|
reason;
|
|
16
16
|
constructor(message, reason) {
|
|
@@ -35,7 +35,7 @@ const fontSizesSchema = z.object({
|
|
|
35
35
|
});
|
|
36
36
|
const pptxSchema = z.object({
|
|
37
37
|
eastAsianFont: name.optional(),
|
|
38
|
-
linkColor: z.string().regex(/^[\da-f]{6}$/iu, '6
|
|
38
|
+
linkColor: z.string().regex(/^[\da-f]{6}$/iu, 'must be 6 hex digits').optional(),
|
|
39
39
|
});
|
|
40
40
|
const lintSchema = z.object({ rules: z.record(z.string(), severity).optional() });
|
|
41
41
|
const layoutsSchema = z.object({ references: name.optional() });
|
|
@@ -62,27 +62,27 @@ JSON を読んだ unknown 値を宣言として検証し、省いた項目を既
|
|
|
62
62
|
*/
|
|
63
63
|
export function parseThemeDeclaration(raw) {
|
|
64
64
|
if (!isRecord(raw)) {
|
|
65
|
-
throw new ThemeDeclarationError(`${THEME_DECLARATION_FILE_NAME}
|
|
65
|
+
throw new ThemeDeclarationError(`${THEME_DECLARATION_FILE_NAME} must be an object (see ${SHAPE_SECTION})`, 'invalid-shape');
|
|
66
66
|
}
|
|
67
67
|
const { schema } = raw;
|
|
68
68
|
if (typeof schema === 'number' && schema !== SUPPORTED_SCHEMA) {
|
|
69
69
|
return {
|
|
70
70
|
declaration: DEFAULT_THEME_DECLARATION,
|
|
71
71
|
warnings: [
|
|
72
|
-
`${THEME_DECLARATION_FILE_NAME}
|
|
72
|
+
`${THEME_DECLARATION_FILE_NAME} schema ${String(schema)} is not supported (supported: ${String(SUPPORTED_SCHEMA)}); ignoring the declaration and continuing with the defaults`,
|
|
73
73
|
],
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
const parsed = declarationSchema.safeParse(raw);
|
|
77
77
|
if (!parsed.success) {
|
|
78
78
|
const detail = parsed.error.issues
|
|
79
|
-
.map(issue => `${issue.path.map(String).join('.') || '(
|
|
79
|
+
.map(issue => `${issue.path.map(String).join('.') || '(top level)'}: ${issue.message}`)
|
|
80
80
|
.join('; ');
|
|
81
|
-
throw new ThemeDeclarationError(
|
|
81
|
+
throw new ThemeDeclarationError(`invalid shape of ${THEME_DECLARATION_FILE_NAME}: ${detail} (see ${SHAPE_SECTION})`, 'invalid-shape');
|
|
82
82
|
}
|
|
83
83
|
const unknownRules = Object.keys(parsed.data.lint?.rules ?? {}).filter(id => !KNOWN_RULES.has(id));
|
|
84
84
|
if (unknownRules.length > 0) {
|
|
85
|
-
throw new ThemeDeclarationError(
|
|
85
|
+
throw new ThemeDeclarationError(`lint.rules in ${THEME_DECLARATION_FILE_NAME} has rules the deck lint does not have: ${unknownRules.join(', ')} (see the "lint.rules" part of ${SHAPE_SECTION})`, 'unknown-rule');
|
|
86
86
|
}
|
|
87
87
|
return { declaration: resolve(parsed.data), warnings: [] };
|
|
88
88
|
}
|
|
@@ -95,7 +95,7 @@ export async function readThemeDeclaration(files, themeRoot) {
|
|
|
95
95
|
if (text === undefined) {
|
|
96
96
|
return {
|
|
97
97
|
declaration: DEFAULT_THEME_DECLARATION,
|
|
98
|
-
warnings: [
|
|
98
|
+
warnings: [`theme ${themeRoot} has no ${THEME_DECLARATION_FILE_NAME} declaration; continuing with the defaults`],
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
let raw;
|
|
@@ -104,7 +104,7 @@ export async function readThemeDeclaration(files, themeRoot) {
|
|
|
104
104
|
}
|
|
105
105
|
catch (error) {
|
|
106
106
|
const reason = error instanceof Error ? error.message : String(error);
|
|
107
|
-
throw new ThemeDeclarationError(
|
|
107
|
+
throw new ThemeDeclarationError(`cannot read ${filePath} as JSON: ${reason} (see ${SHAPE_SECTION})`, 'invalid-shape');
|
|
108
108
|
}
|
|
109
109
|
return parseThemeDeclaration(raw);
|
|
110
110
|
}
|
|
@@ -11,7 +11,7 @@ const COMMON_FILE_NAME = '_common.yaml';
|
|
|
11
11
|
/**
|
|
12
12
|
分類を読めなかったときの復旧導線。テーマ側の宣言を直す案内を、分類まわりの警告に必ず添える。
|
|
13
13
|
*/
|
|
14
|
-
const CATEGORY_SYNC_HINT = '
|
|
14
|
+
const CATEGORY_SYNC_HINT = 'check layout_categories in references/_common.yaml of the theme';
|
|
15
15
|
function isDeclarationFile(fileName, extension) {
|
|
16
16
|
return fileName.endsWith(extension) && !fileName.startsWith('_');
|
|
17
17
|
}
|
|
@@ -27,7 +27,7 @@ warnings) {
|
|
|
27
27
|
}
|
|
28
28
|
default: {
|
|
29
29
|
if (typeof value === 'string' && value !== '') {
|
|
30
|
-
warnings.push(
|
|
30
|
+
warnings.push(`unknown status in ${fileName}: ${value}; treating it as stable`);
|
|
31
31
|
}
|
|
32
32
|
return 'stable';
|
|
33
33
|
}
|
|
@@ -97,8 +97,8 @@ export async function resolveLayoutReferences(files, options) {
|
|
|
97
97
|
*/
|
|
98
98
|
const UNCATEGORIZED_CATEGORY = {
|
|
99
99
|
id: UNCATEGORIZED,
|
|
100
|
-
label: '
|
|
101
|
-
question: `category
|
|
100
|
+
label: 'Uncategorized',
|
|
101
|
+
question: `layouts whose category is unset or unknown (${CATEGORY_SYNC_HINT})`,
|
|
102
102
|
};
|
|
103
103
|
/**
|
|
104
104
|
`layout_categories` の 1 要素を `LayoutCategory` へ写す。`id` / `label` / `question` が
|
|
@@ -119,7 +119,7 @@ function toLayoutCategory(value) {
|
|
|
119
119
|
function categoriesUnusable(commonPath, reason) {
|
|
120
120
|
return {
|
|
121
121
|
categories: [],
|
|
122
|
-
warnings: [
|
|
122
|
+
warnings: [`cannot read the layout categories (${commonPath}: ${reason}); continuing without categories (fix: ${CATEGORY_SYNC_HINT})`],
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
async function findCommonFile(files, directories) {
|
|
@@ -146,14 +146,14 @@ export async function readLayoutCategories(files, directories) {
|
|
|
146
146
|
const found = await findCommonFile(files, directories);
|
|
147
147
|
const lastDirectory = directories.at(-1) ?? '';
|
|
148
148
|
if (found === undefined) {
|
|
149
|
-
return categoriesUnusable(path.join(lastDirectory, COMMON_FILE_NAME), '
|
|
149
|
+
return categoriesUnusable(path.join(lastDirectory, COMMON_FILE_NAME), 'file not found');
|
|
150
150
|
}
|
|
151
151
|
let items;
|
|
152
152
|
try {
|
|
153
153
|
const parsed = parse(found.text);
|
|
154
154
|
const raw = isRecord(parsed) ? parsed['layout_categories'] : undefined;
|
|
155
155
|
if (!Array.isArray(raw))
|
|
156
|
-
throw new TypeError('layout_categories
|
|
156
|
+
throw new TypeError('layout_categories is not found as an array');
|
|
157
157
|
items = raw;
|
|
158
158
|
}
|
|
159
159
|
catch (error) {
|
|
@@ -178,14 +178,14 @@ export async function readLayoutCategories(files, directories) {
|
|
|
178
178
|
}
|
|
179
179
|
if (categories.length === 0) {
|
|
180
180
|
// 全滅は「分類が読めなかった」のと利用者から見て区別がつかないので、同じ 1 行に合流させる。
|
|
181
|
-
return categoriesUnusable(found.path, `layout_categories
|
|
181
|
+
return categoriesUnusable(found.path, `layout_categories has no usable item (0 of ${String(items.length)})`);
|
|
182
182
|
}
|
|
183
183
|
const warnings = [];
|
|
184
184
|
if (reserved > 0) {
|
|
185
|
-
warnings.push(`layout_categories
|
|
185
|
+
warnings.push(`ignoring reserved layout_categories id ${UNCATEGORIZED} (${String(reserved)} item(s)); ${CATEGORY_SYNC_HINT}`);
|
|
186
186
|
}
|
|
187
187
|
if (malformed > 0) {
|
|
188
|
-
warnings.push(`layout_categories
|
|
188
|
+
warnings.push(`skipped part of layout_categories (id, label or question missing: ${String(malformed)} item(s)); ${CATEGORY_SYNC_HINT}`);
|
|
189
189
|
}
|
|
190
190
|
return { categories, warnings };
|
|
191
191
|
}
|
|
@@ -86,18 +86,18 @@ export function classifyGitFailure(stderr) {
|
|
|
86
86
|
export function gitFailureAdvice(kind, spec) {
|
|
87
87
|
switch (kind) {
|
|
88
88
|
case 'connection': {
|
|
89
|
-
return
|
|
90
|
-
+ 'SSL
|
|
89
|
+
return `cannot connect to the theme source: ${spec.url} (fix: check the network and proxy; `
|
|
90
|
+
+ 'if it stops at SSL certificate verification, set git http.sslCAInfo to the CA bundle of the TLS-intercepting proxy)';
|
|
91
91
|
}
|
|
92
92
|
case 'auth': {
|
|
93
|
-
return
|
|
94
|
-
+ 'git
|
|
93
|
+
return `authentication failed for the theme source: ${spec.url} `
|
|
94
|
+
+ '(fix: set up git credentials, a credential helper or an SSH key, and retry)';
|
|
95
95
|
}
|
|
96
96
|
case 'tag': {
|
|
97
|
-
return
|
|
97
|
+
return `tag not found in the theme source ${spec.url}: ${spec.tag} (fix: check the tag name; branch names are not accepted)`;
|
|
98
98
|
}
|
|
99
99
|
case 'unknown': {
|
|
100
|
-
return
|
|
100
|
+
return `git could not fetch the theme source: ${spec.url}`;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|