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

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-4ZNBH6IA.js +74 -0
  2. package/dist/{core/init.js → chunk-6ETFX7W2.js} +39 -27
  3. package/dist/chunk-BIEQXUOY.js +50 -0
  4. package/dist/chunk-BPSQMFSC.js +54 -0
  5. package/dist/chunk-BT47BDZK.js +85 -0
  6. package/dist/chunk-DMARNPN5.js +1073 -0
  7. package/dist/chunk-EX7EA34F.js +64 -0
  8. package/dist/chunk-SPYTZBBG.js +4988 -0
  9. package/dist/chunk-UQHNZL7X.js +590 -0
  10. package/dist/chunk-WX6JHPSL.js +16 -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 +225 -218
  20. package/dist/config/schema.js +50 -588
  21. package/dist/index.d.ts +326 -8
  22. package/dist/index.js +47 -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
package/dist/index.d.ts CHANGED
@@ -1,9 +1,326 @@
1
- import { VivliostyleInlineConfig } from './config/schema.js';
2
- import type { PublicationManifest as _PublicationManifest } from './schema/publication.schema.js';
3
- export type { StructuredDocument, StructuredDocumentSection, VivliostyleConfigSchema, } from './config/schema.js';
1
+ import * as vite from 'vite';
2
+ import { ResolvedConfig, UserConfig } from 'vite';
3
+ import { StructuredDocument, StructuredDocumentSection, InputFormat, BrowserType, ParsedVivliostyleInlineConfig, VivliostyleInlineConfig } from './config/schema.js';
4
+ export { VivliostyleConfigSchema } from './config/schema.js';
4
5
  export { createVitePlugin } from './vite-adapter.js';
6
+ import { StringifyMarkdownOptions, Metadata } from '@vivliostyle/vfm';
7
+ import { Processor } from 'unified';
8
+ import 'valibot';
9
+
10
+ /**
11
+ * This file was automatically generated by json-schema-to-typescript.
12
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
13
+ * and run json-schema-to-typescript to regenerate this file.
14
+ */
15
+ type PublicationContexts = [] | ['https://schema.org'] | [
16
+ 'https://schema.org',
17
+ 'https://www.w3.org/ns/pub-context',
18
+ ...(string | {
19
+ language: BCP47LanguageTag;
20
+ direction?: never;
21
+ [k: string]: unknown;
22
+ } | {
23
+ direction: 'ltr' | 'rtl';
24
+ language?: never;
25
+ [k: string]: unknown;
26
+ } | {
27
+ language: BCP47LanguageTag;
28
+ direction: 'ltr' | 'rtl';
29
+ [k: string]: unknown;
30
+ } | {
31
+ language?: never;
32
+ direction?: never;
33
+ [k: string]: unknown;
34
+ })[]
35
+ ];
36
+ type BCP47LanguageTag = string;
37
+ type URL = string;
38
+ type UniqueStrings = string | string[];
39
+ type ListsOfItemList = SchemaOrgItemListObject | SchemaOrgItemListObject[];
40
+ type LocalizableStringOrObject = string | (string | LocalizableStringObject)[] | LocalizableStringObject;
41
+ type Contributor = string | (string | ContributorObject)[] | ContributorObject;
42
+ type URLs = string | string[];
43
+ type Duration = string;
44
+ type Languages = BCP47LanguageTag | BCP47LanguageTag[];
45
+ type Dates = string;
46
+ type ResourceCategorization = (URL | PublicationLinks) | (URL | PublicationLinks)[];
47
+ interface PublicationManifest$1 {
48
+ '@context': PublicationContexts;
49
+ type?: string | string[];
50
+ conformsTo: URL | URL[];
51
+ id?: string;
52
+ abridged?: boolean;
53
+ accessMode?: UniqueStrings;
54
+ accessModeSufficient?: ListsOfItemList;
55
+ accessibilityFeature?: UniqueStrings;
56
+ accessibilityHazard?: UniqueStrings;
57
+ accessibilitySummary?: LocalizableStringOrObject;
58
+ artist?: Contributor;
59
+ author?: Contributor;
60
+ colorist?: Contributor;
61
+ contributor?: Contributor;
62
+ creator?: Contributor;
63
+ editor?: Contributor;
64
+ illustrator?: Contributor;
65
+ inker?: Contributor;
66
+ letterer?: Contributor;
67
+ penciler?: Contributor;
68
+ publisher?: Contributor;
69
+ readBy?: Contributor;
70
+ translator?: Contributor;
71
+ url?: URLs;
72
+ duration?: Duration;
73
+ inLanguage?: Languages;
74
+ dateModified?: Dates;
75
+ datePublished?: Dates;
76
+ name?: LocalizableStringOrObject;
77
+ readingOrder?: ResourceCategorization;
78
+ resources?: ResourceCategorization;
79
+ links?: ResourceCategorization;
80
+ readingProgression?: 'ltr' | 'rtl';
81
+ [k: string]: unknown;
82
+ }
83
+ interface SchemaOrgItemListObject {
84
+ type: 'ItemList' | string[];
85
+ itemListElement: string[];
86
+ [k: string]: unknown;
87
+ }
88
+ interface LocalizableStringObject {
89
+ value: string;
90
+ language?: BCP47LanguageTag;
91
+ [k: string]: unknown;
92
+ }
93
+ interface ContributorObject {
94
+ name: LocalizableStringOrObject;
95
+ id?: URL;
96
+ type?: ('Person' | 'Organization') | string[];
97
+ url?: URL;
98
+ identifier?: string[];
99
+ [k: string]: unknown;
100
+ }
101
+ interface PublicationLinks {
102
+ type?: 'LinkedResource' | string[];
103
+ url: URL;
104
+ encodingFormat?: string;
105
+ name?: LocalizableStringOrObject;
106
+ description?: string | LocalizableStringObject;
107
+ rel?: string | string[];
108
+ integrity?: string;
109
+ duration?: Duration;
110
+ alternate?: ResourceCategorization;
111
+ [k: string]: unknown;
112
+ }
113
+
114
+ type ParsedTheme = UriTheme | FileTheme | PackageTheme;
115
+ interface UriTheme {
116
+ type: 'uri';
117
+ name: string;
118
+ location: string;
119
+ }
120
+ interface FileTheme {
121
+ type: 'file';
122
+ name: string;
123
+ source: string;
124
+ location: string;
125
+ }
126
+ interface PackageTheme {
127
+ type: 'package';
128
+ name: string;
129
+ specifier: string;
130
+ location: string;
131
+ importPath?: string | string[];
132
+ }
133
+ type EntrySource = FileEntrySource | UriEntrySource;
134
+ interface FileEntrySource {
135
+ type: 'file';
136
+ pathname: string;
137
+ contentType: ManuscriptMediaType;
138
+ }
139
+ interface UriEntrySource {
140
+ type: 'uri';
141
+ href: string;
142
+ rootDir: string;
143
+ }
144
+ declare const manuscriptMediaTypes: readonly ["text/markdown", "text/html", "application/xhtml+xml"];
145
+ type ManuscriptMediaType = (typeof manuscriptMediaTypes)[number];
146
+ interface ManuscriptEntry {
147
+ contentType: ManuscriptMediaType;
148
+ title?: string;
149
+ themes: ParsedTheme[];
150
+ source: EntrySource;
151
+ template?: undefined;
152
+ target: string;
153
+ rel?: string | string[];
154
+ }
155
+ interface ContentsEntry {
156
+ rel: 'contents';
157
+ title?: string;
158
+ themes: ParsedTheme[];
159
+ source?: undefined;
160
+ template?: EntrySource;
161
+ target: string;
162
+ tocTitle: string;
163
+ sectionDepth: number;
164
+ transform: {
165
+ transformDocumentList: ((nodeList: StructuredDocument[]) => (propsList: {
166
+ children: any;
167
+ }[]) => any) | undefined;
168
+ transformSectionList: ((nodeList: StructuredDocumentSection[]) => (propsList: {
169
+ children: any;
170
+ }[]) => any) | undefined;
171
+ };
172
+ pageBreakBefore?: 'left' | 'right' | 'recto' | 'verso';
173
+ pageCounterReset?: number;
174
+ }
175
+ interface CoverEntry {
176
+ rel: 'cover';
177
+ title?: string;
178
+ themes: ParsedTheme[];
179
+ source?: undefined;
180
+ template?: EntrySource;
181
+ target: string;
182
+ coverImageSrc: string;
183
+ coverImageAlt: string;
184
+ pageBreakBefore?: 'left' | 'right' | 'recto' | 'verso';
185
+ }
186
+ type ParsedEntry = ManuscriptEntry | ContentsEntry | CoverEntry;
187
+ interface WebPublicationManifestConfig {
188
+ type: 'webpub';
189
+ manifestPath: string;
190
+ needToGenerateManifest: boolean;
191
+ }
192
+ interface EpubEntryConfig {
193
+ type: 'epub';
194
+ epubPath: string;
195
+ epubTmpOutputDir: string;
196
+ }
197
+ interface EpubOpfEntryConfig {
198
+ type: 'epub-opf';
199
+ epubOpfPath: string;
200
+ }
201
+ interface WebBookEntryConfig {
202
+ type: 'webbook';
203
+ webbookEntryUrl: string;
204
+ webbookPath: string | undefined;
205
+ }
206
+ type ViewerInputConfig = WebPublicationManifestConfig | EpubEntryConfig | EpubOpfEntryConfig | WebBookEntryConfig;
207
+ interface PdfOutput {
208
+ format: 'pdf';
209
+ path: string;
210
+ renderMode: 'local' | 'docker';
211
+ preflight: 'press-ready' | 'press-ready-local' | undefined;
212
+ preflightOption: string[];
213
+ }
214
+ interface WebPublicationOutput {
215
+ format: 'webpub';
216
+ path: string;
217
+ }
218
+ interface EpubOutput {
219
+ format: 'epub';
220
+ path: string;
221
+ version: '3.0';
222
+ }
223
+ type OutputConfig = PdfOutput | WebPublicationOutput | EpubOutput;
224
+ type PageSize = {
225
+ format: string;
226
+ } | {
227
+ width: string;
228
+ height: string;
229
+ };
230
+ type DocumentProcessorFactory = (options: StringifyMarkdownOptions, metadata: Metadata) => Processor;
231
+ type ResolvedTaskConfig = {
232
+ context: string;
233
+ entryContextDir: string;
234
+ workspaceDir: string;
235
+ themesDir: string;
236
+ entries: ParsedEntry[];
237
+ input: {
238
+ format: InputFormat;
239
+ entry: string;
240
+ };
241
+ viewerInput: ViewerInputConfig;
242
+ outputs: OutputConfig[];
243
+ themeIndexes: Set<ParsedTheme>;
244
+ copyAsset: {
245
+ includes: string[];
246
+ excludes: string[];
247
+ fileExtensions: string[];
248
+ };
249
+ exportAliases: {
250
+ source: string;
251
+ target: string;
252
+ }[];
253
+ temporaryFilePrefix: string;
254
+ size: PageSize | undefined;
255
+ cropMarks: boolean;
256
+ bleed: string | undefined;
257
+ cropOffset: string | undefined;
258
+ css: string | undefined;
259
+ customStyle: string | undefined;
260
+ customUserStyle: string | undefined;
261
+ singleDoc: boolean;
262
+ quick: boolean;
263
+ title: string | undefined;
264
+ author: string | undefined;
265
+ language: string | undefined;
266
+ readingProgression: 'ltr' | 'rtl' | undefined;
267
+ documentProcessorFactory: DocumentProcessorFactory;
268
+ vfmOptions: {
269
+ hardLineBreaks: boolean;
270
+ disableFormatHtml: boolean;
271
+ };
272
+ cover: {
273
+ src: string;
274
+ name: string;
275
+ } | undefined;
276
+ timeout: number;
277
+ sandbox: boolean;
278
+ browser: {
279
+ type: BrowserType;
280
+ executablePath: string | undefined;
281
+ };
282
+ proxy: {
283
+ server: string;
284
+ bypass: string | undefined;
285
+ username: string | undefined;
286
+ password: string | undefined;
287
+ } | undefined;
288
+ image: string;
289
+ viewer: string | undefined;
290
+ viewerParam: string | undefined;
291
+ logLevel: 'silent' | 'info' | 'verbose' | 'debug';
292
+ ignoreHttpsErrors: boolean;
293
+ base: string;
294
+ server: Required<Pick<ResolvedConfig['server'], 'host' | 'port' | 'proxy'>>;
295
+ static: Record<string, string[]>;
296
+ rootUrl: string;
297
+ viteConfig: UserConfig | undefined;
298
+ viteConfigFile: string | boolean;
299
+ };
300
+
301
+ declare function vsBrowserPlugin({ config: _config, inlineConfig, }: {
302
+ config: ResolvedTaskConfig;
303
+ inlineConfig: ParsedVivliostyleInlineConfig;
304
+ }): vite.Plugin;
305
+
306
+ declare function vsDevServerPlugin({ config: _config, inlineConfig, }: {
307
+ config: ResolvedTaskConfig;
308
+ inlineConfig: ParsedVivliostyleInlineConfig;
309
+ }): vite.Plugin;
310
+
311
+ declare function vsStaticServePlugin({ config: _config, inlineConfig, }: {
312
+ config: ResolvedTaskConfig;
313
+ inlineConfig: ParsedVivliostyleInlineConfig;
314
+ }): vite.Plugin;
315
+
316
+ declare function vsViewerPlugin(_?: {
317
+ config: ResolvedTaskConfig;
318
+ inlineConfig: ParsedVivliostyleInlineConfig;
319
+ }): vite.Plugin;
320
+
5
321
  /** @hidden */
6
- export type PublicationManifest = _PublicationManifest;
322
+ type PublicationManifest = PublicationManifest$1;
323
+
7
324
  /**
8
325
  * Build publication file(s) from the given configuration.
9
326
  *
@@ -18,19 +335,20 @@ export type PublicationManifest = _PublicationManifest;
18
335
  * @param options
19
336
  * @returns
20
337
  */
21
- export declare function build(options: VivliostyleInlineConfig): Promise<void>;
338
+ declare function build(options: VivliostyleInlineConfig): Promise<void>;
22
339
  /**
23
340
  * Initialize a new vivliostyle.config.js file.
24
341
  *
25
342
  * @param options
26
343
  * @returns
27
344
  */
28
- export declare function init(options: VivliostyleInlineConfig): Promise<void>;
345
+ declare function init(options: VivliostyleInlineConfig): Promise<void>;
29
346
  /**
30
347
  * Open a browser for previewing the publication.
31
348
  *
32
349
  * @param options
33
350
  * @returns
34
351
  */
35
- export declare function preview(options: VivliostyleInlineConfig): Promise<import("vite").ViteDevServer>;
36
- //# sourceMappingURL=index.d.ts.map
352
+ declare function preview(options: VivliostyleInlineConfig): Promise<vite.ViteDevServer>;
353
+
354
+ export { type PublicationManifest, StructuredDocument, StructuredDocumentSection, build, init, preview, vsBrowserPlugin, vsDevServerPlugin, vsStaticServePlugin, vsViewerPlugin };
package/dist/index.js CHANGED
@@ -1,45 +1,50 @@
1
- import * as v from 'valibot';
2
- import { VivliostyleInlineConfig } from './config/schema.js';
3
- import { build as _build } from './core/build.js';
4
- import { init as _init } from './core/init.js';
5
- import { preview as _preview } from './core/preview.js';
6
- export { createVitePlugin } from './vite-adapter.js';
7
- /**
8
- * Build publication file(s) from the given configuration.
9
- *
10
- * ```ts
11
- * import { build } from '@vivliostyle/cli';
12
- * build({
13
- * configPath: './vivliostyle.config.js',
14
- * logLevel: 'silent',
15
- * });
16
- * ```
17
- *
18
- * @param options
19
- * @returns
20
- */
21
- export async function build(options) {
22
- const parsed = v.parse(VivliostyleInlineConfig, options);
23
- return await _build(parsed);
1
+ import {
2
+ createVitePlugin
3
+ } from "./chunk-BPSQMFSC.js";
4
+ import {
5
+ build
6
+ } from "./chunk-UQHNZL7X.js";
7
+ import {
8
+ init
9
+ } from "./chunk-6ETFX7W2.js";
10
+ import {
11
+ preview
12
+ } from "./chunk-BT47BDZK.js";
13
+ import "./chunk-4ZNBH6IA.js";
14
+ import {
15
+ vsBrowserPlugin,
16
+ vsDevServerPlugin,
17
+ vsStaticServePlugin,
18
+ vsViewerPlugin
19
+ } from "./chunk-SPYTZBBG.js";
20
+ import "./chunk-EX7EA34F.js";
21
+ import "./chunk-WX6JHPSL.js";
22
+ import {
23
+ VivliostyleInlineConfig
24
+ } from "./chunk-DMARNPN5.js";
25
+ import "./chunk-BIEQXUOY.js";
26
+
27
+ // src/index.ts
28
+ import * as v from "valibot";
29
+ async function build2(options) {
30
+ const parsed = v.parse(VivliostyleInlineConfig, options);
31
+ return await build(parsed);
24
32
  }
25
- /**
26
- * Initialize a new vivliostyle.config.js file.
27
- *
28
- * @param options
29
- * @returns
30
- */
31
- export async function init(options) {
32
- const parsed = v.parse(VivliostyleInlineConfig, options);
33
- return await _init(parsed);
33
+ async function init2(options) {
34
+ const parsed = v.parse(VivliostyleInlineConfig, options);
35
+ return await init(parsed);
34
36
  }
35
- /**
36
- * Open a browser for previewing the publication.
37
- *
38
- * @param options
39
- * @returns
40
- */
41
- export async function preview(options) {
42
- const parsed = v.parse(VivliostyleInlineConfig, options);
43
- return await _preview(parsed);
37
+ async function preview2(options) {
38
+ const parsed = v.parse(VivliostyleInlineConfig, options);
39
+ return await preview(parsed);
44
40
  }
45
- //# sourceMappingURL=index.js.map
41
+ export {
42
+ build2 as build,
43
+ createVitePlugin,
44
+ init2 as init,
45
+ preview2 as preview,
46
+ vsBrowserPlugin,
47
+ vsDevServerPlugin,
48
+ vsStaticServePlugin,
49
+ vsViewerPlugin
50
+ };
@@ -0,0 +1,21 @@
1
+ import * as playwright_core_lib_server from 'playwright-core/lib/server';
2
+ import * as playwright_core from 'playwright-core';
3
+ import * as pdf_lib from 'pdf-lib';
4
+ import * as press_ready from 'press-ready';
5
+ import * as execa from 'execa';
6
+ import * as command_exists from 'command-exists';
7
+ import * as _napi_rs_canvas from '@napi-rs/canvas';
8
+
9
+ declare const nodeExternalModules: readonly ["@napi-rs/canvas", "command-exists", "execa", "press-ready", "pdf-lib", "playwright-core", "playwright-core/lib/server"];
10
+ type NodeExternalModules = {
11
+ '@napi-rs/canvas': typeof _napi_rs_canvas;
12
+ 'command-exists': typeof command_exists;
13
+ execa: typeof execa;
14
+ 'press-ready': typeof press_ready;
15
+ 'pdf-lib': typeof pdf_lib;
16
+ 'playwright-core': typeof playwright_core;
17
+ 'playwright-core/lib/server': typeof playwright_core_lib_server;
18
+ };
19
+ declare const importNodeModule: <T extends (typeof nodeExternalModules)[number]>(name: T) => Promise<NodeExternalModules[T]>;
20
+
21
+ export { importNodeModule, nodeExternalModules };
@@ -0,0 +1,9 @@
1
+ import {
2
+ importNodeModule,
3
+ nodeExternalModules
4
+ } from "./chunk-WX6JHPSL.js";
5
+ import "./chunk-BIEQXUOY.js";
6
+ export {
7
+ importNodeModule,
8
+ nodeExternalModules
9
+ };
@@ -1,3 +1,9 @@
1
+ import * as vite from 'vite';
1
2
  import { VivliostyleInlineConfig } from './config/schema.js';
2
- export declare function createVitePlugin(inlineConfig?: VivliostyleInlineConfig): Promise<import('vite').Plugin[]>;
3
- //# sourceMappingURL=vite-adapter.d.ts.map
3
+ import '@vivliostyle/vfm';
4
+ import 'unified';
5
+ import 'valibot';
6
+
7
+ declare function createVitePlugin(inlineConfig?: VivliostyleInlineConfig): Promise<vite.Plugin[]>;
8
+
9
+ export { createVitePlugin };
@@ -1,43 +1,11 @@
1
- import * as v from 'valibot';
2
- import * as vite from 'vite';
3
- import { setupConfigFromFlags } from './commands/cli-flags.js';
4
- import { loadVivliostyleConfig, warnDeprecatedConfig } from './config/load.js';
5
- import { mergeInlineConfig } from './config/merge.js';
6
- import { resolveTaskConfig } from './config/resolve.js';
7
- import { VivliostyleInlineConfig } from './config/schema.js';
8
- import { Logger } from './logger.js';
9
- import { vsBrowserPlugin } from './vite/vite-plugin-browser.js';
10
- import { vsDevServerPlugin } from './vite/vite-plugin-dev-server.js';
11
- import { vsStaticServePlugin } from './vite/vite-plugin-static-serve.js';
12
- import { vsViewerPlugin } from './vite/vite-plugin-viewer.js';
13
- export async function createVitePlugin(inlineConfig = {}) {
14
- const parsedInlineConfig = v.parse(VivliostyleInlineConfig, inlineConfig);
15
- Logger.setLogLevel(parsedInlineConfig.logLevel);
16
- if (parsedInlineConfig.logger) {
17
- Logger.setCustomLogger(parsedInlineConfig.logger);
18
- }
19
- else {
20
- const { info, warn, error } = vite.createLogger('info', {
21
- prefix: '[vivliostyle]',
22
- });
23
- Logger.setCustomLogger({
24
- info: (msg) => info(msg, { timestamp: true }),
25
- warn: (msg) => warn(msg, { timestamp: true }),
26
- error: (msg) => error(msg, { timestamp: true }),
27
- });
28
- }
29
- Logger.debug('inlineConfig %O', parsedInlineConfig);
30
- const vivliostyleConfig = (await loadVivliostyleConfig(parsedInlineConfig)) ??
31
- setupConfigFromFlags(parsedInlineConfig);
32
- warnDeprecatedConfig(vivliostyleConfig);
33
- const { tasks, inlineOptions } = mergeInlineConfig(vivliostyleConfig, parsedInlineConfig);
34
- const config = resolveTaskConfig(tasks[0], inlineOptions);
35
- Logger.debug('config %O', config);
36
- return [
37
- vsDevServerPlugin({ config, inlineConfig: parsedInlineConfig }),
38
- vsViewerPlugin({ config, inlineConfig: parsedInlineConfig }),
39
- vsBrowserPlugin({ config, inlineConfig: parsedInlineConfig }),
40
- vsStaticServePlugin({ config, inlineConfig: parsedInlineConfig }),
41
- ];
42
- }
43
- //# sourceMappingURL=vite-adapter.js.map
1
+ import {
2
+ createVitePlugin
3
+ } from "./chunk-BPSQMFSC.js";
4
+ import "./chunk-SPYTZBBG.js";
5
+ import "./chunk-EX7EA34F.js";
6
+ import "./chunk-WX6JHPSL.js";
7
+ import "./chunk-DMARNPN5.js";
8
+ import "./chunk-BIEQXUOY.js";
9
+ export {
10
+ createVitePlugin
11
+ };
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@vivliostyle/cli",
3
3
  "description": "Save the pdf file via headless browser and Vivliostyle.",
4
- "version": "9.0.0-next.3",
4
+ "version": "9.0.0-next.5",
5
5
  "author": "spring_raining <harusamex.com@gmail.com>",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "build": "yarn clean && run-s build:*",
9
- "build:cli": "tsc && shx chmod +x dist/cli.js",
10
- "build:docs": "node --loader ts-node/esm --no-warnings scripts/update-docs.ts",
8
+ "build": "run-s build:*",
9
+ "build:cli": "tsup && shx chmod +x dist/cli.js",
10
+ "build:docs": "tsx scripts/update-docs.ts",
11
11
  "generate:schema": "json2ts -i schemas/pub-manifest/publication.schema.json -o src/schema/publication.schema.ts --cwd schemas/pub-manifest",
12
12
  "clean": "shx rm -rf dist tmp",
13
- "dev": "tsc -w --preserveWatchOutput",
13
+ "dev": "tsup --watch src",
14
14
  "example": "yarn --cwd example build",
15
15
  "pretest": "playwright-core install chromium --no-shell",
16
16
  "release": "release-it",
@@ -18,11 +18,14 @@
18
18
  "test": "vitest run --coverage",
19
19
  "prepare": "husky"
20
20
  },
21
+ "peerDependencies": {
22
+ "vite": ">=6"
23
+ },
21
24
  "dependencies": {
22
25
  "@babel/code-frame": "^7.24.7",
23
26
  "@humanwhocodes/momoa": "^3.2.1",
24
27
  "@napi-rs/canvas": "0.1.41",
25
- "@npmcli/arborist": "^6.1.3",
28
+ "@npmcli/arborist": "^7.5.4",
26
29
  "@vivliostyle/jsdom": "25.0.1-vivliostyle-cli.1",
27
30
  "@vivliostyle/vfm": "2.2.1",
28
31
  "@vivliostyle/viewer": "2.30.7",
@@ -44,7 +47,9 @@
44
47
  "hastscript": "^9.0.0",
45
48
  "mime-types": "^2.1.32",
46
49
  "node-stream-zip": "^1.14.0",
50
+ "npm-package-arg": "^11.0.2",
47
51
  "pdf-lib": "^1.16.0",
52
+ "picomatch": "^4.0.2",
48
53
  "playwright-core": "1.49.0",
49
54
  "press-ready": "^4.0.3",
50
55
  "prettier": "^3.3.3",
@@ -57,7 +62,6 @@
57
62
  "uuid": "^8.3.2",
58
63
  "valibot": "^0.42.1",
59
64
  "vfile": "^4.2.1",
60
- "vite": "6.0.3",
61
65
  "w3c-xmlserializer": "^4.0.0",
62
66
  "whatwg-mimetype": "^3.0.0",
63
67
  "yocto-spinner": "^0.1.2",
@@ -76,8 +80,8 @@
76
80
  "@types/jsdom": "^21.1.1",
77
81
  "@types/mime-types": "^2.1.1",
78
82
  "@types/node": "^22.5.4",
79
- "@types/npm-package-arg": "^6.1.1",
80
- "@types/npmcli__arborist": "^5.6.0",
83
+ "@types/npm-package-arg": "^6.1.4",
84
+ "@types/npmcli__arborist": "^6.3.0",
81
85
  "@types/picomatch": "^3.0.1",
82
86
  "@types/supertest": "^6.0.2",
83
87
  "@types/tmp": "^0.2.1",
@@ -95,10 +99,12 @@
95
99
  "release-it": "^15.6.0",
96
100
  "shx": "^0.3.3",
97
101
  "supertest": "^7.0.0",
98
- "ts-node": "^10.9.2",
102
+ "tsup": "^8.3.6",
103
+ "tsx": "^4.19.2",
99
104
  "typedoc": "^0.26.7",
100
105
  "typedoc-plugin-markdown": "^4.2.9",
101
106
  "typescript": "^5.5.4",
107
+ "vite": "6.0.3",
102
108
  "vitest": "^2.1.8"
103
109
  },
104
110
  "main": "dist/index.js",
@@ -109,8 +115,22 @@
109
115
  "types": "./dist/index.d.ts",
110
116
  "import": "./dist/index.js"
111
117
  },
112
- "./schemas/*": "./schemas/*",
113
- "./dist/*": "./dist/*",
118
+ "./cli": {
119
+ "types": "./dist/cli.d.ts",
120
+ "import": "./dist/cli.js"
121
+ },
122
+ "./node-modules": {
123
+ "types": "./dist/node-modules.d.ts",
124
+ "import": "./dist/node-modules.js"
125
+ },
126
+ "./schema": {
127
+ "types": "./dist/config/schema.d.ts",
128
+ "import": "./dist/config/schema.js"
129
+ },
130
+ "./vite-adapter": {
131
+ "types": "./dist/vite-adapter.d.ts",
132
+ "import": "./dist/vite-adapter.js"
133
+ },
114
134
  "./package.json": "./package.json"
115
135
  },
116
136
  "bin": {
@@ -119,7 +139,6 @@
119
139
  },
120
140
  "files": [
121
141
  "dist",
122
- "schemas",
123
142
  "types"
124
143
  ],
125
144
  "publishConfig": {
package/dist/browser.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import * as playwright from 'playwright-core';
2
- import { ResolvedTaskConfig } from './config/resolve.js';
3
- import type { BrowserType } from './config/schema.js';
4
- export declare function getExecutableBrowserPath(browserType: BrowserType): string;
5
- export declare function getFullBrowserName(browserType: BrowserType): string;
6
- export declare function checkBrowserAvailability(path: string): boolean;
7
- export declare function isPlaywrightExecutable(path: string): boolean;
8
- export declare function downloadBrowser(browserType: BrowserType): Promise<string>;
9
- export declare function launchPreview({ mode, url, onBrowserOpen, onPageOpen, config: { browserType, proxy, executableBrowser, sandbox, ignoreHttpsErrors }, }: {
10
- mode: 'preview' | 'build';
11
- url: string;
12
- onBrowserOpen?: (browser: playwright.Browser) => void | Promise<void>;
13
- onPageOpen?: (page: playwright.Page) => void | Promise<void>;
14
- config: Pick<ResolvedTaskConfig, 'browserType' | 'proxy' | 'executableBrowser' | 'sandbox' | 'ignoreHttpsErrors'>;
15
- }): Promise<{
16
- browser: playwright.Browser;
17
- page: playwright.Page;
18
- }>;
19
- //# sourceMappingURL=browser.d.ts.map