@vivliostyle/cli 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -88
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +1 -5
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +80 -26
- package/dist/build.js.map +1 -1
- package/dist/commands/build.js +2 -0
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/build.parser.d.ts +1 -1
- package/dist/commands/build.parser.d.ts.map +1 -1
- package/dist/commands/build.parser.js +7 -3
- package/dist/commands/build.parser.js.map +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/init.parser.d.ts.map +1 -1
- package/dist/commands/init.parser.js +5 -2
- package/dist/commands/init.parser.js.map +1 -1
- package/dist/commands/preview.js +2 -0
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/preview.parser.d.ts.map +1 -1
- package/dist/commands/preview.parser.js +6 -2
- package/dist/commands/preview.parser.js.map +1 -1
- package/dist/const.d.ts +8 -2
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +27 -5
- package/dist/const.js.map +1 -1
- package/dist/container.js +5 -6
- package/dist/container.js.map +1 -1
- package/dist/init.d.ts +1 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +4 -3
- package/dist/init.js.map +1 -1
- package/dist/{config.d.ts → input/config.d.ts} +24 -13
- package/dist/input/config.d.ts.map +1 -0
- package/dist/{config.js → input/config.js} +105 -89
- package/dist/input/config.js.map +1 -0
- package/dist/{input.d.ts → input/input-types.d.ts} +1 -1
- package/dist/input/input-types.d.ts.map +1 -0
- package/dist/{input.js → input/input-types.js} +3 -3
- package/dist/input/input-types.js.map +1 -0
- package/dist/output/epub.d.ts +10 -0
- package/dist/output/epub.d.ts.map +1 -0
- package/dist/output/epub.js +542 -0
- package/dist/output/epub.js.map +1 -0
- package/dist/{output.d.ts → output/output-types.d.ts} +8 -3
- package/dist/output/output-types.d.ts.map +1 -0
- package/dist/{output.js → output/output-types.js} +7 -4
- package/dist/output/output-types.js.map +1 -0
- package/dist/{postprocess.d.ts → output/pdf-postprocess.d.ts} +4 -4
- package/dist/output/pdf-postprocess.d.ts.map +1 -0
- package/dist/{postprocess.js → output/pdf-postprocess.js} +7 -8
- package/dist/output/pdf-postprocess.js.map +1 -0
- package/dist/{pdf.d.ts → output/pdf.d.ts} +3 -3
- package/dist/output/pdf.d.ts.map +1 -0
- package/dist/{pdf.js → output/pdf.js} +12 -13
- package/dist/output/pdf.js.map +1 -0
- package/dist/output/webbook.d.ts +21 -0
- package/dist/output/webbook.d.ts.map +1 -0
- package/dist/output/webbook.js +251 -0
- package/dist/output/webbook.js.map +1 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +7 -6
- package/dist/preview.js.map +1 -1
- package/dist/{builder.d.ts → processor/compile.d.ts} +9 -6
- package/dist/processor/compile.d.ts.map +1 -0
- package/dist/{builder.js → processor/compile.js} +81 -76
- package/dist/processor/compile.js.map +1 -0
- package/dist/processor/html.d.ts +59 -0
- package/dist/processor/html.d.ts.map +1 -0
- package/dist/processor/html.js +294 -0
- package/dist/processor/html.js.map +1 -0
- package/dist/processor/markdown.d.ts.map +1 -0
- package/dist/processor/markdown.js.map +1 -0
- package/dist/{theme.d.ts → processor/theme.d.ts} +1 -1
- package/dist/processor/theme.d.ts.map +1 -0
- package/dist/{theme.js → processor/theme.js} +6 -8
- package/dist/processor/theme.js.map +1 -0
- package/dist/schema/pubManifest.d.ts.map +1 -1
- package/dist/schema/pubManifest.js +19 -21
- package/dist/schema/pubManifest.js.map +1 -1
- package/dist/schema/vivliostyle.d.ts.map +1 -1
- package/dist/schema/vivliostyle.js +3 -5
- package/dist/schema/vivliostyle.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +18 -16
- package/dist/server.js.map +1 -1
- package/dist/util.d.ts +14 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +111 -16
- package/dist/util.js.map +1 -1
- package/package.json +31 -15
- package/types/custom.d.ts +4 -0
- package/types/jsdom.d.ts +14 -0
- package/vendors/README.md +10 -0
- package/vendors/build.js +27 -0
- package/vendors/index.d.ts +4 -0
- package/vendors/index.src.js +9 -0
- package/dist/builder.d.ts.map +0 -1
- package/dist/builder.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/epub.d.ts +0 -6
- package/dist/epub.d.ts.map +0 -1
- package/dist/epub.js +0 -18
- package/dist/epub.js.map +0 -1
- package/dist/html.d.ts +0 -17
- package/dist/html.d.ts.map +0 -1
- package/dist/html.js +0 -60
- package/dist/html.js.map +0 -1
- package/dist/input.d.ts.map +0 -1
- package/dist/input.js.map +0 -1
- package/dist/markdown.d.ts.map +0 -1
- package/dist/markdown.js.map +0 -1
- package/dist/output.d.ts.map +0 -1
- package/dist/output.js.map +0 -1
- package/dist/pdf.d.ts.map +0 -1
- package/dist/pdf.js.map +0 -1
- package/dist/postprocess.d.ts.map +0 -1
- package/dist/postprocess.js.map +0 -1
- package/dist/theme.d.ts.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/webbook.d.ts +0 -7
- package/dist/webbook.d.ts.map +0 -1
- package/dist/webbook.js +0 -99
- package/dist/webbook.js.map +0 -1
- /package/dist/{markdown.d.ts → processor/markdown.d.ts} +0 -0
- /package/dist/{markdown.js → processor/markdown.js} +0 -0
|
@@ -1,40 +1,30 @@
|
|
|
1
|
-
import AjvModule from 'ajv';
|
|
2
|
-
import AjvFormatsModule from 'ajv-formats';
|
|
3
|
-
import betterAjvErrors from 'better-ajv-errors';
|
|
4
1
|
import chalk from 'chalk';
|
|
5
|
-
import { imageSize } from 'image-size';
|
|
6
2
|
import { lookup as mime } from 'mime-types';
|
|
7
3
|
import fs from 'node:fs';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { generateTocHtml, isTocHtml, processManuscriptHtml } from './html.js';
|
|
4
|
+
import { TOC_TITLE } from '../const.js';
|
|
5
|
+
import { DetailError, assertPubManifestSchema, copy, debug, log, pathContains, pathEquals, remove, safeGlob, startLogging, upath, useTmpDirectory, } from '../util.js';
|
|
6
|
+
import { generateCoverHtml, generateTocHtml, isCovertHtml, isTocHtml, processManuscriptHtml, } from './html.js';
|
|
12
7
|
import { processMarkdown } from './markdown.js';
|
|
13
|
-
import { publicationSchema, publicationSchemas } from './schema/pubManifest.js';
|
|
14
8
|
import { checkThemeInstallationNecessity, installThemeDependencies, } from './theme.js';
|
|
15
|
-
import { debug, DetailError, filterRelevantAjvErrors, log, pathContains, pathEquals, safeGlob, startLogging, useTmpDirectory, } from './util.js';
|
|
16
|
-
// FIXME: https://github.com/ajv-validator/ajv/issues/2047
|
|
17
|
-
const Ajv = AjvModule.default;
|
|
18
|
-
const addFormats = AjvFormatsModule.default;
|
|
19
9
|
function locateThemePath(theme, from) {
|
|
20
10
|
if (theme.type === 'uri') {
|
|
21
11
|
return theme.location;
|
|
22
12
|
}
|
|
23
13
|
if (theme.type === 'file') {
|
|
24
|
-
return
|
|
14
|
+
return upath.relative(from, theme.location);
|
|
25
15
|
}
|
|
26
16
|
if (theme.importPath) {
|
|
27
17
|
return [theme.importPath].flat().map((locator) => {
|
|
28
|
-
const resolvedPath =
|
|
18
|
+
const resolvedPath = upath.resolve(theme.location, locator);
|
|
29
19
|
if (!pathContains(theme.location, resolvedPath) ||
|
|
30
20
|
!fs.existsSync(resolvedPath)) {
|
|
31
21
|
throw new Error(`Could not find a style path ${theme.importPath} for the theme: ${theme.name}.`);
|
|
32
22
|
}
|
|
33
|
-
return
|
|
23
|
+
return upath.relative(from, resolvedPath);
|
|
34
24
|
});
|
|
35
25
|
}
|
|
36
26
|
else {
|
|
37
|
-
const pkgJsonPath =
|
|
27
|
+
const pkgJsonPath = upath.join(theme.location, 'package.json');
|
|
38
28
|
const packageJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
|
|
39
29
|
const maybeStyle = packageJson?.vivliostyle?.theme?.style ??
|
|
40
30
|
packageJson.style ??
|
|
@@ -42,7 +32,7 @@ function locateThemePath(theme, from) {
|
|
|
42
32
|
if (!maybeStyle) {
|
|
43
33
|
throw new DetailError(`Could not find a style file for the theme: ${theme.name}.`, 'Please ensure this package satisfies a `vivliostyle.theme.style` propertiy.');
|
|
44
34
|
}
|
|
45
|
-
return
|
|
35
|
+
return upath.relative(from, upath.join(theme.location, maybeStyle));
|
|
46
36
|
}
|
|
47
37
|
}
|
|
48
38
|
export async function cleanupWorkspace({ entryContextDir, workspaceDir, themesDir, }) {
|
|
@@ -55,12 +45,12 @@ export async function cleanupWorkspace({ entryContextDir, workspaceDir, themesDi
|
|
|
55
45
|
let movedThemePath;
|
|
56
46
|
if (pathContains(workspaceDir, themesDir) && fs.existsSync(themesDir)) {
|
|
57
47
|
[movedThemePath] = await useTmpDirectory();
|
|
58
|
-
|
|
48
|
+
await copy(themesDir, movedThemePath);
|
|
59
49
|
}
|
|
60
|
-
|
|
50
|
+
await remove(workspaceDir);
|
|
61
51
|
if (movedThemePath) {
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
fs.mkdirSync(upath.dirname(themesDir), { recursive: true });
|
|
53
|
+
await copy(movedThemePath, themesDir);
|
|
64
54
|
}
|
|
65
55
|
}
|
|
66
56
|
export async function prepareThemeDirectory({ themesDir, themeIndexes, }) {
|
|
@@ -72,8 +62,8 @@ export async function prepareThemeDirectory({ themesDir, themeIndexes, }) {
|
|
|
72
62
|
// copy theme files
|
|
73
63
|
for (const theme of themeIndexes) {
|
|
74
64
|
if (theme.type === 'file' && !pathEquals(theme.source, theme.location)) {
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
fs.mkdirSync(upath.dirname(theme.location), { recursive: true });
|
|
66
|
+
await copy(theme.source, theme.location);
|
|
77
67
|
}
|
|
78
68
|
}
|
|
79
69
|
}
|
|
@@ -81,29 +71,29 @@ export async function prepareThemeDirectory({ themesDir, themeIndexes, }) {
|
|
|
81
71
|
export function generateManifest(outputPath, entryContextDir, options) {
|
|
82
72
|
const entries = options.entries.map((entry) => ({
|
|
83
73
|
url: encodeURI(entry.path),
|
|
84
|
-
name: entry.title,
|
|
74
|
+
...(entry.title && { name: entry.title }),
|
|
85
75
|
...(entry.encodingFormat && { encodingFormat: entry.encodingFormat }),
|
|
86
76
|
...(entry.rel && { rel: entry.rel }),
|
|
87
77
|
...(entry.rel === 'contents' && { type: 'LinkedResource' }),
|
|
88
78
|
}));
|
|
89
|
-
const links = [
|
|
90
|
-
|
|
79
|
+
const links = [
|
|
80
|
+
options.links || [],
|
|
81
|
+
].flat();
|
|
82
|
+
const resources = [
|
|
83
|
+
options.resources || [],
|
|
84
|
+
].flat();
|
|
91
85
|
if (options.cover) {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
width,
|
|
102
|
-
height,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
86
|
+
const mimeType = mime(options.cover);
|
|
87
|
+
if (mimeType) {
|
|
88
|
+
entries.unshift({
|
|
89
|
+
type: 'LinkedResource',
|
|
90
|
+
rel: 'cover',
|
|
91
|
+
url: encodeURI(options.cover),
|
|
92
|
+
encodingFormat: mimeType,
|
|
93
|
+
name: options.title || '',
|
|
94
|
+
});
|
|
105
95
|
}
|
|
106
|
-
|
|
96
|
+
else {
|
|
107
97
|
log(`\n${chalk.yellow('Cover image ')}${chalk.bold.yellow(`"${options.cover}"`)}${chalk.yellow(' was set in your configuration but couldn’t detect the image metadata. Please check a valid cover file is placed.')}`);
|
|
108
98
|
}
|
|
109
99
|
}
|
|
@@ -111,47 +101,50 @@ export function generateManifest(outputPath, entryContextDir, options) {
|
|
|
111
101
|
'@context': ['https://schema.org', 'https://www.w3.org/ns/pub-context'],
|
|
112
102
|
type: 'Book',
|
|
113
103
|
conformsTo: 'https://github.com/vivliostyle/vivliostyle-cli',
|
|
114
|
-
|
|
104
|
+
...(options.title && { name: options.title }),
|
|
105
|
+
...(options.author && { author: options.author }),
|
|
115
106
|
...(options.language && { inLanguage: options.language }),
|
|
116
107
|
...(options.readingProgression && {
|
|
117
108
|
readingProgression: options.readingProgression,
|
|
118
109
|
}),
|
|
119
110
|
dateModified: options.modified,
|
|
120
|
-
name: options.title,
|
|
121
111
|
readingOrder: entries,
|
|
122
112
|
resources,
|
|
123
113
|
links,
|
|
124
114
|
};
|
|
125
115
|
const publicationJson = JSON.stringify(publication, null, 2);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const validate = ajv.compile(publicationSchema);
|
|
131
|
-
const valid = validate(publication);
|
|
132
|
-
if (!valid) {
|
|
133
|
-
const message = `Validation of pubManifest failed. Please check the schema: ${outputPath}`;
|
|
134
|
-
const detailMessage = validate.errors &&
|
|
135
|
-
betterAjvErrors(publicationSchemas, publication, filterRelevantAjvErrors(validate.errors), {
|
|
136
|
-
json: publicationJson,
|
|
137
|
-
});
|
|
138
|
-
throw detailMessage
|
|
139
|
-
? new DetailError(message, detailMessage)
|
|
140
|
-
: new Error(message);
|
|
116
|
+
try {
|
|
117
|
+
assertPubManifestSchema(publication, {
|
|
118
|
+
json: publicationJson,
|
|
119
|
+
});
|
|
141
120
|
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
const thrownError = error;
|
|
123
|
+
throw new DetailError(`Validation of pubManifest failed. Please check the schema: ${outputPath}`, typeof thrownError === 'string'
|
|
124
|
+
? thrownError
|
|
125
|
+
: thrownError.stack ?? thrownError.message);
|
|
126
|
+
}
|
|
127
|
+
fs.writeFileSync(outputPath, publicationJson);
|
|
128
|
+
return publication;
|
|
142
129
|
}
|
|
143
|
-
export async function compile({ entryContextDir, workspaceDir, manifestPath,
|
|
130
|
+
export async function compile({ entryContextDir, workspaceDir, manifestPath, needToGenerateManifest, title, author, entries, language, readingProgression, cover, vfmOptions, }) {
|
|
144
131
|
const generativeContentsEntry = entries.find((e) => !('source' in e) && e.rel === 'contents');
|
|
145
132
|
if (generativeContentsEntry &&
|
|
146
133
|
fs.existsSync(generativeContentsEntry.target) &&
|
|
147
134
|
!isTocHtml(generativeContentsEntry.target)) {
|
|
148
135
|
throw new Error(`${generativeContentsEntry.target} is set as a destination to create a ToC HTML file, but there is already a document other than the ToC file in this location. Please move this file, or set a 'toc' option in vivliostyle.config.js to specify another destination for the ToC file.`);
|
|
149
136
|
}
|
|
137
|
+
const generativeCoverPageEntry = entries.find((e) => !('source' in e) && e.rel === 'cover');
|
|
138
|
+
if (generativeCoverPageEntry &&
|
|
139
|
+
fs.existsSync(generativeCoverPageEntry.target) &&
|
|
140
|
+
!isCovertHtml(generativeCoverPageEntry.target)) {
|
|
141
|
+
throw new Error(`${generativeCoverPageEntry.target} is set as a destination to create a cover page HTML file, but there is already a document other than the cover page file in this location.`);
|
|
142
|
+
}
|
|
150
143
|
const contentEntries = entries.filter((e) => 'source' in e);
|
|
151
144
|
for (const entry of contentEntries) {
|
|
152
|
-
|
|
145
|
+
fs.mkdirSync(upath.dirname(entry.target), { recursive: true });
|
|
153
146
|
// calculate style path
|
|
154
|
-
const style = entry.themes.flatMap((theme) => locateThemePath(theme,
|
|
147
|
+
const style = entry.themes.flatMap((theme) => locateThemePath(theme, upath.dirname(entry.target)));
|
|
155
148
|
if (entry.type === 'text/markdown') {
|
|
156
149
|
// compile markdown
|
|
157
150
|
const vfile = processMarkdown(entry.source, {
|
|
@@ -177,7 +170,7 @@ export async function compile({ entryContextDir, workspaceDir, manifestPath, man
|
|
|
177
170
|
}
|
|
178
171
|
else {
|
|
179
172
|
if (!pathEquals(entry.source, entry.target)) {
|
|
180
|
-
|
|
173
|
+
await copy(entry.source, entry.target);
|
|
181
174
|
}
|
|
182
175
|
}
|
|
183
176
|
}
|
|
@@ -187,23 +180,35 @@ export async function compile({ entryContextDir, workspaceDir, manifestPath, man
|
|
|
187
180
|
const tocString = generateTocHtml({
|
|
188
181
|
entries: contentEntries,
|
|
189
182
|
manifestPath,
|
|
190
|
-
distDir:
|
|
191
|
-
title
|
|
183
|
+
distDir: upath.dirname(generativeContentsEntry.target),
|
|
184
|
+
title,
|
|
192
185
|
tocTitle: generativeContentsEntry.title ?? TOC_TITLE,
|
|
193
186
|
style,
|
|
194
187
|
});
|
|
195
188
|
fs.writeFileSync(generativeContentsEntry.target, tocString);
|
|
196
189
|
}
|
|
190
|
+
// generate cover
|
|
191
|
+
if (cover && generativeCoverPageEntry) {
|
|
192
|
+
const style = generativeCoverPageEntry.themes.flatMap((theme) => locateThemePath(theme, workspaceDir));
|
|
193
|
+
const coverHtml = generateCoverHtml({
|
|
194
|
+
imageSrc: upath.relative(entryContextDir, cover),
|
|
195
|
+
imageAlt: title || '',
|
|
196
|
+
title,
|
|
197
|
+
style,
|
|
198
|
+
});
|
|
199
|
+
fs.writeFileSync(generativeCoverPageEntry.target, coverHtml, 'utf8');
|
|
200
|
+
}
|
|
197
201
|
// generate manifest
|
|
198
|
-
if (
|
|
202
|
+
if (needToGenerateManifest) {
|
|
199
203
|
generateManifest(manifestPath, entryContextDir, {
|
|
200
|
-
|
|
204
|
+
title,
|
|
205
|
+
author,
|
|
201
206
|
language,
|
|
202
207
|
readingProgression,
|
|
203
|
-
cover: cover &&
|
|
208
|
+
cover: cover && 'cover.html',
|
|
204
209
|
entries: entries.map((entry) => ({
|
|
205
210
|
title: entry.title,
|
|
206
|
-
path:
|
|
211
|
+
path: upath.relative(workspaceDir, entry.target),
|
|
207
212
|
encodingFormat: !('type' in entry) ||
|
|
208
213
|
entry.type === 'text/markdown' ||
|
|
209
214
|
entry.type === 'text/html'
|
|
@@ -219,7 +224,7 @@ export async function copyAssets({ entryContextDir, workspaceDir, includeAssets,
|
|
|
219
224
|
if (pathEquals(entryContextDir, workspaceDir)) {
|
|
220
225
|
return;
|
|
221
226
|
}
|
|
222
|
-
const relWorkspaceDir =
|
|
227
|
+
const relWorkspaceDir = upath.relative(entryContextDir, workspaceDir);
|
|
223
228
|
const assets = await safeGlob(includeAssets, {
|
|
224
229
|
cwd: entryContextDir,
|
|
225
230
|
ignore: [
|
|
@@ -227,10 +232,10 @@ export async function copyAssets({ entryContextDir, workspaceDir, includeAssets,
|
|
|
227
232
|
...outputs.flatMap(({ format, path: p }) => !pathContains(entryContextDir, p)
|
|
228
233
|
? []
|
|
229
234
|
: format === 'webpub'
|
|
230
|
-
?
|
|
231
|
-
:
|
|
235
|
+
? upath.join(upath.relative(entryContextDir, p), '**')
|
|
236
|
+
: upath.relative(entryContextDir, p)),
|
|
232
237
|
// don't copy workspace itself
|
|
233
|
-
...(relWorkspaceDir ? [
|
|
238
|
+
...(relWorkspaceDir ? [upath.join(relWorkspaceDir, '**')] : []),
|
|
234
239
|
],
|
|
235
240
|
caseSensitiveMatch: false,
|
|
236
241
|
followSymbolicLinks: false,
|
|
@@ -238,9 +243,9 @@ export async function copyAssets({ entryContextDir, workspaceDir, includeAssets,
|
|
|
238
243
|
});
|
|
239
244
|
debug('assets', assets);
|
|
240
245
|
for (const asset of assets) {
|
|
241
|
-
const target =
|
|
242
|
-
|
|
243
|
-
|
|
246
|
+
const target = upath.join(workspaceDir, asset);
|
|
247
|
+
fs.mkdirSync(upath.dirname(target), { recursive: true });
|
|
248
|
+
await copy(upath.resolve(entryContextDir, asset), target);
|
|
244
249
|
}
|
|
245
250
|
}
|
|
246
251
|
export function checkOverwriteViolation({ entryContextDir, workspaceDir }, target, fileInformation) {
|
|
@@ -252,4 +257,4 @@ export function checkOverwriteViolation({ entryContextDir, workspaceDir }, targe
|
|
|
252
257
|
throw new Error(`${target} is set as output destination of ${fileInformation}, however, this output path will overwrite the working directory of Vivliostyle. Please specify other paths.`);
|
|
253
258
|
}
|
|
254
259
|
}
|
|
255
|
-
//# sourceMappingURL=
|
|
260
|
+
//# sourceMappingURL=compile.js.map
|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C,CAAC;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACxB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC/C,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;KAC3D;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,EAAE,eAAe,EAAE,YAAY,EAAgB,EAC/C,MAAc,EACd,eAAuB;IAEvB,IACE,YAAY,CAAC,MAAM,EAAE,eAAe,CAAC;QACrC,UAAU,CAAC,MAAM,EAAE,eAAe,CAAC,EACnC;QACA,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,oCAAoC,eAAe,gGAAgG,CAC7J,CAAC;KACH;IACD,IAAI,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE;QAC1E,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,oCAAoC,eAAe,8GAA8G,CAC3K,CAAC;KACH;AACH,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import jsdom, { ResourceLoader as BaseResourceLoader, JSDOM } from '@vivliostyle/jsdom';
|
|
3
|
+
import { ManuscriptEntry } from '../input/config.js';
|
|
4
|
+
import type { PublicationManifest } from '../schema/publication.schema.js';
|
|
5
|
+
export declare class ResourceLoader extends BaseResourceLoader {
|
|
6
|
+
fetcherMap: Map<string, jsdom.AbortablePromise<Buffer>>;
|
|
7
|
+
fetch(url: string, options?: jsdom.FetchOptions): jsdom.AbortablePromise<Buffer> | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function getJsdomFromUrlOrFile(src: string, resourceLoader?: ResourceLoader): Promise<{
|
|
10
|
+
dom: JSDOM;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function generateTocHtml({ entries, manifestPath, distDir, title, tocTitle, style, }: {
|
|
13
|
+
entries: Pick<ManuscriptEntry, 'target' | 'title'>[];
|
|
14
|
+
manifestPath: string;
|
|
15
|
+
distDir: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
tocTitle: string;
|
|
18
|
+
style?: string[];
|
|
19
|
+
}): string;
|
|
20
|
+
export declare function generateCoverHtml({ imageSrc, imageAlt, title, style, }: {
|
|
21
|
+
imageSrc: string;
|
|
22
|
+
imageAlt: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
style?: string[];
|
|
25
|
+
}): string;
|
|
26
|
+
export declare function processManuscriptHtml(filepath: string, { title, style, contentType, language, }: {
|
|
27
|
+
title?: string;
|
|
28
|
+
style?: string[];
|
|
29
|
+
contentType?: 'text/html' | 'application/xhtml+xml';
|
|
30
|
+
language?: string | null;
|
|
31
|
+
}): string;
|
|
32
|
+
export declare function isTocHtml(filepath: string): boolean;
|
|
33
|
+
export declare function isCovertHtml(filepath: string): boolean;
|
|
34
|
+
export declare function fetchLinkedPublicationManifest({ dom, resourceLoader, baseUrl, }: {
|
|
35
|
+
dom: JSDOM;
|
|
36
|
+
resourceLoader: ResourceLoader;
|
|
37
|
+
baseUrl: string;
|
|
38
|
+
}): Promise<PublicationManifest | null>;
|
|
39
|
+
export type TocResourceTreeItem = {
|
|
40
|
+
element: HTMLElement;
|
|
41
|
+
label: HTMLElement;
|
|
42
|
+
children?: TocResourceTreeItem[];
|
|
43
|
+
};
|
|
44
|
+
export type TocResourceTreeRoot = {
|
|
45
|
+
element: HTMLElement;
|
|
46
|
+
heading?: HTMLElement;
|
|
47
|
+
children: TocResourceTreeItem[];
|
|
48
|
+
};
|
|
49
|
+
export declare function parseTocDocument(dom: JSDOM): TocResourceTreeRoot | null;
|
|
50
|
+
export type PageListResourceTreeItem = {
|
|
51
|
+
element: HTMLElement;
|
|
52
|
+
};
|
|
53
|
+
export type PageListResourceTreeRoot = {
|
|
54
|
+
element: HTMLElement;
|
|
55
|
+
heading?: HTMLElement;
|
|
56
|
+
children: PageListResourceTreeItem[];
|
|
57
|
+
};
|
|
58
|
+
export declare function parsePageListDocument(dom: JSDOM): PageListResourceTreeRoot | null;
|
|
59
|
+
//# sourceMappingURL=html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/processor/html.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,IAAI,kBAAkB,EACpC,KAAK,EACN,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AA0C3E,qBAAa,cAAe,SAAQ,kBAAkB;IACpD,UAAU,8CAAqD;IAE/D,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY;CAQhD;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC;IACT,GAAG,EAAE,KAAK,CAAC;CACZ,CAAC,CAsBD;AAWD,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,GACN,EAAE;IACD,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MA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