@vivliostyle/cli 9.0.0-next.3 → 9.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/chunk-BIEQXUOY.js +50 -0
  2. package/dist/chunk-DMARNPN5.js +1073 -0
  3. package/dist/chunk-DMGAKSPH.js +590 -0
  4. package/dist/{core/init.js → chunk-E7QOXL6M.js} +39 -27
  5. package/dist/chunk-EX7EA34F.js +64 -0
  6. package/dist/chunk-LASMQBPP.js +85 -0
  7. package/dist/chunk-QC3BOE2G.js +74 -0
  8. package/dist/chunk-VBEHGS67.js +4990 -0
  9. package/dist/chunk-WX6JHPSL.js +16 -0
  10. package/dist/chunk-Y3ETBU5J.js +54 -0
  11. package/dist/cli.d.ts +0 -2
  12. package/dist/cli.js +17 -18
  13. package/dist/commands/build.d.ts +2 -2
  14. package/dist/commands/build.js +165 -17
  15. package/dist/commands/init.d.ts +2 -2
  16. package/dist/commands/init.js +35 -12
  17. package/dist/commands/preview.d.ts +2 -2
  18. package/dist/commands/preview.js +98 -12
  19. package/dist/config/schema.d.ts +2332 -2325
  20. package/dist/config/schema.js +50 -588
  21. package/dist/index.d.ts +116 -7
  22. package/dist/index.js +38 -42
  23. package/dist/node-modules.d.ts +21 -0
  24. package/dist/node-modules.js +9 -0
  25. package/dist/vite-adapter.d.ts +8 -2
  26. package/dist/vite-adapter.js +11 -43
  27. package/package.json +32 -13
  28. package/dist/browser.d.ts +0 -19
  29. package/dist/browser.d.ts.map +0 -1
  30. package/dist/browser.js +0 -154
  31. package/dist/browser.js.map +0 -1
  32. package/dist/cli.d.ts.map +0 -1
  33. package/dist/cli.js.map +0 -1
  34. package/dist/commands/build.d.ts.map +0 -1
  35. package/dist/commands/build.js.map +0 -1
  36. package/dist/commands/build.parser.d.ts +0 -3
  37. package/dist/commands/build.parser.d.ts.map +0 -1
  38. package/dist/commands/build.parser.js +0 -104
  39. package/dist/commands/build.parser.js.map +0 -1
  40. package/dist/commands/cli-flags.d.ts +0 -42
  41. package/dist/commands/cli-flags.d.ts.map +0 -1
  42. package/dist/commands/cli-flags.js +0 -58
  43. package/dist/commands/cli-flags.js.map +0 -1
  44. package/dist/commands/init.d.ts.map +0 -1
  45. package/dist/commands/init.js.map +0 -1
  46. package/dist/commands/init.parser.d.ts +0 -3
  47. package/dist/commands/init.parser.d.ts.map +0 -1
  48. package/dist/commands/init.parser.js +0 -17
  49. package/dist/commands/init.parser.js.map +0 -1
  50. package/dist/commands/preview.d.ts.map +0 -1
  51. package/dist/commands/preview.js.map +0 -1
  52. package/dist/commands/preview.parser.d.ts +0 -3
  53. package/dist/commands/preview.parser.d.ts.map +0 -1
  54. package/dist/commands/preview.parser.js +0 -52
  55. package/dist/commands/preview.parser.js.map +0 -1
  56. package/dist/config/load.d.ts +0 -4
  57. package/dist/config/load.d.ts.map +0 -1
  58. package/dist/config/load.js +0 -75
  59. package/dist/config/load.js.map +0 -1
  60. package/dist/config/merge.d.ts +0 -4
  61. package/dist/config/merge.d.ts.map +0 -1
  62. package/dist/config/merge.js +0 -59
  63. package/dist/config/merge.js.map +0 -1
  64. package/dist/config/resolve.d.ts +0 -205
  65. package/dist/config/resolve.d.ts.map +0 -1
  66. package/dist/config/resolve.js +0 -770
  67. package/dist/config/resolve.js.map +0 -1
  68. package/dist/config/schema.d.ts.map +0 -1
  69. package/dist/config/schema.js.map +0 -1
  70. package/dist/config/vite.d.ts +0 -6
  71. package/dist/config/vite.d.ts.map +0 -1
  72. package/dist/config/vite.js +0 -49
  73. package/dist/config/vite.js.map +0 -1
  74. package/dist/const.d.ts +0 -20
  75. package/dist/const.d.ts.map +0 -1
  76. package/dist/const.js +0 -41
  77. package/dist/const.js.map +0 -1
  78. package/dist/container.d.ts +0 -21
  79. package/dist/container.d.ts.map +0 -1
  80. package/dist/container.js +0 -175
  81. package/dist/container.js.map +0 -1
  82. package/dist/core/build.d.ts +0 -3
  83. package/dist/core/build.d.ts.map +0 -1
  84. package/dist/core/build.js +0 -168
  85. package/dist/core/build.js.map +0 -1
  86. package/dist/core/init.d.ts +0 -3
  87. package/dist/core/init.d.ts.map +0 -1
  88. package/dist/core/init.js.map +0 -1
  89. package/dist/core/preview.d.ts +0 -4
  90. package/dist/core/preview.d.ts.map +0 -1
  91. package/dist/core/preview.js +0 -114
  92. package/dist/core/preview.js.map +0 -1
  93. package/dist/index.d.ts.map +0 -1
  94. package/dist/index.js.map +0 -1
  95. package/dist/logger.d.ts +0 -30
  96. package/dist/logger.d.ts.map +0 -1
  97. package/dist/logger.js +0 -172
  98. package/dist/logger.js.map +0 -1
  99. package/dist/output/epub.d.ts +0 -10
  100. package/dist/output/epub.d.ts.map +0 -1
  101. package/dist/output/epub.js +0 -505
  102. package/dist/output/epub.js.map +0 -1
  103. package/dist/output/pdf-postprocess.d.ts +0 -30
  104. package/dist/output/pdf-postprocess.d.ts.map +0 -1
  105. package/dist/output/pdf-postprocess.js +0 -270
  106. package/dist/output/pdf-postprocess.js.map +0 -1
  107. package/dist/output/pdf.d.ts +0 -6
  108. package/dist/output/pdf.d.ts.map +0 -1
  109. package/dist/output/pdf.js +0 -200
  110. package/dist/output/pdf.js.map +0 -1
  111. package/dist/output/webbook.d.ts +0 -45
  112. package/dist/output/webbook.d.ts.map +0 -1
  113. package/dist/output/webbook.js +0 -413
  114. package/dist/output/webbook.js.map +0 -1
  115. package/dist/processor/compile.d.ts +0 -30
  116. package/dist/processor/compile.d.ts.map +0 -1
  117. package/dist/processor/compile.js +0 -348
  118. package/dist/processor/compile.js.map +0 -1
  119. package/dist/processor/html.d.ts +0 -107
  120. package/dist/processor/html.d.ts.map +0 -1
  121. package/dist/processor/html.js +0 -494
  122. package/dist/processor/html.js.map +0 -1
  123. package/dist/processor/markdown.d.ts +0 -12
  124. package/dist/processor/markdown.d.ts.map +0 -1
  125. package/dist/processor/markdown.js +0 -23
  126. package/dist/processor/markdown.js.map +0 -1
  127. package/dist/processor/theme.d.ts +0 -4
  128. package/dist/processor/theme.d.ts.map +0 -1
  129. package/dist/processor/theme.js +0 -41
  130. package/dist/processor/theme.js.map +0 -1
  131. package/dist/schema/pub-manifest.d.ts +0 -4
  132. package/dist/schema/pub-manifest.d.ts.map +0 -1
  133. package/dist/schema/pub-manifest.js +0 -41
  134. package/dist/schema/pub-manifest.js.map +0 -1
  135. package/dist/schema/publication.schema.d.ts +0 -104
  136. package/dist/schema/publication.schema.d.ts.map +0 -1
  137. package/dist/schema/publication.schema.js +0 -8
  138. package/dist/schema/publication.schema.js.map +0 -1
  139. package/dist/server.d.ts +0 -20
  140. package/dist/server.d.ts.map +0 -1
  141. package/dist/server.js +0 -126
  142. package/dist/server.js.map +0 -1
  143. package/dist/util.d.ts +0 -55
  144. package/dist/util.d.ts.map +0 -1
  145. package/dist/util.js +0 -274
  146. package/dist/util.js.map +0 -1
  147. package/dist/vite/plugin-util.d.ts +0 -6
  148. package/dist/vite/plugin-util.d.ts.map +0 -1
  149. package/dist/vite/plugin-util.js +0 -18
  150. package/dist/vite/plugin-util.js.map +0 -1
  151. package/dist/vite/vite-plugin-browser.d.ts +0 -8
  152. package/dist/vite/vite-plugin-browser.d.ts.map +0 -1
  153. package/dist/vite/vite-plugin-browser.js +0 -54
  154. package/dist/vite/vite-plugin-browser.js.map +0 -1
  155. package/dist/vite/vite-plugin-dev-server.d.ts +0 -8
  156. package/dist/vite/vite-plugin-dev-server.d.ts.map +0 -1
  157. package/dist/vite/vite-plugin-dev-server.js +0 -270
  158. package/dist/vite/vite-plugin-dev-server.js.map +0 -1
  159. package/dist/vite/vite-plugin-static-serve.d.ts +0 -8
  160. package/dist/vite/vite-plugin-static-serve.d.ts.map +0 -1
  161. package/dist/vite/vite-plugin-static-serve.js +0 -31
  162. package/dist/vite/vite-plugin-static-serve.js.map +0 -1
  163. package/dist/vite/vite-plugin-viewer.d.ts +0 -8
  164. package/dist/vite/vite-plugin-viewer.d.ts.map +0 -1
  165. package/dist/vite/vite-plugin-viewer.js +0 -52
  166. package/dist/vite/vite-plugin-viewer.js.map +0 -1
  167. package/dist/vite-adapter.d.ts.map +0 -1
  168. package/dist/vite-adapter.js.map +0 -1
  169. package/schemas/pub-manifest/README.md +0 -5
  170. package/schemas/pub-manifest/module/ItemList.schema.json +0 -32
  171. package/schemas/pub-manifest/module/bcp.schema.json +0 -7
  172. package/schemas/pub-manifest/module/context.schema.json +0 -62
  173. package/schemas/pub-manifest/module/contributor-object.schema.json +0 -42
  174. package/schemas/pub-manifest/module/contributor.schema.json +0 -26
  175. package/schemas/pub-manifest/module/date.schema.json +0 -7
  176. package/schemas/pub-manifest/module/duration.schema.json +0 -7
  177. package/schemas/pub-manifest/module/item-lists.schema.json +0 -16
  178. package/schemas/pub-manifest/module/language.schema.json +0 -16
  179. package/schemas/pub-manifest/module/link.schema.json +0 -60
  180. package/schemas/pub-manifest/module/localizable-object.schema.json +0 -15
  181. package/schemas/pub-manifest/module/localizable.schema.json +0 -26
  182. package/schemas/pub-manifest/module/resource.categorization.schema.json +0 -31
  183. package/schemas/pub-manifest/module/strings.schema.json +0 -9
  184. package/schemas/pub-manifest/module/url.schema.json +0 -7
  185. package/schemas/pub-manifest/module/urls.schema.json +0 -18
  186. package/schemas/pub-manifest/publication.schema.json +0 -123
@@ -1,589 +1,51 @@
1
- import upath from 'upath';
2
- import * as v from 'valibot';
3
- const $ = (strings, ...values) => {
4
- const lines = String.raw({ raw: strings }, ...values).split('\n');
5
- const indent = lines
6
- .filter((line) => line.trim())
7
- .map((line) => line.match(/^\s*/)?.[0].length ?? 0)
8
- .reduce((min, len) => Math.min(min, len), Infinity);
9
- return lines
10
- .map((line) => line.slice(indent))
11
- .join('\n')
12
- .trim();
1
+ import {
2
+ ArticleEntryConfig,
3
+ BrowserType,
4
+ BuildTask,
5
+ ContentsEntryConfig,
6
+ CopyAssetConfig,
7
+ CoverConfig,
8
+ CoverEntryConfig,
9
+ EntryConfig,
10
+ LogLevel,
11
+ OutputConfig,
12
+ OutputFormat,
13
+ ReadingProgression,
14
+ RenderMode,
15
+ ServerConfig,
16
+ StructuredDocument,
17
+ StructuredDocumentSection,
18
+ ThemeConfig,
19
+ ThemeSpecifier,
20
+ TocConfig,
21
+ ValidString,
22
+ VfmReplaceRule,
23
+ VivliostyleConfigSchema,
24
+ VivliostyleInlineConfig
25
+ } from "../chunk-DMARNPN5.js";
26
+ import "../chunk-BIEQXUOY.js";
27
+ export {
28
+ ArticleEntryConfig,
29
+ BrowserType,
30
+ BuildTask,
31
+ ContentsEntryConfig,
32
+ CopyAssetConfig,
33
+ CoverConfig,
34
+ CoverEntryConfig,
35
+ EntryConfig,
36
+ LogLevel,
37
+ OutputConfig,
38
+ OutputFormat,
39
+ ReadingProgression,
40
+ RenderMode,
41
+ ServerConfig,
42
+ StructuredDocument,
43
+ StructuredDocumentSection,
44
+ ThemeConfig,
45
+ ThemeSpecifier,
46
+ TocConfig,
47
+ ValidString,
48
+ VfmReplaceRule,
49
+ VivliostyleConfigSchema,
50
+ VivliostyleInlineConfig
13
51
  };
14
- /** @hidden */
15
- export const StructuredDocument = v.pipe(v.object({
16
- title: v.string(),
17
- href: v.string(),
18
- children: v.array(v.lazy(() => StructuredDocument)),
19
- sections: v.optional(v.array(v.lazy(() => StructuredDocumentSection))),
20
- }), v.title('StructuredDocument'));
21
- /** @hidden */
22
- export const StructuredDocumentSection = v.pipe(v.object({
23
- headingHtml: v.string(),
24
- headingText: v.string(),
25
- level: v.number(),
26
- children: v.array(v.lazy(() => StructuredDocumentSection)),
27
- href: v.optional(v.string()),
28
- id: v.optional(v.string()),
29
- }), v.title('StructuredDocumentSection'));
30
- export const ValidString = v.pipe(v.string(), v.trim(), v.minLength(1, 'At least one character is required'));
31
- export const ThemeConfig = v.pipe(v.intersect([
32
- v.required(v.object({
33
- specifier: v.pipe(ValidString, v.description($ `
34
- The specifier name for importing the theme package or the path to a CSS file.
35
- - An npm-style package argument is allowed (e.g., \`@vivliostyle/theme-academic@1\`, \`./local-pkg\`).
36
- - A URL or a local path to a CSS file is allowed (e.g., \`./style.css\`, \`https://example.com/style.css\`).
37
- `)),
38
- }), 'Missing required field: specifier'),
39
- v.partial(v.object({
40
- import: v.pipe(v.union([v.array(ValidString), ValidString]), v.transform((input) => [input].flat()), v.description($ `
41
- The path(s) to the CSS file(s) to import from the package.
42
- Specify this if you want to import files other than the default.
43
- `)),
44
- })),
45
- ]), v.title('ThemeConfig'));
46
- export const ThemeSpecifier = v.pipe(v.union([
47
- v.array(v.union([ThemeConfig, ValidString])),
48
- ThemeConfig,
49
- ValidString,
50
- ]), v.transform((input) => [input]
51
- .flat()
52
- .map((item) => (typeof item === 'string' ? { specifier: item } : item))));
53
- export const ArticleEntryConfig = v.pipe(v.required(v.object({
54
- path: ValidString,
55
- output: v.optional(ValidString),
56
- title: v.optional(ValidString),
57
- theme: v.optional(ThemeSpecifier),
58
- encodingFormat: v.optional(ValidString),
59
- rel: v.optional(v.pipe(v.union([v.array(ValidString), ValidString]), v.transform((input) => [input].flat()))),
60
- }), ['path'], 'Missing required field: path'), v.title('ArticleEntryConfig'));
61
- const PageBreak = v.union([
62
- v.literal('left'),
63
- v.literal('right'),
64
- v.literal('recto'),
65
- v.literal('verso'),
66
- ]);
67
- export const ContentsEntryConfig = v.pipe(v.object({
68
- rel: v.literal('contents'),
69
- path: v.optional(ValidString),
70
- output: v.optional(ValidString),
71
- title: v.optional(ValidString),
72
- theme: v.optional(ThemeSpecifier),
73
- pageBreakBefore: v.pipe(v.optional(PageBreak), v.description($ `
74
- Specifies the page break position before this document.
75
- Useful for determining which side the first page of the document should be placed on in a two-page spread.
76
- `)),
77
- pageCounterReset: v.pipe(v.optional(v.pipe(v.number(), v.safeInteger())), v.description($ `
78
- Resets the starting page number of this document to the specified integer.
79
- Useful for controlling page numbers when including a page.
80
- `)),
81
- }), v.title('ContentsEntryConfig'));
82
- export const CoverEntryConfig = v.pipe(v.object({
83
- rel: v.literal('cover'),
84
- path: v.optional(ValidString),
85
- output: v.optional(ValidString),
86
- title: v.optional(ValidString),
87
- theme: v.optional(ThemeSpecifier),
88
- imageSrc: v.optional(ValidString),
89
- imageAlt: v.optional(v.string()), // Allow empty string
90
- pageBreakBefore: v.pipe(v.optional(PageBreak), v.description($ `
91
- Specifies the page break position before this document.
92
- Useful for determining which side the first page of the document should be placed on in a two-page spread.
93
- `)),
94
- }), v.title('CoverEntryConfig'));
95
- export const EntryConfig = v.union([
96
- ContentsEntryConfig,
97
- CoverEntryConfig,
98
- ArticleEntryConfig,
99
- ]);
100
- export const OutputFormat = v.union([
101
- v.literal('pdf'),
102
- v.literal('epub'),
103
- v.literal('webpub'),
104
- ]);
105
- export const RenderMode = v.union([v.literal('local'), v.literal('docker')]);
106
- export const OutputConfig = v.pipe(v.intersect([
107
- v.required(v.object({
108
- path: v.pipe(ValidString, v.description($ `
109
- Specifies the output file name or directory. (default: \`<title>.pdf\`)
110
- `)),
111
- }), 'Missing required field: path'),
112
- v.partial(v.object({
113
- format: v.pipe(OutputFormat, v.description($ `
114
- Specifies the output format.
115
- `)),
116
- renderMode: v.pipe(RenderMode, v.description($ `
117
- If set to \`docker\`, Vivliostyle will render the PDF using a Docker container. (default: \`local\`)
118
- `)),
119
- preflight: v.pipe(v.union([v.literal('press-ready'), v.literal('press-ready-local')]), v.description($ `
120
- Apply the process to generate a print-ready PDF.
121
- `)),
122
- preflightOption: v.pipe(v.array(ValidString), v.description($ `
123
- Options for the preflight process (e.g., \`gray-scale\`, \`enforce-outline\`).
124
- Refer to the press-ready documentation for more information: [press-ready](https://github.com/vibranthq/press-ready)
125
- `)),
126
- })),
127
- ]), v.title('OutputConfig'));
128
- // Use v.looseObject to allow unknown keys in future VFM versions
129
- export const VfmReplaceRule = v.looseObject({
130
- test: v.instance(RegExp),
131
- match: v.pipe(v.function(),
132
- // https://github.com/fabian-hiller/valibot/issues/243
133
- v.metadata({
134
- typeString: '(result: RegExpMatchArray, h: any) => Object | string',
135
- })),
136
- });
137
- export const BrowserType = v.union([
138
- v.literal('chromium'),
139
- v.literal('firefox'),
140
- v.literal('webkit'),
141
- ]);
142
- export const ReadingProgression = v.union([v.literal('ltr'), v.literal('rtl')]);
143
- export const LogLevel = v.union([
144
- v.literal('silent'),
145
- v.literal('info'),
146
- v.literal('verbose'),
147
- v.literal('debug'),
148
- ]);
149
- const notAllowedPatternRe = /(^\s*[/\\]|^(.*[/\\])?\s*\.\.\s*([/\\].*)?$)/g;
150
- const validateAssetPatternSettings = (propName) => v.check((input) => input.every((pattern) => !notAllowedPatternRe.test(pattern)), `Invalid pattern was found in copyAsset.${propName} option`);
151
- // See the special characters of glob pattern
152
- // https://github.com/micromatch/picomatch
153
- const notAllowedExtensionRe = /([\\/*?@+!|(){}[\]]|\.\.|^\s*\.)/g;
154
- const validateAssetExtensionSettings = (propName) => v.check((input) => input.every((pattern) => !notAllowedExtensionRe.test(pattern)), `Invalid pattern was found in copyAsset.${propName} option`);
155
- export const CopyAssetConfig = v.pipe(v.partial(v.object({
156
- includes: v.pipe(v.array(ValidString), validateAssetPatternSettings('includes'), v.description($ `
157
- Directories and files to include as asset files. Supports wildcard characters for glob patterns.
158
- `)),
159
- excludes: v.pipe(v.array(ValidString), validateAssetPatternSettings('excludes'), v.description($ `
160
- Directories and files to exclude from asset files. Supports wildcard characters for glob patterns.
161
- `)),
162
- includeFileExtensions: v.pipe(v.array(ValidString), validateAssetExtensionSettings('includeFileExtensions'), v.description($ `
163
- File extensions to include as asset files. (default: \`[png, jpg, jpeg, svg, gif, webp, apng, ttf, otf, woff, woff2]\`)
164
- `)),
165
- excludeFileExtensions: v.pipe(v.array(ValidString), validateAssetExtensionSettings('excludeFileExtensions'), v.description($ `
166
- File extensions to exclude from asset files.
167
- `)),
168
- })), v.title('CopyAssetConfig'));
169
- export const TocConfig = v.pipe(v.partial(v.object({
170
- title: v.pipe(ValidString, v.description($ `
171
- Title of the generated ToC document.
172
- `)),
173
- htmlPath: v.pipe(ValidString, v.description($ `
174
- Location where the generated ToC document will be saved. (default: \`index.html\`)
175
- `)),
176
- sectionDepth: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(6), v.description($ `
177
- Depth of sections to include in the ToC document. (default: \`0\`)
178
- `)),
179
- transformDocumentList: v.pipe(v.function(), v.metadata({
180
- typeString: '(nodeList: StructuredDocument[]) => (propsList: { children: any }[]) => any',
181
- typeReferences: [StructuredDocument],
182
- }), v.description($ `
183
- Function to transform the document list.
184
- `)),
185
- transformSectionList: v.pipe(v.function(), v.metadata({
186
- typeString: '(nodeList: StructuredDocumentSection[]) => (propsList: { children: any }[]) => any',
187
- typeReferences: [StructuredDocumentSection],
188
- }), v.description($ `
189
- Function to transform the section list.
190
- `)),
191
- })), v.title('TocConfig'));
192
- export const CoverConfig = v.pipe(v.intersect([
193
- v.required(v.object({
194
- src: v.pipe(ValidString, v.description($ `
195
- Path to the cover image for the cover page.
196
- `)),
197
- }), 'Missing required field: src'),
198
- v.partial(v.object({
199
- name: v.pipe(v.string(), // Allow empty string
200
- v.description($ `
201
- Alternative text for the cover image.
202
- `)),
203
- htmlPath: v.pipe(v.union([ValidString, v.boolean()]), v.description($ `
204
- Path where the generated cover document will be saved. (default: \`cover.html\`)
205
- If set to a falsy value, the cover document will not be generated.
206
- `)),
207
- })),
208
- ]), v.title('CoverConfig'));
209
- const VfmConfig = v.pipe(v.partial(
210
- // Use v.looseObject to allow unknown keys in future VFM versions
211
- v.looseObject({
212
- style: v.pipe(v.union([v.array(ValidString), ValidString]), v.transform((input) => [input].flat()), v.description($ `
213
- Path(s) or URL(s) to custom stylesheets.
214
- `)),
215
- partial: v.pipe(v.boolean(), v.description($ `
216
- Output markdown fragments instead of a full document.
217
- `)),
218
- title: v.pipe(ValidString, v.description($ `
219
- Title of the document (ignored in partial mode).
220
- `)),
221
- language: v.pipe(ValidString, v.description($ `
222
- Language of the document (ignored in partial mode).
223
- `)),
224
- replace: v.pipe(v.array(VfmReplaceRule), v.description($ `
225
- Handlers for replacing matched HTML strings.
226
- `)),
227
- hardLineBreaks: v.pipe(v.boolean(), v.description($ `
228
- Insert \`<br>\` tags at hard line breaks without requiring spaces.
229
- `)),
230
- disableFormatHtml: v.pipe(v.boolean(), v.description($ `
231
- Disable automatic HTML formatting.
232
- `)),
233
- math: v.pipe(v.boolean(), v.description($ `
234
- Enable support for math syntax.
235
- `)),
236
- })), v.title('VfmConfig'));
237
- export const ServerConfig = v.pipe(v.partial(v.object({
238
- host: v.pipe(v.union([v.boolean(), ValidString]), v.description($ `
239
- IP address the server should listen on.
240
- Set to \`true\` to listen on all addresses.
241
- (default: \`true\` if a PDF build with Docker render mode is required, otherwise \`false\`)
242
- `)),
243
- port: v.pipe(v.number(), v.minValue(0), v.maxValue(65535), v.description($ `
244
- Port the server should listen on. (default: \`13000\`)
245
- `)),
246
- proxy: v.pipe(v.record(ValidString, v.union([
247
- v.pipe(v.custom((value) => Boolean(value && typeof value === 'object')), v.metadata({
248
- typeString: 'import("vite").ProxyOptions',
249
- })),
250
- ValidString,
251
- ])), v.description($ `
252
- Custom proxy rules for the Vivliostyle preview server.
253
- `)),
254
- })), v.title('ServerConfig'));
255
- export const BuildTask = v.pipe(v.intersect([
256
- v.required(v.object({
257
- entry: v.pipe(v.union([
258
- v.pipe(v.array(v.union([ValidString, EntryConfig])), v.minLength(1, 'At least one entry is required')),
259
- ArticleEntryConfig,
260
- ValidString,
261
- ]), v.transform((input) => [input]
262
- .flat()
263
- .map((item) => typeof item === 'string' ? { path: item } : item)), v.description($ `
264
- Entry file(s) of the document.
265
- `)),
266
- }), 'Missing required field: entry'),
267
- v.partial(v.object({
268
- title: v.pipe(ValidString, v.description($ `
269
- Title of the document.
270
- `)),
271
- author: v.pipe(ValidString, v.description($ `
272
- Author of the document.
273
- `)),
274
- theme: v.pipe(ThemeSpecifier, v.description($ `
275
- Theme package path(s) or URL(s) of the CSS file.
276
- `)),
277
- entryContext: v.pipe(ValidString, v.description($ `
278
- Directory containing the referenced entry file(s).
279
- `)),
280
- output: v.pipe(v.union([
281
- v.array(v.union([OutputConfig, ValidString])),
282
- OutputConfig,
283
- ValidString,
284
- ]), v.transform((input) => [input].flat().map((item) => {
285
- const obj = typeof item === 'string' ? { path: item } : item;
286
- const ext = upath.extname(obj.path).toLowerCase();
287
- return {
288
- ...obj,
289
- format: obj.format ||
290
- (ext === '.pdf'
291
- ? 'pdf'
292
- : ext === '.epub'
293
- ? 'epub'
294
- : 'webpub'),
295
- };
296
- })), v.description($ `
297
- Output options.
298
- `)),
299
- workspaceDir: v.pipe(ValidString, v.description($ `
300
- Directory where intermediate files (e.g., manuscript HTMLs, publication.json) are saved. (default: \`.vivliostyle\`)
301
- `)),
302
- /** @deprecated */
303
- includeAssets: v.pipe(v.union([v.array(ValidString), ValidString]), v.transform((input) => [input].flat()), v.metadata({ deprecated: true }), v.description($ `
304
- Use \`copyAsset.includes\` instead.
305
- `)),
306
- copyAsset: v.pipe(v.union([CopyAssetConfig]), v.description($ `
307
- Options for asset files to be copied when exporting output.
308
- `)),
309
- size: v.pipe(ValidString, v.description($ `
310
- PDF output size. (default: \`letter\`)
311
- - Preset: \`A5\`, \`A4\`, \`A3\`, \`B5\`, \`B4\`, \`JIS-B5\`, \`JIS-B4\`, \`letter\`, \`legal\`, \`ledger\`
312
- - Custom (comma-separated): \`182mm,257mm\` or \`8.5in,11in\`
313
- `)),
314
- pressReady: v.pipe(v.boolean(), v.description($ `
315
- Generate a press-ready PDF compatible with PDF/X-1a. (default: \`false\`)
316
- This option is equivalent to setting \`"preflight": "press-ready"\`.
317
- `)),
318
- language: v.pipe(ValidString, v.description($ `
319
- Language of the document.
320
- `)),
321
- readingProgression: v.pipe(ReadingProgression, v.description($ `
322
- Specifies the reading progression of the document.
323
- This is typically determined automatically by the CSS writing-mode.
324
- Use this option only if explicit configuration is needed.
325
- `)),
326
- toc: v.pipe(v.union([TocConfig, v.boolean(), ValidString]), v.transform((input) => typeof input === 'string'
327
- ? { htmlPath: input }
328
- : input === true
329
- ? {}
330
- : input || undefined), v.description($ `
331
- Options for Table of Contents (ToC) documents.
332
- `)),
333
- /** @deprecated */
334
- tocTitle: v.pipe(ValidString, v.metadata({ deprecated: true }), v.description($ `
335
- Use \`toc.title\` instead
336
- `)),
337
- cover: v.pipe(v.union([CoverConfig, ValidString]), v.transform((input) => typeof input === 'string' ? { src: input } : input), v.description($ `
338
- Options for cover images and cover page documents.
339
- `)),
340
- timeout: v.pipe(v.number(), v.description($ `
341
- Timeout limit for waiting for the Vivliostyle process (in ms). (default: \`120000\`)
342
- `)),
343
- documentProcessor: v.pipe(v.function(), v.metadata({
344
- typeString: '(option: import("@vivliostyle/vfm").StringifyMarkdownOptions, metadata: import("@vivliostyle/vfm").Metadata) => import("unified").Processor',
345
- }), v.description($ `
346
- Custom function to provide a unified Processor for converting markdown to HTML.
347
- `)),
348
- vfm: v.pipe(v.union([VfmConfig]), v.description($ `
349
- Options for converting Markdown into a stringified format (HTML).
350
- `)),
351
- image: v.pipe(ValidString, v.description($ `
352
- Docker image used for rendering.
353
- `)),
354
- /** @deprecated */
355
- http: v.pipe(v.boolean(), v.metadata({ deprecated: true }), v.description($ `
356
- This option is enabled by default, and the file protocol is no longer supported.
357
- `)),
358
- viewer: v.pipe(ValidString, v.description($ `
359
- URL of a custom viewer to display content instead of the default Vivliostyle CLI viewer.
360
- Useful for using a custom viewer with staging features (e.g., \`https://vivliostyle.vercel.app/\`).
361
- `)),
362
- viewerParam: v.pipe(ValidString, v.description($ `
363
- Parameters for the Vivliostyle viewer (e.g., \`allowScripts=false&pixelRatio=16\`).
364
- `)),
365
- browser: v.pipe(BrowserType, v.description($ `
366
- EXPERIMENTAL SUPPORT: Specifies the browser type for launching the Vivliostyle viewer.
367
- Currently, Firefox and Webkit support only the preview command.
368
- `)),
369
- base: v.pipe(ValidString, v.regex(/^\//, 'Base path must start with a slash'), v.check((value) => value !== '/', 'Base path must not be root'), v.transform((value) => value.replace(/(?!^)\/+$/, '')), v.description($ `
370
- Base path of the served documents. (default: \`/vivliostyle\`)
371
- `)),
372
- server: v.pipe(v.union([ServerConfig]), v.description($ `
373
- Options for the preview server.
374
- `)),
375
- static: v.pipe(v.record(v.pipe(ValidString, v.regex(/^\//, 'Base path must start with a slash'), v.transform((value) => value.replace(/(?!^)\/+$/, ''))), v.pipe(v.union([v.array(ValidString), ValidString]), v.transform((input) => [input].flat()))), v.description($ `
376
- Specifies static files to be served by the preview server.
377
- \`\`\`js
378
- export default {
379
- static: {
380
- '/static': 'path/to/static',
381
- '/': ['root1', 'root2'],
382
- },
383
- };
384
- \`\`\`
385
- `), v.transform((input) => {
386
- return input;
387
- })),
388
- temporaryFilePrefix: v.pipe(ValidString, v.description($ `
389
- Prefix for temporary file names.
390
- `)),
391
- vite: v.pipe(v.custom(() => true), v.metadata({
392
- typeString: 'import("vite").UserConfig',
393
- }), v.description($ `
394
- Configuration options for the Vite server.
395
- `)),
396
- viteConfigFile: v.pipe(v.union([ValidString, v.boolean()]), v.description($ `
397
- Path to the Vite config file.
398
- If a falsy value is provided, Vivliostyle CLI ignores the existing Vite config file.
399
- `)),
400
- })),
401
- ]), v.title('BuildTask'));
402
- /** @hidden */
403
- export const VivliostyleConfigSchema = v.pipe(v.union([
404
- v.pipe(v.array(BuildTask), v.minLength(1, 'At least one config entry is required')),
405
- BuildTask,
406
- ]), v.transform((input) => ({
407
- tasks: [input].flat(),
408
- inlineOptions: {},
409
- })), v.title('VivliostyleConfigSchema'));
410
- export const VivliostyleInlineConfig = v.pipe(v.partial(v.object({
411
- cwd: v.pipe(ValidString, v.description($ `
412
- Set a working directory.
413
- `)),
414
- config: v.pipe(ValidString, v.description($ `
415
- Path to vivliostyle.config.js.
416
- `)),
417
- configData: v.pipe(v.custom(() => true), v.metadata({
418
- typeString: 'VivliostyleConfigSchema',
419
- }), v.description($ `
420
- Vivliostyle config object.
421
- `)),
422
- input: v.pipe(ValidString, v.transform((input) => {
423
- const ext = upath.extname(input).toLowerCase();
424
- if (/^https?:/.test(input)) {
425
- return { format: 'webbook', entry: input };
426
- }
427
- else if (ext === '.md' || ext === '.markdown') {
428
- return { format: 'markdown', entry: input };
429
- }
430
- else if (ext === '.json' || ext === '.jsonld') {
431
- return { format: 'pub-manifest', entry: input };
432
- }
433
- else if (ext === '.epub') {
434
- return { format: 'epub', entry: input };
435
- }
436
- else if (ext === '.opf') {
437
- return { format: 'epub-opf', entry: input };
438
- }
439
- else if (['.html', '.htm', '.xhtml', '.xht'].includes(ext)) {
440
- return { format: 'webbook', entry: input };
441
- }
442
- throw new Error(`Cannot detect an input format: ${input}`);
443
- }), v.description($ `
444
- Input file of document.
445
- `)),
446
- output: v.pipe(v.union([
447
- v.array(v.union([OutputConfig, ValidString])),
448
- OutputConfig,
449
- ValidString,
450
- ]), v.transform((input) => [input].flat().map((item) => {
451
- const obj = typeof item === 'string' ? { path: item } : item;
452
- const ext = upath.extname(obj.path).toLowerCase();
453
- return {
454
- ...obj,
455
- format: obj.format ||
456
- (ext === '.pdf' ? 'pdf' : ext === '.epub' ? 'epub' : 'webpub'),
457
- };
458
- })), v.description($ `
459
- Output file name or directory.
460
- `)),
461
- theme: v.pipe(ThemeSpecifier, v.description($ `
462
- Theme path or package name.
463
- `)),
464
- size: v.pipe(ValidString, v.description($ `
465
- Output pdf size.
466
- preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal, ledger
467
- custom(comma separated): 182mm,257mm or 8.5in,11in
468
- `)),
469
- cropMarks: v.pipe(v.boolean(), v.description($ `
470
- Print crop marks.
471
- `)),
472
- bleed: v.pipe(ValidString, v.description($ `
473
- Extent of the bleed area for printing with crop marks. [3mm]
474
- `)),
475
- cropOffset: v.pipe(ValidString, v.description($ `
476
- Distance between the edge of the trim size and the edge of the media size. [auto (13mm + bleed)]
477
- `)),
478
- css: v.pipe(ValidString, v.description($ `
479
- Custom style CSS code. (ex: ":root {--my-color: lime;}")
480
- `)),
481
- style: v.pipe(ValidString, v.description($ `
482
- Additional stylesheet URL or path.
483
- `)),
484
- userStyle: v.pipe(ValidString, v.description($ `
485
- User stylesheet URL or path.
486
- `)),
487
- singleDoc: v.pipe(v.boolean(), v.description($ `
488
- Single HTML document input.
489
- `)),
490
- quick: v.pipe(v.boolean(), v.description($ `
491
- Quick loading with rough page count.
492
- `)),
493
- pressReady: v.pipe(v.boolean(), v.description($ `
494
- Make generated PDF compatible with press ready PDF/X-1a.
495
- This option is equivalent with "preflight": "press-ready"
496
- `)),
497
- title: v.pipe(ValidString, v.description($ `Title`)),
498
- author: v.pipe(ValidString, v.description($ `Author`)),
499
- language: v.pipe(ValidString, v.description($ `Language`)),
500
- readingProgression: v.pipe(ReadingProgression, v.description($ `
501
- Direction of reading progression.
502
- `)),
503
- timeout: v.pipe(v.number(), v.description($ `
504
- Timeout limit for waiting Vivliostyle process (ms).
505
- `)),
506
- renderMode: v.pipe(RenderMode, v.description($ `
507
- If docker is set, Vivliostyle try to render PDF on Docker container. [local]
508
- `)),
509
- preflight: v.pipe(v.union([v.literal('press-ready'), v.literal('press-ready-local')]), v.description($ `
510
- Apply the process to generate PDF for printing.
511
- `)),
512
- preflightOption: v.pipe(v.union([v.array(ValidString), ValidString]), v.transform((input) => [input].flat()), v.description($ `
513
- Options for preflight process (ex: gray-scale, enforce-outline).
514
- Please refer the document of press-ready for further information.
515
- `)),
516
- sandbox: v.pipe(v.boolean(), v.description($ `Launch chrome with sandbox.`)),
517
- executableBrowser: v.pipe(ValidString, v.description($ `
518
- Specify a path of executable browser you installed.
519
- `)),
520
- image: v.pipe(ValidString, v.description($ `
521
- Specify a docker image to render.
522
- `)),
523
- viewer: v.pipe(ValidString, v.description($ `
524
- Specify a URL of displaying viewer instead of vivliostyle-cli's one.
525
- It is useful that using own viewer that has staging features. (ex: https://vivliostyle.vercel.app/)
526
- `)),
527
- viewerParam: v.pipe(ValidString, v.description($ `
528
- Specify viewer parameters. (ex: "allowScripts=false&pixelRatio=16")
529
- `)),
530
- browser: v.pipe(BrowserType, v.description($ `
531
- Specify a browser type to launch Vivliostyle viewer [chromium].
532
- `)),
533
- proxyServer: v.pipe(ValidString, v.description($ `
534
- HTTP/SOCK proxy server url for underlying Playwright.
535
- `)),
536
- proxyBypass: v.pipe(ValidString, v.description($ `
537
- Optional comma-separated domains to bypass proxy.
538
- `)),
539
- proxyUser: v.pipe(ValidString, v.description($ `
540
- Optional username for HTTP proxy authentication.
541
- `)),
542
- proxyPass: v.pipe(ValidString, v.description($ `
543
- Optional password for HTTP proxy authentication.
544
- `)),
545
- logLevel: v.pipe(LogLevel, v.description($ `
546
- Specify a log level of console outputs.
547
- `)),
548
- ignoreHttpsErrors: v.pipe(v.boolean(), v.description($ `
549
- true to ignore HTTPS errors when Playwright browser opens a new page.
550
- `)),
551
- openViewer: v.pipe(v.boolean(), v.description($ `
552
- Open a browser to display the document preview.
553
- `)),
554
- enableStaticServe: v.pipe(v.boolean(), v.description($ `
555
- Enable static file serving as configured in the Vivliostyle config file.
556
- `)),
557
- enableViewerStartPage: v.pipe(v.boolean(), v.description($ `
558
- Open a start page of the viewer when the input file is not specified.
559
- `)),
560
- vite: v.pipe(v.custom(() => true), v.metadata({
561
- typeString: 'import("vite").UserConfig',
562
- }), v.description($ `
563
- Configuration options for the Vite server.
564
- `)),
565
- viteConfigFile: v.pipe(v.union([ValidString, v.boolean()]), v.description($ `
566
- Path to the Vite config file.
567
- If a falsy value is provided, Vivliostyle CLI ignores the existing Vite config file.
568
- `)),
569
- host: v.pipe(v.union([v.boolean(), ValidString]), v.description($ `
570
- IP address the server should listen on.
571
- Set to \`true\` to listen on all addresses.
572
- (default: \`true\` if a PDF build with Docker render mode is required, otherwise \`false\`)
573
- `)),
574
- port: v.pipe(v.number(), v.minValue(0), v.maxValue(65535), v.description($ `
575
- Port the server should listen on. (default: \`13000\`)
576
- `)),
577
- logger: v.pipe(v.custom(() => true), v.metadata({
578
- typeString: 'LoggerInterface',
579
- }), v.description($ `
580
- Custom logger interface.
581
- `)),
582
- })), v.check((options) => !options.input ||
583
- !options.output ||
584
- !['epub', 'epub-opf'].includes(options.input.format) ||
585
- options.output.every((o) => o.format !== 'webpub'), 'Exporting webpub format from EPUB or OPF file is not supported.'), v.check((options) => !options.input ||
586
- !options.output ||
587
- !['epub', 'epub-opf'].includes(options.input.format) ||
588
- options.output.every((o) => o.format !== 'epub'), 'Exporting EPUB format from EPUB or OPF file is not supported.'), v.title('VivliostyleInlineConfig'));
589
- //# sourceMappingURL=schema.js.map