@pecot/visual-mcp 1.2.0 → 1.3.1
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/README.md +35 -5
- package/assets/slidev/deck-lint.config.js +2 -2
- package/assets/slidev/deck-lint.env.config.js +2 -2
- package/assets/slidev/package.json +3 -3
- package/assets/slidev/runtime/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/layout.d.ts +2 -3
- package/cli/dist/domain/evidence-xlsx/ooxml.d.ts +1 -8
- package/cli/dist/domain/evidence-xlsx/ooxml.js +35 -24
- 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 +25 -31
- package/package.json +2 -2
- package/vendor/text-rules/dist/source-hash +1 -1
|
@@ -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\'',
|
|
@@ -195,7 +195,7 @@ export const START_SCRIPT_SOURCE = [
|
|
|
195
195
|
'',
|
|
196
196
|
'if (!existsSync(slidevBin)) {',
|
|
197
197
|
' console.error(\'error: @slidev/cli not found at \' + slidevBin + \'.\')',
|
|
198
|
-
' console.error(\' pecotv slide sync --dir \' + __dirname + \' --node-modules-only
|
|
198
|
+
' console.error(\' run pecotv slide sync --dir \' + __dirname + \' --node-modules-only\')',
|
|
199
199
|
' process.exit(1)',
|
|
200
200
|
'}',
|
|
201
201
|
'',
|
|
@@ -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
|
}
|
|
@@ -17,14 +17,14 @@ export class ThemeResolveError extends Error {
|
|
|
17
17
|
const NO_THEME = 'none';
|
|
18
18
|
// 失敗の文言に添える、復旧の案内。CLI と MCP のどちらから呼ばれても読めるよう、両方の手順を 1 か所で持つ。
|
|
19
19
|
function relinkAdvice(talkDirectory) {
|
|
20
|
-
return `slide sync --dir ${talkDirectory} --node-modules-only
|
|
21
|
-
+
|
|
20
|
+
return `run slide sync --dir ${talkDirectory} --node-modules-only to relink`
|
|
21
|
+
+ ` (MCP: slide_sync with dir: ${talkDirectory}, node_modules_only: true)`;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
移行前の talk-dir を止めるときの案内。CLI と MCP のどちらから読んでも打てるよう、両方の手順を持つ。
|
|
25
25
|
*/
|
|
26
|
-
export const MIGRATE_ADVICE = '
|
|
27
|
-
+ '
|
|
26
|
+
export const MIGRATE_ADVICE = 'to migrate to a theme reference, run slide sync --theme <theme-spec>'
|
|
27
|
+
+ ' (MCP: slide_sync with theme: <theme-spec>)';
|
|
28
28
|
/**
|
|
29
29
|
`<talk>/slides.md` の frontmatter `theme:` を読む。
|
|
30
30
|
無い・読めない・`none` は undefined(テーマを指していない)。
|
|
@@ -52,7 +52,7 @@ async function readDependencies(files, talkDirectory) {
|
|
|
52
52
|
const file = path.join(talkDirectory, 'package.json');
|
|
53
53
|
const text = await files.readText(file);
|
|
54
54
|
if (text === undefined) {
|
|
55
|
-
throw new ThemeResolveError(
|
|
55
|
+
throw new ThemeResolveError(`file not found: ${file}; the theme must be in dependencies of the talk-dir package.json; `
|
|
56
56
|
+ relinkAdvice(talkDirectory), 'theme-unlinked');
|
|
57
57
|
}
|
|
58
58
|
let raw;
|
|
@@ -61,7 +61,7 @@ async function readDependencies(files, talkDirectory) {
|
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
|
63
63
|
const reason = error instanceof Error ? error.message : String(error);
|
|
64
|
-
throw new ThemeResolveError(
|
|
64
|
+
throw new ThemeResolveError(`cannot read ${file} as JSON: ${reason}; ${relinkAdvice(talkDirectory)}`, 'theme-unlinked');
|
|
65
65
|
}
|
|
66
66
|
const record = isRecord(raw) ? raw : {};
|
|
67
67
|
const rawDependencies = isRecord(record['dependencies']) ? record['dependencies'] : {};
|
|
@@ -111,14 +111,14 @@ async function findThemeRoot(files, talkDirectory, name) {
|
|
|
111
111
|
}
|
|
112
112
|
async function requireThemeDependency(files, talkDirectory, theme) {
|
|
113
113
|
if (isPathTheme(theme)) {
|
|
114
|
-
throw new ThemeResolveError(`slides.md
|
|
114
|
+
throw new ThemeResolveError(`theme in slides.md is a path: ${theme}; path themes are not supported by pecotv; ${MIGRATE_ADVICE}`, 'theme-none');
|
|
115
115
|
}
|
|
116
116
|
const dependencies = await readDependencies(files, talkDirectory);
|
|
117
117
|
const name = candidateNames(theme).find(candidate => dependencies.has(candidate));
|
|
118
118
|
const spec = name === undefined ? undefined : dependencies.get(name);
|
|
119
119
|
if (name === undefined || spec === undefined) {
|
|
120
|
-
throw new ThemeResolveError(`slides.md
|
|
121
|
-
+
|
|
120
|
+
throw new ThemeResolveError(`no package for the theme in slides.md is in dependencies of package.json: ${theme} `
|
|
121
|
+
+ `(searched names: ${candidateNames(theme).join(', ')}); add the theme to dependencies, then `
|
|
122
122
|
+ relinkAdvice(talkDirectory), 'theme-unlinked');
|
|
123
123
|
}
|
|
124
124
|
return { name, spec };
|
|
@@ -149,7 +149,7 @@ export async function resolveTalkTheme(files, talkDirectory) {
|
|
|
149
149
|
const { name, spec } = await requireThemeDependency(files, talkDirectory, theme);
|
|
150
150
|
const directory = await findThemeRoot(files, talkDirectory, name);
|
|
151
151
|
if (directory === undefined) {
|
|
152
|
-
throw new ThemeResolveError(
|
|
152
|
+
throw new ThemeResolveError(`theme not found in ${path.join(talkDirectory, 'node_modules', name)} or in any parent node_modules: ${name}; `
|
|
153
153
|
+ relinkAdvice(talkDirectory), 'theme-unlinked');
|
|
154
154
|
}
|
|
155
155
|
return { name, spec, directory, linked: directory === path.join(talkDirectory, 'node_modules', name) };
|
|
@@ -167,7 +167,7 @@ async function hasThemeDeclaration(files, directory) {
|
|
|
167
167
|
export async function themeNoneError(files, talkDirectory) {
|
|
168
168
|
const message = await hasThemeDeclaration(files, talkDirectory)
|
|
169
169
|
? themeRootMessage(talkDirectory)
|
|
170
|
-
: `${talkDirectory}
|
|
170
|
+
: `${talkDirectory} does not reference a theme (theme in slides.md is none or unset); ${MIGRATE_ADVICE}`;
|
|
171
171
|
return new ThemeResolveError(message, 'theme-none');
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
@@ -175,8 +175,8 @@ export async function themeNoneError(files, talkDirectory) {
|
|
|
175
175
|
テーマの dir を移行前の talk-dir と取り違えると、sync が layouts・components を消しうるため、文言を分けて止める。
|
|
176
176
|
*/
|
|
177
177
|
export function themeRootMessage(directory) {
|
|
178
|
-
return
|
|
179
|
-
+ '
|
|
178
|
+
return `not a talk-dir (it is a theme dir with ${THEME_DECLARATION_FILE_NAME}): ${directory}; `
|
|
179
|
+
+ 'create a separate talk-dir that references the theme and specify that dir';
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
182
|
talk-dir がテーマをどう持つかを 3 通りに分ける。node_modules には触れない。
|
|
@@ -30,23 +30,23 @@ export function parseThemeSpec(text) {
|
|
|
30
30
|
if (text.startsWith(FILE_PREFIX)) {
|
|
31
31
|
const filePath = text.slice(FILE_PREFIX.length);
|
|
32
32
|
if (filePath === '') {
|
|
33
|
-
throw new ThemeSpecError(
|
|
33
|
+
throw new ThemeSpecError(`theme spec has no path: ${text}`, 'unsupported-spec');
|
|
34
34
|
}
|
|
35
35
|
return { kind: 'file', path: filePath };
|
|
36
36
|
}
|
|
37
37
|
if (!GIT_PREFIX.test(text)) {
|
|
38
|
-
throw new ThemeSpecError(
|
|
38
|
+
throw new ThemeSpecError(`cannot parse the theme spec: ${text} (fix: write git+https://<host>/<owner>/<repo>.git#<tag> or file:<path>)`, 'unsupported-spec');
|
|
39
39
|
}
|
|
40
40
|
const hashIndex = text.indexOf('#');
|
|
41
41
|
if (hashIndex === -1 || hashIndex === text.length - 1) {
|
|
42
|
-
throw new ThemeSpecError(
|
|
42
|
+
throw new ThemeSpecError(`theme spec has no tag: ${text} (fix: add #<tag>)`, 'tag-required');
|
|
43
43
|
}
|
|
44
44
|
const tag = text.slice(hashIndex + 1);
|
|
45
45
|
if (tag.startsWith(SEMVER_RANGE_PREFIX)) {
|
|
46
|
-
throw new ThemeSpecError(
|
|
46
|
+
throw new ThemeSpecError(`semver ranges (#semver:) are not allowed in the theme spec: ${text} (fix: write a single tag)`, 'semver-range');
|
|
47
47
|
}
|
|
48
48
|
if (!isSemverTag(tag)) {
|
|
49
|
-
throw new ThemeSpecError(
|
|
49
|
+
throw new ThemeSpecError(`invalid tag format in the theme spec: ${tag} in ${text} (e.g. 1.2.3 or v1.2.3)`, 'tag-format');
|
|
50
50
|
}
|
|
51
51
|
const url = text.slice('git+'.length, hashIndex);
|
|
52
52
|
return { kind: 'git', url, tag };
|