@vivliostyle/cli 9.8.4 → 10.0.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.
Files changed (55) hide show
  1. package/README.md +74 -30
  2. package/dist/{chunk-LI2REENX.js → chunk-2M2KXPDN.js} +16 -17
  3. package/dist/chunk-2M2KXPDN.js.map +1 -0
  4. package/dist/{chunk-PBAUN5CU.js → chunk-5DB6XVJN.js} +2 -2
  5. package/dist/chunk-5DB6XVJN.js.map +1 -0
  6. package/dist/{chunk-HYY2WKJZ.js → chunk-5K3NGLBV.js} +6 -7
  7. package/dist/chunk-5K3NGLBV.js.map +1 -0
  8. package/dist/{chunk-YUYXQJDY.js → chunk-IIKRNYAM.js} +470 -238
  9. package/dist/chunk-IIKRNYAM.js.map +1 -0
  10. package/dist/{chunk-MDTA37GZ.js → chunk-MQYXBSRJ.js} +397 -88
  11. package/dist/chunk-MQYXBSRJ.js.map +1 -0
  12. package/dist/chunk-RPMMYPTR.js +1076 -0
  13. package/dist/chunk-RPMMYPTR.js.map +1 -0
  14. package/dist/{chunk-PPI5DA75.js → chunk-YN3JNBNT.js} +425 -374
  15. package/dist/chunk-YN3JNBNT.js.map +1 -0
  16. package/dist/{chunk-QOPM72CS.js → chunk-YVNDJXMI.js} +32 -33
  17. package/dist/chunk-YVNDJXMI.js.map +1 -0
  18. package/dist/{chunk-FXUEYQRY.js → chunk-ZIK6DINS.js} +3 -3
  19. package/dist/chunk-ZIK6DINS.js.map +1 -0
  20. package/dist/chunk-ZKEIYNLT.js +331 -0
  21. package/dist/chunk-ZKEIYNLT.js.map +1 -0
  22. package/dist/cli.js +7 -8
  23. package/dist/cli.js.map +1 -1
  24. package/dist/commands/build.js +29 -17
  25. package/dist/commands/build.js.map +1 -1
  26. package/dist/commands/create.d.ts +2 -0
  27. package/dist/commands/create.js +64 -0
  28. package/dist/commands/create.js.map +1 -0
  29. package/dist/commands/init.js +23 -14
  30. package/dist/commands/init.js.map +1 -1
  31. package/dist/commands/preview.js +26 -20
  32. package/dist/commands/preview.js.map +1 -1
  33. package/dist/config/schema.d.ts +9034 -4436
  34. package/dist/config/schema.js +20 -4
  35. package/dist/index.d.ts +46 -7
  36. package/dist/index.js +24 -16
  37. package/dist/index.js.map +1 -1
  38. package/dist/node-modules.d.ts +5 -5
  39. package/dist/node-modules.js +1 -1
  40. package/dist/vite-adapter.d.ts +1 -0
  41. package/dist/vite-adapter.js +6 -6
  42. package/package.json +38 -27
  43. package/dist/chunk-3VKIUKTD.js +0 -89
  44. package/dist/chunk-3VKIUKTD.js.map +0 -1
  45. package/dist/chunk-4IIM6RSG.js +0 -71
  46. package/dist/chunk-4IIM6RSG.js.map +0 -1
  47. package/dist/chunk-FXUEYQRY.js.map +0 -1
  48. package/dist/chunk-HYY2WKJZ.js.map +0 -1
  49. package/dist/chunk-LI2REENX.js.map +0 -1
  50. package/dist/chunk-MDTA37GZ.js.map +0 -1
  51. package/dist/chunk-PBAUN5CU.js.map +0 -1
  52. package/dist/chunk-PPI5DA75.js.map +0 -1
  53. package/dist/chunk-QOPM72CS.js.map +0 -1
  54. package/dist/chunk-YUYXQJDY.js.map +0 -1
  55. package/types/playwright.d.ts +0 -49
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CONTAINER_URL,
3
3
  cliVersion
4
- } from "./chunk-4IIM6RSG.js";
4
+ } from "./chunk-ZKEIYNLT.js";
5
5
 
6
6
  // src/config/schema.ts
7
7
  import { satisfies as semverSatisfies } from "semver";
@@ -37,6 +37,24 @@ var ValidString = v.pipe(
37
37
  v.trim(),
38
38
  v.minLength(1, "At least one character is required")
39
39
  );
40
+ var DocumentProcessorSchema = v.pipe(
41
+ v.function(),
42
+ v.metadata({
43
+ typeString: '(option: import("@vivliostyle/vfm").StringifyMarkdownOptions, metadata: import("@vivliostyle/vfm").Metadata) => import("unified").Processor'
44
+ }),
45
+ v.description($`
46
+ Custom function to provide a unified Processor for converting the source document to HTML.
47
+ `)
48
+ );
49
+ var DocumentMetadataReaderSchema = v.pipe(
50
+ v.function(),
51
+ v.metadata({
52
+ typeString: '(content: string) => import("@vivliostyle/vfm").Metadata'
53
+ }),
54
+ v.description($`
55
+ Custom function to extract metadata from the source document content.
56
+ `)
57
+ );
40
58
  var ThemeConfig = v.pipe(
41
59
  v.intersect([
42
60
  v.required(
@@ -90,7 +108,9 @@ var ArticleEntryConfig = v.pipe(
90
108
  v.union([v.array(ValidString), ValidString]),
91
109
  v.transform((input) => [input].flat())
92
110
  )
93
- )
111
+ ),
112
+ documentProcessor: v.optional(DocumentProcessorSchema),
113
+ documentMetadataReader: v.optional(DocumentMetadataReaderSchema)
94
114
  }),
95
115
  ["path"],
96
116
  "Missing required field: path"
@@ -214,9 +234,9 @@ var VfmReplaceRule = v.looseObject({
214
234
  )
215
235
  });
216
236
  var BrowserType = v.union([
237
+ v.literal("chrome"),
217
238
  v.literal("chromium"),
218
- v.literal("firefox"),
219
- v.literal("webkit")
239
+ v.literal("firefox")
220
240
  ]);
221
241
  var ReadingProgression = v.union([v.literal("ltr"), v.literal("rtl")]);
222
242
  var LogLevel = v.union([
@@ -235,6 +255,14 @@ var validateAssetExtensionSettings = (propName) => v.check(
235
255
  (input) => input.every((pattern) => !notAllowedExtensionRe.test(pattern)),
236
256
  `Invalid pattern was found in copyAsset.${propName} option`
237
257
  );
258
+ var validateBrowserTagFormat = v.check((input) => {
259
+ const [type] = input.split("@");
260
+ return v.is(BrowserType, type);
261
+ }, "Unknown browser type");
262
+ var parseBrowserTagFormat = v.transform((input) => {
263
+ const [type, tag] = input.split("@");
264
+ return { type: v.parse(BrowserType, type), tag };
265
+ });
238
266
  var CopyAssetConfig = v.pipe(
239
267
  v.partial(
240
268
  v.object({
@@ -613,15 +641,8 @@ var BuildTask = v.pipe(
613
641
  Timeout limit for waiting for the Vivliostyle process (in ms). (default: \`300000\`)
614
642
  `)
615
643
  ),
616
- documentProcessor: v.pipe(
617
- v.function(),
618
- v.metadata({
619
- typeString: '(option: import("@vivliostyle/vfm").StringifyMarkdownOptions, metadata: import("@vivliostyle/vfm").Metadata) => import("unified").Processor'
620
- }),
621
- v.description($`
622
- Custom function to provide a unified Processor for converting markdown to HTML.
623
- `)
624
- ),
644
+ documentProcessor: DocumentProcessorSchema,
645
+ documentMetadataReader: DocumentMetadataReaderSchema,
625
646
  vfm: v.pipe(
626
647
  v.union([VfmConfig]),
627
648
  v.description($`
@@ -663,10 +684,11 @@ var BuildTask = v.pipe(
663
684
  `)
664
685
  ),
665
686
  browser: v.pipe(
666
- BrowserType,
687
+ ValidString,
688
+ validateBrowserTagFormat,
689
+ parseBrowserTagFormat,
667
690
  v.description($`
668
- EXPERIMENTAL SUPPORT: Specifies the browser type for launching the Vivliostyle viewer.
669
- Currently, Firefox and Webkit support only the preview command.
691
+ Specify a browser type and version to launch the Vivliostyle viewer.
670
692
  `)
671
693
  ),
672
694
  base: v.pipe(
@@ -754,316 +776,367 @@ var VivliostyleConfigSchema = v.pipe(
754
776
  ),
755
777
  v.title("VivliostyleConfigSchema")
756
778
  );
757
- var VivliostyleInlineConfig = v.pipe(
758
- v.partial(
759
- v.object({
760
- cwd: v.pipe(
761
- ValidString,
762
- v.description($`
779
+ var VivliostyleInlineConfigWithoutChecks = v.partial(
780
+ v.object({
781
+ cwd: v.pipe(
782
+ ValidString,
783
+ v.description($`
763
784
  Set a working directory.
764
785
  `)
765
- ),
766
- config: v.pipe(
767
- ValidString,
768
- v.description($`
786
+ ),
787
+ config: v.pipe(
788
+ ValidString,
789
+ v.description($`
769
790
  Path to vivliostyle.config.js.
770
791
  `)
771
- ),
772
- configData: v.pipe(
773
- v.custom(() => true),
774
- v.metadata({
775
- typeString: "VivliostyleConfigSchema"
776
- }),
777
- v.description($`
792
+ ),
793
+ configData: v.pipe(
794
+ v.custom(() => true),
795
+ v.metadata({
796
+ typeString: "VivliostyleConfigSchema"
797
+ }),
798
+ v.description($`
778
799
  Vivliostyle config object.
779
800
  `)
780
- ),
781
- input: v.pipe(
782
- ValidString,
783
- v.transform((input) => {
784
- const ext = upath.extname(input).toLowerCase();
785
- if (/^(https?|data):/.test(input)) {
786
- return { format: "webbook", entry: input };
787
- } else if (ext === ".md" || ext === ".markdown") {
788
- return { format: "markdown", entry: input };
789
- } else if (ext === ".json" || ext === ".jsonld") {
790
- return { format: "pub-manifest", entry: input };
791
- } else if (ext === ".epub") {
792
- return { format: "epub", entry: input };
793
- } else if (ext === ".opf") {
794
- return { format: "epub-opf", entry: input };
795
- } else if ([".html", ".htm", ".xhtml", ".xht"].includes(ext)) {
796
- return { format: "webbook", entry: input };
797
- }
798
- throw new Error(`Cannot detect an input format: ${input}`);
799
- }),
800
- v.description($`
801
+ ),
802
+ input: v.pipe(
803
+ ValidString,
804
+ v.transform((input) => {
805
+ const ext = upath.extname(input).toLowerCase();
806
+ if (/^(https?|data):/.test(input)) {
807
+ return { format: "webbook", entry: input };
808
+ } else if (ext === ".md" || ext === ".markdown") {
809
+ return { format: "markdown", entry: input };
810
+ } else if (ext === ".json" || ext === ".jsonld") {
811
+ return { format: "pub-manifest", entry: input };
812
+ } else if (ext === ".epub") {
813
+ return { format: "epub", entry: input };
814
+ } else if (ext === ".opf") {
815
+ return { format: "epub-opf", entry: input };
816
+ } else if ([".html", ".htm", ".xhtml", ".xht"].includes(ext)) {
817
+ return { format: "webbook", entry: input };
818
+ }
819
+ throw new Error(`Cannot detect an input format: ${input}`);
820
+ }),
821
+ v.description($`
801
822
  Input file of document.
802
823
  `)
824
+ ),
825
+ output: v.pipe(
826
+ v.union([
827
+ v.array(v.union([OutputConfig, ValidString])),
828
+ OutputConfig,
829
+ ValidString
830
+ ]),
831
+ v.transform(
832
+ (input) => [input].flat().map((item) => {
833
+ const obj = typeof item === "string" ? { path: item } : item;
834
+ const ext = upath.extname(obj.path).toLowerCase();
835
+ return {
836
+ ...obj,
837
+ format: obj.format || (ext === ".pdf" ? "pdf" : ext === ".epub" ? "epub" : "webpub")
838
+ };
839
+ })
803
840
  ),
804
- output: v.pipe(
805
- v.union([
806
- v.array(v.union([OutputConfig, ValidString])),
807
- OutputConfig,
808
- ValidString
809
- ]),
810
- v.transform(
811
- (input) => [input].flat().map((item) => {
812
- const obj = typeof item === "string" ? { path: item } : item;
813
- const ext = upath.extname(obj.path).toLowerCase();
814
- return {
815
- ...obj,
816
- format: obj.format || (ext === ".pdf" ? "pdf" : ext === ".epub" ? "epub" : "webpub")
817
- };
818
- })
819
- ),
820
- v.description($`
841
+ v.description($`
821
842
  Output file name or directory.
822
843
  `)
823
- ),
824
- theme: v.pipe(
825
- ThemeSpecifier,
826
- v.description($`
844
+ ),
845
+ theme: v.pipe(
846
+ ThemeSpecifier,
847
+ v.description($`
827
848
  Theme path or package name.
828
849
  `)
829
- ),
830
- size: v.pipe(
831
- ValidString,
832
- v.description($`
850
+ ),
851
+ size: v.pipe(
852
+ ValidString,
853
+ v.description($`
833
854
  Output pdf size.
834
855
  preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal, ledger
835
856
  custom(comma separated): 182mm,257mm or 8.5in,11in
836
857
  `)
837
- ),
838
- cropMarks: v.pipe(
839
- v.boolean(),
840
- v.description($`
858
+ ),
859
+ cropMarks: v.pipe(
860
+ v.boolean(),
861
+ v.description($`
841
862
  Print crop marks.
842
863
  `)
843
- ),
844
- bleed: v.pipe(
845
- ValidString,
846
- v.description($`
864
+ ),
865
+ bleed: v.pipe(
866
+ ValidString,
867
+ v.description($`
847
868
  Extent of the bleed area for printing with crop marks. [3mm]
848
869
  `)
849
- ),
850
- cropOffset: v.pipe(
851
- ValidString,
852
- v.description($`
870
+ ),
871
+ cropOffset: v.pipe(
872
+ ValidString,
873
+ v.description($`
853
874
  Distance between the edge of the trim size and the edge of the media size. [auto (13mm + bleed)]
854
875
  `)
855
- ),
856
- css: v.pipe(
857
- ValidString,
858
- v.description($`
876
+ ),
877
+ css: v.pipe(
878
+ ValidString,
879
+ v.description($`
859
880
  Custom style CSS code. (ex: ":root {--my-color: lime;}")
860
881
  `)
861
- ),
862
- style: v.pipe(
863
- ValidString,
864
- v.description($`
882
+ ),
883
+ style: v.pipe(
884
+ ValidString,
885
+ v.description($`
865
886
  Additional stylesheet URL or path.
866
887
  `)
867
- ),
868
- userStyle: v.pipe(
869
- ValidString,
870
- v.description($`
888
+ ),
889
+ userStyle: v.pipe(
890
+ ValidString,
891
+ v.description($`
871
892
  User stylesheet URL or path.
872
893
  `)
873
- ),
874
- singleDoc: v.pipe(
875
- v.boolean(),
876
- v.description($`
894
+ ),
895
+ singleDoc: v.pipe(
896
+ v.boolean(),
897
+ v.description($`
877
898
  Single HTML document input.
878
899
  `)
879
- ),
880
- quick: v.pipe(
881
- v.boolean(),
882
- v.description($`
900
+ ),
901
+ quick: v.pipe(
902
+ v.boolean(),
903
+ v.description($`
883
904
  Quick loading with rough page count.
884
905
  `)
885
- ),
886
- pressReady: v.pipe(
887
- v.boolean(),
888
- v.description($`
906
+ ),
907
+ pressReady: v.pipe(
908
+ v.boolean(),
909
+ v.description($`
889
910
  Make generated PDF compatible with press ready PDF/X-1a.
890
911
  This option is equivalent with "preflight": "press-ready"
891
912
  `)
892
- ),
893
- title: v.pipe(ValidString, v.description($`Title`)),
894
- author: v.pipe(ValidString, v.description($`Author`)),
895
- language: v.pipe(ValidString, v.description($`Language`)),
896
- readingProgression: v.pipe(
897
- ReadingProgression,
898
- v.description($`
913
+ ),
914
+ title: v.pipe(ValidString, v.description($`Title`)),
915
+ author: v.pipe(ValidString, v.description($`Author`)),
916
+ language: v.pipe(ValidString, v.description($`Language`)),
917
+ readingProgression: v.pipe(
918
+ ReadingProgression,
919
+ v.description($`
899
920
  Direction of reading progression.
900
921
  `)
901
- ),
902
- timeout: v.pipe(
903
- v.number(),
904
- v.minValue(0),
905
- v.description($`
922
+ ),
923
+ timeout: v.pipe(
924
+ v.number(),
925
+ v.minValue(0),
926
+ v.description($`
906
927
  Timeout limit for waiting Vivliostyle process (ms).
907
928
  `)
908
- ),
909
- renderMode: v.pipe(
910
- RenderMode,
911
- v.description($`
929
+ ),
930
+ renderMode: v.pipe(
931
+ RenderMode,
932
+ v.description($`
912
933
  If docker is set, Vivliostyle try to render PDF on Docker container. [local]
913
934
  `)
914
- ),
915
- preflight: v.pipe(
916
- v.union([v.literal("press-ready"), v.literal("press-ready-local")]),
917
- v.description($`
935
+ ),
936
+ preflight: v.pipe(
937
+ v.union([v.literal("press-ready"), v.literal("press-ready-local")]),
938
+ v.description($`
918
939
  Apply the process to generate PDF for printing.
919
940
  `)
920
- ),
921
- preflightOption: v.pipe(
922
- v.union([v.array(ValidString), ValidString]),
923
- v.transform((input) => [input].flat()),
924
- v.description($`
941
+ ),
942
+ preflightOption: v.pipe(
943
+ v.union([v.array(ValidString), ValidString]),
944
+ v.transform((input) => [input].flat()),
945
+ v.description($`
925
946
  Options for preflight process (ex: gray-scale, enforce-outline).
926
947
  Please refer the document of press-ready for further information.
927
948
  `)
928
- ),
929
- sandbox: v.pipe(
930
- v.boolean(),
931
- v.description($`Launch chrome with sandbox.`)
932
- ),
933
- executableBrowser: v.pipe(
934
- ValidString,
935
- v.description($`
949
+ ),
950
+ sandbox: v.pipe(v.boolean(), v.description($`Launch chrome with sandbox.`)),
951
+ executableBrowser: v.pipe(
952
+ ValidString,
953
+ v.description($`
936
954
  Specify a path of executable browser you installed.
937
955
  `)
938
- ),
939
- image: v.pipe(
940
- ValidString,
941
- v.description($`
956
+ ),
957
+ image: v.pipe(
958
+ ValidString,
959
+ v.description($`
942
960
  Specify a docker image to render.
943
961
  `)
944
- ),
945
- viewer: v.pipe(
946
- ValidString,
947
- v.description($`
962
+ ),
963
+ viewer: v.pipe(
964
+ ValidString,
965
+ v.description($`
948
966
  Specify a URL of displaying viewer instead of vivliostyle-cli's one.
949
967
  It is useful that using own viewer that has staging features. (ex: https://vivliostyle.vercel.app/)
950
968
  `)
951
- ),
952
- viewerParam: v.pipe(
953
- ValidString,
954
- v.description($`
969
+ ),
970
+ viewerParam: v.pipe(
971
+ ValidString,
972
+ v.description($`
955
973
  Specify viewer parameters. (ex: "allowScripts=false&pixelRatio=16")
956
974
  `)
957
- ),
958
- browser: v.pipe(
959
- BrowserType,
960
- v.description($`
961
- Specify a browser type to launch Vivliostyle viewer [chromium].
975
+ ),
976
+ browser: v.pipe(
977
+ ValidString,
978
+ validateBrowserTagFormat,
979
+ parseBrowserTagFormat,
980
+ v.description($`
981
+ Specify a browser type and version to launch the Vivliostyle viewer. [chrome]
962
982
  `)
963
- ),
964
- proxyServer: v.pipe(
965
- ValidString,
966
- v.description($`
983
+ ),
984
+ proxyServer: v.pipe(
985
+ ValidString,
986
+ v.description($`
967
987
  HTTP/SOCK proxy server url for underlying Playwright.
968
988
  `)
969
- ),
970
- proxyBypass: v.pipe(
971
- ValidString,
972
- v.description($`
989
+ ),
990
+ proxyBypass: v.pipe(
991
+ ValidString,
992
+ v.description($`
973
993
  Optional comma-separated domains to bypass proxy.
974
994
  `)
975
- ),
976
- proxyUser: v.pipe(
977
- ValidString,
978
- v.description($`
995
+ ),
996
+ proxyUser: v.pipe(
997
+ ValidString,
998
+ v.description($`
979
999
  Optional username for HTTP proxy authentication.
980
1000
  `)
981
- ),
982
- proxyPass: v.pipe(
983
- ValidString,
984
- v.description($`
1001
+ ),
1002
+ proxyPass: v.pipe(
1003
+ ValidString,
1004
+ v.description($`
985
1005
  Optional password for HTTP proxy authentication.
986
1006
  `)
987
- ),
988
- logLevel: v.pipe(
989
- LogLevel,
990
- v.description($`
1007
+ ),
1008
+ logLevel: v.pipe(
1009
+ LogLevel,
1010
+ v.description($`
991
1011
  Specify a log level of console outputs.
992
1012
  `)
993
- ),
994
- ignoreHttpsErrors: v.pipe(
995
- v.boolean(),
996
- v.description($`
1013
+ ),
1014
+ ignoreHttpsErrors: v.pipe(
1015
+ v.boolean(),
1016
+ v.description($`
997
1017
  true to ignore HTTPS errors when Playwright browser opens a new page.
998
1018
  `)
999
- ),
1000
- openViewer: v.pipe(
1001
- v.boolean(),
1002
- v.description($`
1019
+ ),
1020
+ openViewer: v.pipe(
1021
+ v.boolean(),
1022
+ v.description($`
1003
1023
  Open a browser to display the document preview.
1004
1024
  `)
1005
- ),
1006
- enableStaticServe: v.pipe(
1007
- v.boolean(),
1008
- v.description($`
1025
+ ),
1026
+ enableStaticServe: v.pipe(
1027
+ v.boolean(),
1028
+ v.description($`
1009
1029
  Enable static file serving as configured in the Vivliostyle config file.
1010
1030
  `)
1011
- ),
1012
- enableViewerStartPage: v.pipe(
1013
- v.boolean(),
1014
- v.description($`
1031
+ ),
1032
+ enableViewerStartPage: v.pipe(
1033
+ v.boolean(),
1034
+ v.description($`
1015
1035
  Open a start page of the viewer when the input file is not specified.
1016
1036
  `)
1017
- ),
1018
- vite: v.pipe(
1019
- v.custom(() => true),
1020
- v.metadata({
1021
- typeString: 'import("vite").UserConfig'
1022
- }),
1023
- v.description($`
1037
+ ),
1038
+ vite: v.pipe(
1039
+ v.custom(() => true),
1040
+ v.metadata({
1041
+ typeString: 'import("vite").UserConfig'
1042
+ }),
1043
+ v.description($`
1024
1044
  Configuration options for the Vite server.
1025
1045
  `)
1026
- ),
1027
- viteConfigFile: v.pipe(
1028
- v.union([ValidString, v.boolean()]),
1029
- v.description($`
1046
+ ),
1047
+ viteConfigFile: v.pipe(
1048
+ v.union([ValidString, v.boolean()]),
1049
+ v.description($`
1030
1050
  Path to the Vite config file.
1031
1051
  If a falsy value is provided, Vivliostyle CLI ignores the existing Vite config file.
1032
1052
  `)
1033
- ),
1034
- host: v.pipe(
1035
- v.union([v.boolean(), ValidString]),
1036
- v.description($`
1053
+ ),
1054
+ host: v.pipe(
1055
+ v.union([v.boolean(), ValidString]),
1056
+ v.description($`
1037
1057
  IP address the server should listen on.
1038
1058
  Set to \`true\` to listen on all addresses.
1039
1059
  (default: \`true\` if a PDF build with Docker render mode is required, otherwise \`false\`)
1040
1060
  `)
1041
- ),
1042
- port: v.pipe(
1043
- v.number(),
1044
- v.minValue(0),
1045
- v.maxValue(65535),
1046
- v.description($`
1061
+ ),
1062
+ port: v.pipe(
1063
+ v.number(),
1064
+ v.minValue(0),
1065
+ v.maxValue(65535),
1066
+ v.description($`
1047
1067
  Port the server should listen on. (default: \`13000\`)
1048
1068
  `)
1049
- ),
1050
- logger: v.pipe(
1051
- v.custom(() => true),
1052
- v.metadata({
1053
- typeString: "LoggerInterface"
1054
- }),
1055
- v.description($`
1069
+ ),
1070
+ logger: v.pipe(
1071
+ v.custom(() => true),
1072
+ v.metadata({
1073
+ typeString: "LoggerInterface"
1074
+ }),
1075
+ v.description($`
1056
1076
  Custom logger interface.
1057
1077
  `)
1058
- ),
1059
- disableServerStartup: v.pipe(
1060
- v.boolean(),
1061
- v.description($`
1078
+ ),
1079
+ disableServerStartup: v.pipe(
1080
+ v.boolean(),
1081
+ v.description($`
1062
1082
  Disable the startup of the preview server during the build process.
1063
1083
  `)
1064
- )
1065
- })
1066
- ),
1084
+ ),
1085
+ projectPath: v.pipe(
1086
+ ValidString,
1087
+ v.description($`
1088
+ Path of the Vivliostyle project to create.
1089
+ `)
1090
+ ),
1091
+ template: v.pipe(
1092
+ ValidString,
1093
+ v.description($`
1094
+ Template source in format of \`[provider]:repo[/subpath][#ref]\`.
1095
+ `)
1096
+ ),
1097
+ createConfigFileOnly: v.pipe(
1098
+ v.boolean(),
1099
+ v.description($`
1100
+ Create a Vivliostyle config file without generating project template files.
1101
+ `)
1102
+ ),
1103
+ stdin: v.pipe(
1104
+ v.custom(() => true),
1105
+ v.metadata({
1106
+ typeString: 'import("node:stream").Readable'
1107
+ }),
1108
+ v.description($`
1109
+ Readable stream for stdin input.
1110
+ `)
1111
+ ),
1112
+ stdout: v.pipe(
1113
+ v.custom(() => true),
1114
+ v.metadata({
1115
+ typeString: 'import("node:stream").Writable'
1116
+ }),
1117
+ v.description($`
1118
+ Writable stream for stdout output.
1119
+ `)
1120
+ ),
1121
+ stderr: v.pipe(
1122
+ v.custom(() => true),
1123
+ v.metadata({
1124
+ typeString: 'import("node:stream").Writable'
1125
+ }),
1126
+ v.description($`
1127
+ Writable stream for stderr output.
1128
+ `)
1129
+ ),
1130
+ signal: v.pipe(
1131
+ v.custom(() => true),
1132
+ v.description($`
1133
+ AbortSignal to cancel the operation.
1134
+ `)
1135
+ )
1136
+ })
1137
+ );
1138
+ var VivliostyleInlineConfig = v.pipe(
1139
+ VivliostyleInlineConfigWithoutChecks,
1067
1140
  v.check(
1068
1141
  (options) => !options.input || !options.output || !["epub", "epub-opf"].includes(options.input.format) || options.output.every((o) => o.format !== "webpub"),
1069
1142
  "Exporting webpub format from EPUB or OPF file is not supported."
@@ -1074,11 +1147,164 @@ var VivliostyleInlineConfig = v.pipe(
1074
1147
  ),
1075
1148
  v.title("VivliostyleInlineConfig")
1076
1149
  );
1150
+ var VivliostyleThemeMetadata = v.pipe(
1151
+ v.object({
1152
+ name: v.pipe(
1153
+ v.optional(ValidString),
1154
+ v.description($`
1155
+ Name of the theme.
1156
+ `)
1157
+ ),
1158
+ author: v.pipe(
1159
+ v.optional(ValidString),
1160
+ v.description($`
1161
+ Author of the theme.
1162
+ `)
1163
+ ),
1164
+ style: v.pipe(
1165
+ v.optional(ValidString),
1166
+ v.description($`
1167
+ This property specifies the main CSS file in the theme.
1168
+ `)
1169
+ ),
1170
+ category: v.pipe(
1171
+ v.optional(ValidString),
1172
+ v.description($`
1173
+ This property provides a hint to users about the primary use of your theme when they use it for the first time.
1174
+ Choose the category that best fits your theme from the following list:
1175
+ - \`"novel"\`
1176
+ - \`"magazine"\`
1177
+ - \`"journal"\`
1178
+ - \`"report"\`
1179
+ - \`"misc"\`
1180
+ `)
1181
+ ),
1182
+ topics: v.pipe(
1183
+ v.optional(v.array(ValidString)),
1184
+ v.description($`
1185
+ If you want more specific descriptions of the theme's use than the category property,
1186
+ you can list and describe them here.
1187
+ `)
1188
+ )
1189
+ }),
1190
+ v.title("VivliostyleThemeMetadata")
1191
+ );
1192
+ var basePromptOptions = {
1193
+ name: ValidString,
1194
+ required: v.optional(v.boolean())
1195
+ };
1196
+ var TextPrompt = v.object({
1197
+ ...basePromptOptions,
1198
+ type: v.literal("text"),
1199
+ message: ValidString,
1200
+ placeholder: v.optional(ValidString),
1201
+ defaultValue: v.optional(ValidString),
1202
+ initialValue: v.optional(ValidString)
1203
+ });
1204
+ var SelectPromptOption = v.union([
1205
+ ValidString,
1206
+ v.object({
1207
+ value: v.union([
1208
+ v.string(),
1209
+ // Allow empty string
1210
+ v.number(),
1211
+ v.boolean()
1212
+ ]),
1213
+ label: v.optional(ValidString),
1214
+ hint: v.optional(ValidString)
1215
+ })
1216
+ ]);
1217
+ var SelectPrompt = v.object({
1218
+ ...basePromptOptions,
1219
+ type: v.literal("select"),
1220
+ message: ValidString,
1221
+ options: v.array(SelectPromptOption),
1222
+ initialValue: v.optional(v.string())
1223
+ });
1224
+ var MultiSelectPrompt = v.object({
1225
+ ...basePromptOptions,
1226
+ type: v.literal("multiSelect"),
1227
+ message: ValidString,
1228
+ options: v.array(SelectPromptOption),
1229
+ initialValues: v.optional(v.array(v.string())),
1230
+ cursorAt: v.optional(v.string())
1231
+ });
1232
+ var AutocompletePrompt = v.object({
1233
+ ...basePromptOptions,
1234
+ type: v.literal("autocomplete"),
1235
+ message: ValidString,
1236
+ options: v.array(SelectPromptOption),
1237
+ placeholder: v.optional(ValidString),
1238
+ initialValue: v.optional(v.string()),
1239
+ initialUserInput: v.optional(ValidString)
1240
+ });
1241
+ var AutocompleteMultiSelectOptions = v.object({
1242
+ ...basePromptOptions,
1243
+ type: v.literal("autocompleteMultiSelect"),
1244
+ message: ValidString,
1245
+ options: v.array(SelectPromptOption),
1246
+ placeholder: v.optional(ValidString),
1247
+ initialValues: v.optional(v.array(v.string()))
1248
+ });
1249
+ var PromptOption = v.variant("type", [
1250
+ TextPrompt,
1251
+ SelectPrompt,
1252
+ MultiSelectPrompt,
1253
+ AutocompletePrompt,
1254
+ AutocompleteMultiSelectOptions
1255
+ ]);
1256
+ var VivliostyleTemplateMetadata = v.pipe(
1257
+ v.record(
1258
+ ValidString,
1259
+ v.object({
1260
+ name: v.pipe(
1261
+ v.optional(ValidString),
1262
+ v.description($`
1263
+ Name of the template.
1264
+ `)
1265
+ ),
1266
+ description: v.pipe(
1267
+ v.optional(ValidString),
1268
+ v.description($`
1269
+ Description of the template.
1270
+ `)
1271
+ ),
1272
+ source: v.pipe(
1273
+ ValidString,
1274
+ v.description($`
1275
+ Template source in the format of \`[provider]:repo[/subpath][#ref]\` or as a local directory to copy from.
1276
+ See the [giget](https://github.com/unjs/giget) documentation for more details of the source format.
1277
+ `)
1278
+ ),
1279
+ prompt: v.pipe(
1280
+ v.optional(v.array(PromptOption)),
1281
+ v.description($`
1282
+ Extra prompt options for the template.
1283
+ This is used to prompt users for additional information when applying the template.
1284
+ See the [@clack/prompts](https://github.com/bombshell-dev/clack) documentation for more details on the prompt options.
1285
+ Available prompt types: \`text\`, \`select\`, \`multiSelect\`, \`autocomplete\`, \`autocompleteMultiSelect\`.
1286
+ `)
1287
+ )
1288
+ })
1289
+ ),
1290
+ v.title("VivliostyleTemplateMetadata")
1291
+ );
1292
+ var VivliostylePackageMetadata = v.pipe(
1293
+ v.partial(
1294
+ v.object({
1295
+ theme: VivliostyleThemeMetadata,
1296
+ template: VivliostyleTemplateMetadata
1297
+ })
1298
+ ),
1299
+ v.title("VivliostylePackageMetadata")
1300
+ );
1077
1301
 
1078
1302
  export {
1079
1303
  StructuredDocument,
1080
1304
  StructuredDocumentSection,
1081
1305
  ValidString,
1306
+ DocumentProcessorSchema,
1307
+ DocumentMetadataReaderSchema,
1082
1308
  ThemeConfig,
1083
1309
  ThemeSpecifier,
1084
1310
  ArticleEntryConfig,
@@ -1098,6 +1324,12 @@ export {
1098
1324
  ServerConfig,
1099
1325
  BuildTask,
1100
1326
  VivliostyleConfigSchema,
1101
- VivliostyleInlineConfig
1327
+ VivliostyleInlineConfigWithoutChecks,
1328
+ VivliostyleInlineConfig,
1329
+ VivliostyleThemeMetadata,
1330
+ SelectPromptOption,
1331
+ PromptOption,
1332
+ VivliostyleTemplateMetadata,
1333
+ VivliostylePackageMetadata
1102
1334
  };
1103
- //# sourceMappingURL=chunk-YUYXQJDY.js.map
1335
+ //# sourceMappingURL=chunk-IIKRNYAM.js.map