create-book 10.2.1 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -34746,7 +34746,7 @@ ${p3}`;
34746
34746
  }
34747
34747
  });
34748
34748
 
34749
- // ../../dist/chunk-ZEBXHUJX.js
34749
+ // ../../dist/chunk-OAFXM4ES.js
34750
34750
  var import_resolve_pkg = __toESM(require_resolve_pkg(), 1);
34751
34751
  var import_upath = __toESM(require_upath(), 1);
34752
34752
  import fs from "node:fs";
@@ -34760,9 +34760,9 @@ var EPUB_CONTAINER_XML = `${XML_DECLARATION}
34760
34760
  </container>`;
34761
34761
  var CONTAINER_URL = "ghcr.io/vivliostyle/cli";
34762
34762
  var DEFAULT_BROWSER_VERSIONS = {
34763
- chrome: { "linux": "143.0.7499.42", "linux_arm": "143.0.7499.42", "mac": "143.0.7499.42", "mac_arm": "143.0.7499.42", "win32": "143.0.7499.42", "win64": "143.0.7499.42" },
34764
- chromium: { "linux": "1557241", "linux_arm": "1557267", "mac": "1557267", "mac_arm": "1557281", "win32": "1557270", "win64": "1557225" },
34765
- firefox: { "linux": "stable_146.0", "linux_arm": "stable_146.0", "mac": "stable_146.0", "mac_arm": "stable_146.0", "win32": "stable_146.0", "win64": "stable_146.0" }
34763
+ chrome: { "linux": "145.0.7632.26", "linux_arm": "145.0.7632.26", "mac": "145.0.7632.26", "mac_arm": "145.0.7632.26", "win32": "145.0.7632.26", "win64": "145.0.7632.26" },
34764
+ chromium: { "linux": "1577564", "linux_arm": "1577554", "mac": "1577554", "mac_arm": "1577588", "win32": "1577564", "win64": "1577578" },
34765
+ firefox: { "linux": "stable_147.0.2", "linux_arm": "stable_147.0.2", "mac": "stable_147.0.2", "mac_arm": "stable_147.0.2", "win32": "stable_147.0.2", "win64": "stable_147.0.2" }
34766
34766
  };
34767
34767
  var DEFAULT_CONFIG_FILENAME = "vivliostyle.config.js";
34768
34768
  var DEFAULT_PROJECT_TITLE = "My Title";
@@ -35035,7 +35035,7 @@ var coreVersion = (() => {
35035
35035
  var versionForDisplay = `cli: ${cliVersion}
35036
35036
  core: ${coreVersion}`;
35037
35037
 
35038
- // ../../dist/chunk-CKXFRCPH.js
35038
+ // ../../dist/chunk-7GIJVX4M.js
35039
35039
  var import_semver = __toESM(require_semver2(), 1);
35040
35040
  var import_upath2 = __toESM(require_upath(), 1);
35041
35041
 
@@ -35926,6 +35926,54 @@ function string(message$1) {
35926
35926
  };
35927
35927
  }
35928
35928
  // @__NO_SIDE_EFFECTS__
35929
+ function tuple(items, message$1) {
35930
+ return {
35931
+ kind: "schema",
35932
+ type: "tuple",
35933
+ reference: tuple,
35934
+ expects: "Array",
35935
+ async: false,
35936
+ items,
35937
+ message: message$1,
35938
+ get "~standard"() {
35939
+ return /* @__PURE__ */ _getStandardProps(this);
35940
+ },
35941
+ "~run"(dataset, config$1) {
35942
+ const input = dataset.value;
35943
+ if (Array.isArray(input)) {
35944
+ dataset.typed = true;
35945
+ dataset.value = [];
35946
+ for (let key = 0; key < this.items.length; key++) {
35947
+ const value$1 = input[key];
35948
+ const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
35949
+ if (itemDataset.issues) {
35950
+ const pathItem = {
35951
+ type: "array",
35952
+ origin: "value",
35953
+ input,
35954
+ key,
35955
+ value: value$1
35956
+ };
35957
+ for (const issue of itemDataset.issues) {
35958
+ if (issue.path) issue.path.unshift(pathItem);
35959
+ else issue.path = [pathItem];
35960
+ dataset.issues?.push(issue);
35961
+ }
35962
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
35963
+ if (config$1.abortEarly) {
35964
+ dataset.typed = false;
35965
+ break;
35966
+ }
35967
+ }
35968
+ if (!itemDataset.typed) dataset.typed = false;
35969
+ dataset.value.push(itemDataset.value);
35970
+ }
35971
+ } else _addIssue(this, "type", dataset, config$1);
35972
+ return dataset;
35973
+ }
35974
+ };
35975
+ }
35976
+ // @__NO_SIDE_EFFECTS__
35929
35977
  function _subIssues(datasets) {
35930
35978
  let issues;
35931
35979
  if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
@@ -36146,7 +36194,7 @@ async function safeParseAsync(schema, input, config$1) {
36146
36194
  };
36147
36195
  }
36148
36196
 
36149
- // ../../dist/chunk-CKXFRCPH.js
36197
+ // ../../dist/chunk-7GIJVX4M.js
36150
36198
  var $ = (strings, ...values) => {
36151
36199
  const lines = String.raw({ raw: strings }, ...values).split("\n");
36152
36200
  const indent = lines.filter((line) => line.trim()).map((line) => line.match(/^\s*/)?.[0].length ?? 0).reduce((min, len) => Math.min(min, len), Infinity);
@@ -36318,6 +36366,109 @@ var OutputFormat = union([
36318
36366
  literal("webpub")
36319
36367
  ]);
36320
36368
  var RenderMode = union([literal("local"), literal("docker")]);
36369
+ var RGBValueSchema = pipe(
36370
+ object({
36371
+ r: pipe(number(), integer(), minValue(0), maxValue(1e4)),
36372
+ g: pipe(number(), integer(), minValue(0), maxValue(1e4)),
36373
+ b: pipe(number(), integer(), minValue(0), maxValue(1e4))
36374
+ }),
36375
+ title("RGBValue")
36376
+ );
36377
+ var CMYKValueSchema = pipe(
36378
+ object({
36379
+ c: pipe(number(), integer(), minValue(0), maxValue(1e4)),
36380
+ m: pipe(number(), integer(), minValue(0), maxValue(1e4)),
36381
+ y: pipe(number(), integer(), minValue(0), maxValue(1e4)),
36382
+ k: pipe(number(), integer(), minValue(0), maxValue(1e4))
36383
+ }),
36384
+ title("CMYKValue")
36385
+ );
36386
+ var CmykOverrideEntrySchema = tuple([RGBValueSchema, CMYKValueSchema]);
36387
+ var CmykConfigSchema = pipe(
36388
+ partial(
36389
+ object({
36390
+ overrideMap: pipe(
36391
+ array(CmykOverrideEntrySchema),
36392
+ description($`
36393
+ Custom RGB to CMYK color mapping.
36394
+ Each entry is a tuple of [{r, g, b}, {c, m, y, k}] where values are integers (0-10000).
36395
+ `)
36396
+ ),
36397
+ warnUnmapped: pipe(
36398
+ boolean(),
36399
+ description($`
36400
+ Warn when RGB colors not mapped to CMYK are encountered. (default: true)
36401
+ `)
36402
+ ),
36403
+ mapOutput: pipe(
36404
+ ValidString,
36405
+ description($`
36406
+ Output the CMYK color map to a JSON file at the specified path.
36407
+ `)
36408
+ )
36409
+ })
36410
+ ),
36411
+ title("CmykConfig")
36412
+ );
36413
+ var CmykSchema = pipe(
36414
+ union([boolean(), CmykConfigSchema]),
36415
+ description($`
36416
+ Convert device-cmyk() colors to CMYK in the output PDF.
36417
+ Can be a boolean or a config object with overrideMap and warnUnmapped options.
36418
+ `)
36419
+ );
36420
+ var ReplaceImageEntrySchema = pipe(
36421
+ object({
36422
+ source: pipe(
36423
+ union([ValidString, instance(RegExp)]),
36424
+ description(
36425
+ "Path to the source image file, or a RegExp pattern to match multiple files."
36426
+ )
36427
+ ),
36428
+ replacement: pipe(
36429
+ ValidString,
36430
+ description(
36431
+ "Path to the replacement image file. When source is a RegExp, supports $1, $2, etc. for captured groups."
36432
+ )
36433
+ )
36434
+ }),
36435
+ title("ReplaceImageEntry")
36436
+ );
36437
+ var ReplaceImageSchema = pipe(
36438
+ array(ReplaceImageEntrySchema),
36439
+ description($`
36440
+ Replace images in the output PDF.
36441
+ Each entry specifies a source image path and its replacement image path.
36442
+ Useful for replacing RGB images with CMYK versions.
36443
+ `)
36444
+ );
36445
+ var PdfPostprocessConfigSchema = pipe(
36446
+ partial(
36447
+ object({
36448
+ preflight: pipe(
36449
+ union([literal("press-ready"), literal("press-ready-local")]),
36450
+ description($`
36451
+ Apply the process to generate a print-ready PDF.
36452
+ `)
36453
+ ),
36454
+ preflightOption: pipe(
36455
+ array(ValidString),
36456
+ description($`
36457
+ Options for the preflight process (e.g., \`gray-scale\`, \`enforce-outline\`).
36458
+ Refer to the press-ready documentation for more information: [press-ready](https://github.com/vibranthq/press-ready)
36459
+ `)
36460
+ ),
36461
+ cmyk: CmykSchema,
36462
+ replaceImage: ReplaceImageSchema
36463
+ })
36464
+ ),
36465
+ title("PdfPostprocessConfig"),
36466
+ description($`
36467
+ PDF post-processing options.
36468
+ When both pdfPostprocess and legacy options (pressReady, preflight, etc.) are specified,
36469
+ pdfPostprocess takes precedence.
36470
+ `)
36471
+ );
36321
36472
  var OutputConfig = pipe(
36322
36473
  intersect([
36323
36474
  required(
@@ -36345,19 +36496,23 @@ var OutputConfig = pipe(
36345
36496
  If set to \`docker\`, Vivliostyle will render the PDF using a Docker container. (default: \`local\`)
36346
36497
  `)
36347
36498
  ),
36499
+ /** @deprecated */
36348
36500
  preflight: pipe(
36349
36501
  union([literal("press-ready"), literal("press-ready-local")]),
36502
+ metadata({ deprecated: true }),
36350
36503
  description($`
36351
- Apply the process to generate a print-ready PDF.
36504
+ Use \`pdfPostprocess.preflight\` instead
36352
36505
  `)
36353
36506
  ),
36507
+ /** @deprecated */
36354
36508
  preflightOption: pipe(
36355
36509
  array(ValidString),
36510
+ metadata({ deprecated: true }),
36356
36511
  description($`
36357
- Options for the preflight process (e.g., \`gray-scale\`, \`enforce-outline\`).
36358
- Refer to the press-ready documentation for more information: [press-ready](https://github.com/vibranthq/press-ready)
36512
+ Use \`pdfPostprocess.preflightOption\` instead
36359
36513
  `)
36360
- )
36514
+ ),
36515
+ pdfPostprocess: PdfPostprocessConfigSchema
36361
36516
  })
36362
36517
  )
36363
36518
  ]),
@@ -36572,6 +36727,18 @@ var VfmConfig = pipe(
36572
36727
  description($`
36573
36728
  Enable support for math syntax.
36574
36729
  `)
36730
+ ),
36731
+ imgFigcaptionOrder: pipe(
36732
+ union([literal("img-figcaption"), literal("figcaption-img")]),
36733
+ description($`
36734
+ Order of img and figcaption elements in figure.
36735
+ `)
36736
+ ),
36737
+ assignIdToFigcaption: pipe(
36738
+ boolean(),
36739
+ description($`
36740
+ Assign ID to figcaption instead of img/code.
36741
+ `)
36575
36742
  )
36576
36743
  })
36577
36744
  ),
@@ -36727,13 +36894,15 @@ var BuildTask = pipe(
36727
36894
  - Custom (comma-separated): \`182mm,257mm\` or \`8.5in,11in\`
36728
36895
  `)
36729
36896
  ),
36897
+ /** @deprecated */
36730
36898
  pressReady: pipe(
36731
36899
  boolean(),
36900
+ metadata({ deprecated: true }),
36732
36901
  description($`
36733
- Generate a press-ready PDF compatible with PDF/X-1a. (default: \`false\`)
36734
- This option is equivalent to setting \`"preflight": "press-ready"\`.
36902
+ Use \`pdfPostprocess.preflight: "press-ready"\` instead
36735
36903
  `)
36736
36904
  ),
36905
+ pdfPostprocess: PdfPostprocessConfigSchema,
36737
36906
  language: pipe(
36738
36907
  ValidString,
36739
36908
  description($`
@@ -36983,7 +37152,11 @@ var VivliostyleInlineConfigWithoutChecks = partial(
36983
37152
  `)
36984
37153
  ),
36985
37154
  theme: pipe(
36986
- ThemeSpecifier,
37155
+ union([
37156
+ ThemeSpecifier,
37157
+ literal(false)
37158
+ // Explicitly disable theme installation
37159
+ ]),
36987
37160
  description($`
36988
37161
  Theme path or package name.
36989
37162
  `)
@@ -37023,13 +37196,13 @@ var VivliostyleInlineConfigWithoutChecks = partial(
37023
37196
  style: pipe(
37024
37197
  ValidString,
37025
37198
  description($`
37026
- Additional stylesheet URL or path.
37199
+ Additional stylesheet for Vivliostyle viewer.
37027
37200
  `)
37028
37201
  ),
37029
37202
  userStyle: pipe(
37030
37203
  ValidString,
37031
37204
  description($`
37032
- User stylesheet URL or path.
37205
+ Additional user stylesheet for Vivliostyle viewer.
37033
37206
  `)
37034
37207
  ),
37035
37208
  singleDoc: pipe(
@@ -37087,6 +37260,7 @@ var VivliostyleInlineConfigWithoutChecks = partial(
37087
37260
  Please refer the document of press-ready for further information.
37088
37261
  `)
37089
37262
  ),
37263
+ cmyk: CmykSchema,
37090
37264
  sandbox: pipe(boolean(), description($`Launch chrome with sandbox.`)),
37091
37265
  executableBrowser: pipe(
37092
37266
  ValidString,
@@ -37240,6 +37414,12 @@ var VivliostyleInlineConfigWithoutChecks = partial(
37240
37414
  Create a Vivliostyle config file without generating project template files.
37241
37415
  `)
37242
37416
  ),
37417
+ installDependencies: pipe(
37418
+ boolean(),
37419
+ description($`
37420
+ Install dependencies after creating a project.
37421
+ `)
37422
+ ),
37243
37423
  stdin: pipe(
37244
37424
  custom(() => true),
37245
37425
  metadata({
@@ -37456,7 +37636,7 @@ var {
37456
37636
  Help
37457
37637
  } = import_index.default;
37458
37638
 
37459
- // ../../dist/chunk-T2VWLU2I.js
37639
+ // ../../dist/chunk-DBK27BAR.js
37460
37640
  var import_code_frame = __toESM(require_lib2(), 1);
37461
37641
 
37462
37642
  // ../../node_modules/.pnpm/@humanwhocodes+momoa@3.3.8/node_modules/@humanwhocodes/momoa/dist/momoa.js
@@ -37581,7 +37761,7 @@ var json5Whitespace = /* @__PURE__ */ new Set([
37581
37761
  CHAR_IDEOGRAPHIC_SPACE
37582
37762
  ]);
37583
37763
 
37584
- // ../../dist/chunk-T2VWLU2I.js
37764
+ // ../../dist/chunk-DBK27BAR.js
37585
37765
  var import_ajv = __toESM(require_ajv(), 1);
37586
37766
  var import_ajv_formats = __toESM(require_dist(), 1);
37587
37767
 
@@ -37865,7 +38045,7 @@ lcid.all = new Proxy(
37865
38045
  );
37866
38046
  var lcid_default2 = lcid;
37867
38047
 
37868
- // ../../dist/chunk-T2VWLU2I.js
38048
+ // ../../dist/chunk-DBK27BAR.js
37869
38049
  var import_node_stream_zip = __toESM(require_node_stream_zip(), 1);
37870
38050
  import childProcess2 from "node:child_process";
37871
38051
  import fs2 from "node:fs";
@@ -38067,7 +38247,7 @@ function upperAt(input, index, locale) {
38067
38247
  return input.slice(0, index) + input.charAt(index).toLocaleUpperCase(locale) + input.slice(index + 1);
38068
38248
  }
38069
38249
 
38070
- // ../../dist/chunk-T2VWLU2I.js
38250
+ // ../../dist/chunk-DBK27BAR.js
38071
38251
  var import_tmp = __toESM(require_tmp(), 1);
38072
38252
  var import_upath3 = __toESM(require_upath(), 1);
38073
38253
 
@@ -38183,7 +38363,7 @@ var bgMagentaBright = format(105, 49);
38183
38363
  var bgCyanBright = format(106, 49);
38184
38364
  var bgWhiteBright = format(107, 49);
38185
38365
 
38186
- // ../../dist/chunk-T2VWLU2I.js
38366
+ // ../../dist/chunk-DBK27BAR.js
38187
38367
  var import_debug = __toESM(require_src(), 1);
38188
38368
  import { Console } from "node:console";
38189
38369
 
@@ -38442,7 +38622,7 @@ var esm_default = {
38442
38622
  ...import_remove.default
38443
38623
  };
38444
38624
 
38445
- // ../../dist/chunk-T2VWLU2I.js
38625
+ // ../../dist/chunk-DBK27BAR.js
38446
38626
  var import_picomatch3 = __toESM(require_picomatch2(), 1);
38447
38627
 
38448
38628
  // ../../node_modules/.pnpm/tinyglobby@0.2.13/node_modules/tinyglobby/dist/index.mjs
@@ -38713,7 +38893,7 @@ async function glob(patternsOrOptions, options) {
38713
38893
  return crawl(opts, cwd2, false);
38714
38894
  }
38715
38895
 
38716
- // ../../dist/chunk-T2VWLU2I.js
38896
+ // ../../dist/chunk-DBK27BAR.js
38717
38897
  var import_upath4 = __toESM(require_upath(), 1);
38718
38898
  function createParserProgram({
38719
38899
  setupProgram,
@@ -39503,10 +39683,11 @@ async function exec2(command, args = [], options = {}) {
39503
39683
  return subprocess;
39504
39684
  }
39505
39685
  var beforeExitHandlers = [];
39686
+ var exitHandlersRun = false;
39506
39687
  var registerExitHandler = (debugMessage, handler) => {
39507
39688
  const callback = () => {
39508
39689
  Logger.debug(debugMessage);
39509
- handler();
39690
+ return handler();
39510
39691
  };
39511
39692
  beforeExitHandlers.push(callback);
39512
39693
  return () => {
@@ -39516,22 +39697,30 @@ var registerExitHandler = (debugMessage, handler) => {
39516
39697
  }
39517
39698
  };
39518
39699
  };
39519
- function runExitHandlers() {
39700
+ async function runExitHandlers() {
39701
+ if (exitHandlersRun) return;
39702
+ exitHandlersRun = true;
39520
39703
  while (beforeExitHandlers.length) {
39521
39704
  try {
39522
- beforeExitHandlers.shift()?.();
39705
+ await beforeExitHandlers.shift()?.();
39523
39706
  } catch (e2) {
39524
39707
  }
39525
39708
  }
39526
39709
  }
39527
- var exitSignals = ["exit", "SIGINT", "SIGTERM"];
39710
+ var exitSignals = process.platform === "win32" ? ["exit"] : ["exit", "SIGINT", "SIGTERM"];
39528
39711
  exitSignals.forEach((sig) => {
39529
- process.once(sig, (signal, exitCode) => {
39530
- runExitHandlers();
39712
+ process.once(sig, async (signal, exitCode) => {
39713
+ if (sig !== "exit") {
39714
+ await runExitHandlers();
39715
+ } else {
39716
+ void runExitHandlers();
39717
+ }
39531
39718
  if (process.exitCode === void 0) {
39532
39719
  process.exitCode = exitCode !== void 0 ? 128 + exitCode : Number(signal);
39533
39720
  }
39534
- process.exit();
39721
+ if (sig !== "exit") {
39722
+ process.exit();
39723
+ }
39535
39724
  });
39536
39725
  });
39537
39726
  if (process.platform === "win32") {
@@ -39539,9 +39728,9 @@ if (process.platform === "win32") {
39539
39728
  input: process.stdin,
39540
39729
  output: process.stdout
39541
39730
  });
39542
- rl.on("SIGINT", () => {
39543
- runExitHandlers();
39544
- process.exit(1);
39731
+ rl.on("SIGINT", async () => {
39732
+ await runExitHandlers();
39733
+ process.exit(130);
39545
39734
  });
39546
39735
  registerExitHandler("Closing readline interface", () => {
39547
39736
  rl.close();
@@ -40088,7 +40277,7 @@ async function downloadTemplate(input, options = {}) {
40088
40277
  };
40089
40278
  }
40090
40279
 
40091
- // ../../dist/chunk-O3CBPX4R.js
40280
+ // ../../dist/chunk-PYPAYBFL.js
40092
40281
  import { isUtf8 } from "node:buffer";
40093
40282
  import fs5 from "node:fs";
40094
40283
  import { pathToFileURL } from "node:url";
@@ -40919,7 +41108,7 @@ var K = (e2, t3, n3) => {
40919
41108
  };
40920
41109
  var q = K;
40921
41110
 
40922
- // ../../dist/chunk-O3CBPX4R.js
41111
+ // ../../dist/chunk-PYPAYBFL.js
40923
41112
  var import_upath5 = __toESM(require_upath(), 1);
40924
41113
 
40925
41114
  // ../../node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js
@@ -41024,7 +41213,7 @@ function splitPrefixSuffix(input, options = {}) {
41024
41213
  ];
41025
41214
  }
41026
41215
 
41027
- // ../../dist/chunk-O3CBPX4R.js
41216
+ // ../../dist/chunk-PYPAYBFL.js
41028
41217
  var import_handlebars = __toESM(require_lib3(), 1);
41029
41218
 
41030
41219
  // ../../node_modules/.pnpm/@clack+core@1.0.0-alpha.6/node_modules/@clack/core/dist/index.mjs
@@ -42104,7 +42293,7 @@ function wrapAnsi(string2, columns, options) {
42104
42293
  return String(string2).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec3(line, columns, options)).join("\n");
42105
42294
  }
42106
42295
 
42107
- // ../../dist/chunk-O3CBPX4R.js
42296
+ // ../../dist/chunk-PYPAYBFL.js
42108
42297
  var import_sisteransi3 = __toESM(require_src2(), 1);
42109
42298
 
42110
42299
  // ../../node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs
@@ -42118,7 +42307,7 @@ var c2 = !o2 && globalThis.Request || dt;
42118
42307
  var R2 = !o2 && globalThis.Response || le;
42119
42308
  var T3 = !o2 && globalThis.AbortController || Mn;
42120
42309
 
42121
- // ../../dist/chunk-O3CBPX4R.js
42310
+ // ../../dist/chunk-PYPAYBFL.js
42122
42311
  var import_proxy = __toESM(require_proxy(), 1);
42123
42312
  function upper(text) {
42124
42313
  return text && text.toUpperCase();
@@ -42162,6 +42351,7 @@ function format2(text, context) {
42162
42351
  }
42163
42352
  async function askQuestion({
42164
42353
  question: questions,
42354
+ interactiveLogger,
42165
42355
  schema,
42166
42356
  validateProgressMessage
42167
42357
  }) {
@@ -42215,10 +42405,15 @@ async function askQuestion({
42215
42405
  process.exit(0);
42216
42406
  }
42217
42407
  response[name] = result2;
42408
+ interactiveLogger.messageHistory.push({
42409
+ type: "question",
42410
+ message: question.message,
42411
+ answer: result2
42412
+ });
42218
42413
  }
42219
42414
  let result;
42220
42415
  if (schema && schema.async) {
42221
- result = await interactiveLogLoading(
42416
+ result = await interactiveLogger?.logLoading(
42222
42417
  validateProgressMessage ?? "",
42223
42418
  () => safeParseAsync(schema, response)
42224
42419
  );
@@ -42231,7 +42426,7 @@ async function askQuestion({
42231
42426
  if (success) {
42232
42427
  return output;
42233
42428
  }
42234
- interactiveLogWarn(issues[0].message);
42429
+ interactiveLogger.logWarn(issues[0].message);
42235
42430
  }
42236
42431
  }
42237
42432
  var promptStateSymbol = {
@@ -42426,93 +42621,102 @@ ${userInputText}`;
42426
42621
  function autocompleteMultiSelectPrompt(opts) {
42427
42622
  return autocompletePrompt(opts, true);
42428
42623
  }
42429
- async function interactiveLogLoading(message, fn, deferredTimeMs = 300) {
42430
- if (!Logger.isInteractive) {
42431
- return await fn();
42432
- }
42433
- const output = Logger.stdout;
42434
- const columns = Ct(output);
42435
- const showMessage = (msg) => {
42436
- const wrapped = wrapAnsi(msg, columns, { hard: true, trim: false });
42437
- output.write(wrapped);
42438
- return () => {
42439
- const prevLines = wrapped.split("\n");
42440
- if (prevLines.length > 1) {
42441
- output.write(import_sisteransi3.cursor.up(prevLines.length - 1));
42442
- }
42443
- output.write(import_sisteransi3.cursor.to(0));
42444
- output.write(import_sisteransi3.erase.down());
42624
+ var InteractiveLogger = class {
42625
+ messageHistory = [];
42626
+ async logLoading(message, fn, deferredTimeMs = 300) {
42627
+ this.messageHistory.push({ type: "loading", message });
42628
+ if (!Logger.isInteractive || import.meta.env?.VITEST) {
42629
+ return await fn();
42630
+ }
42631
+ const output = Logger.stdout;
42632
+ const columns = Ct(output);
42633
+ const showMessage = (msg) => {
42634
+ const wrapped = wrapAnsi(msg, columns, { hard: true, trim: false });
42635
+ output.write(wrapped);
42636
+ return () => {
42637
+ const prevLines = wrapped.split("\n");
42638
+ if (prevLines.length > 1) {
42639
+ output.write(import_sisteransi3.cursor.up(prevLines.length - 1));
42640
+ }
42641
+ output.write(import_sisteransi3.cursor.to(0));
42642
+ output.write(import_sisteransi3.erase.down());
42643
+ };
42445
42644
  };
42446
- };
42447
- let timer;
42448
- let clearMessage;
42449
- const promise = new Promise((resolve) => {
42450
- timer = setTimeout(() => {
42451
- output.write(`${blueBright("\u2551")}
42645
+ let timer;
42646
+ let clearMessage;
42647
+ const promise = new Promise((resolve) => {
42648
+ timer = setTimeout(() => {
42649
+ output.write(`${blueBright("\u2551")}
42452
42650
  `);
42453
- clearMessage = showMessage(
42454
- `${blueBright(`${promptStateSymbol.active}\u2500`)} ${dim(message)}
42651
+ clearMessage = showMessage(
42652
+ `${blueBright(`${promptStateSymbol.active}\u2500`)} ${dim(message)}
42455
42653
  `
42654
+ );
42655
+ resolve();
42656
+ }, deferredTimeMs);
42657
+ });
42658
+ const result = await fn().then((r3) => {
42659
+ if (!clearMessage) {
42660
+ return r3;
42661
+ }
42662
+ return new Promise(
42663
+ (resolve) => setTimeout(() => resolve(r3), deferredTimeMs)
42456
42664
  );
42457
- resolve();
42458
- }, deferredTimeMs);
42459
- });
42460
- const result = await fn().then((r3) => {
42461
- if (!clearMessage) {
42462
- return r3;
42463
- }
42464
- return new Promise(
42465
- (resolve) => setTimeout(() => resolve(r3), deferredTimeMs)
42466
- );
42467
- }).catch(async (e2) => {
42468
- await promise;
42469
- clearMessage?.();
42470
- showMessage(
42471
- `${redBright(`${promptStateSymbol.error}\u2500`)} ${dim(message)}
42665
+ }).catch(async (e2) => {
42666
+ await promise;
42667
+ clearMessage?.();
42668
+ showMessage(
42669
+ `${redBright(`${promptStateSymbol.error}\u2500`)} ${dim(message)}
42472
42670
 
42473
42671
  `
42474
- );
42475
- throw e2;
42476
- });
42477
- clearTimeout(timer);
42478
- if (clearMessage) {
42479
- clearMessage();
42480
- showMessage(
42481
- `${blueBright(`${promptStateSymbol.submit}\u2500`)} ${dim(message)}
42672
+ );
42673
+ throw e2;
42674
+ });
42675
+ clearTimeout(timer);
42676
+ if (clearMessage) {
42677
+ clearMessage();
42678
+ showMessage(
42679
+ `${blueBright(`${promptStateSymbol.submit}\u2500`)} ${dim(message)}
42482
42680
  `
42483
- );
42484
- }
42485
- return result;
42486
- }
42487
- function interactiveLogInfo(message) {
42488
- if (import.meta.env?.VITEST) {
42489
- return;
42681
+ );
42682
+ }
42683
+ return result;
42490
42684
  }
42491
- Logger.stdout.write(
42492
- `${blueBright(`${promptStateSymbol.submit}\u2500`)} ${message.split("\n").join(`
42685
+ logInfo(message) {
42686
+ this.messageHistory.push({ type: "info", message });
42687
+ if (import.meta.env?.VITEST) {
42688
+ return;
42689
+ }
42690
+ Logger.stdout.write(
42691
+ `${blueBright(`${promptStateSymbol.submit}\u2500`)} ${message.split("\n").join(`
42493
42692
  ${blueBright("\u2551")} `)}
42494
42693
  `
42495
- );
42496
- }
42497
- function interactiveLogWarn(message) {
42498
- if (import.meta.env?.VITEST) {
42499
- return;
42694
+ );
42500
42695
  }
42501
- Logger.stdout.write(
42502
- `${yellowBright(`${promptStateSymbol.error}\u2500`)} ${yellowBright(message.split("\n").join(`
42696
+ logWarn(message) {
42697
+ this.messageHistory.push({ type: "warn", message });
42698
+ if (import.meta.env?.VITEST) {
42699
+ return;
42700
+ }
42701
+ Logger.stdout.write(
42702
+ `${yellowBright(`${promptStateSymbol.error}\u2500`)} ${yellowBright(message.split("\n").join(`
42503
42703
  ${yellowBright("\u2551")} `))}
42504
42704
  `
42505
- );
42506
- }
42507
- function interactiveLogOutro(message) {
42508
- if (import.meta.env?.VITEST) {
42509
- return;
42705
+ );
42510
42706
  }
42511
- Logger.stdout.write(`${blueBright("\u2551")}
42707
+ logOutro(message) {
42708
+ this.messageHistory.push({ type: "outro", message });
42709
+ if (import.meta.env?.VITEST) {
42710
+ return;
42711
+ }
42712
+ Logger.stdout.write(
42713
+ `${blueBright("\u2551")}
42512
42714
  ${blueBright("\u2559\u2500")} ${message}
42513
42715
 
42514
- `);
42515
- }
42716
+ `
42717
+ );
42718
+ }
42719
+ };
42516
42720
  function createFetch(options) {
42517
42721
  const url = options.proxyServer ?? process.env.HTTP_PROXY;
42518
42722
  const proxy = url ? (0, import_proxy.createProxy)({
@@ -42560,6 +42764,7 @@ async function create(inlineConfig) {
42560
42764
  Logger.setLogOptions(inlineConfig);
42561
42765
  Logger.debug("create > inlineConfig %O", inlineConfig);
42562
42766
  const fetch2 = createFetch(inlineConfig);
42767
+ const interactiveLogger = new InteractiveLogger();
42563
42768
  let {
42564
42769
  projectPath,
42565
42770
  cwd: cwd2 = cwd,
@@ -42568,29 +42773,34 @@ async function create(inlineConfig) {
42568
42773
  language,
42569
42774
  theme,
42570
42775
  template,
42776
+ installDependencies,
42571
42777
  createConfigFileOnly = false
42572
42778
  } = inlineConfig;
42573
42779
  let extraTemplateVariables = {};
42574
42780
  let themePackage;
42575
- let installDependencies;
42576
42781
  let useLocalTemplate = false;
42577
42782
  if (template && !/^([\w-.]+):/.test(template)) {
42578
42783
  const absTemplatePath = import_upath5.default.resolve(cwd2, template);
42579
42784
  useLocalTemplate = fs5.existsSync(import_upath5.default.resolve(cwd2, template)) && fs5.statSync(import_upath5.default.resolve(cwd2, template)).isDirectory();
42785
+ const usingPresetTemplate = TEMPLATE_SETTINGS.find(
42786
+ (t3) => t3.value === template
42787
+ );
42580
42788
  if (useLocalTemplate) {
42581
42789
  template = absTemplatePath;
42582
- interactiveLogInfo(
42790
+ interactiveLogger.logInfo(
42583
42791
  `Using the specified local template directory
42584
42792
  ${dim(import_upath5.default.relative(cwd2, absTemplatePath) || ".")}`
42585
42793
  );
42794
+ } else if (usingPresetTemplate) {
42795
+ template = usingPresetTemplate.template;
42586
42796
  } else {
42587
- interactiveLogWarn(
42797
+ interactiveLogger.logWarn(
42588
42798
  `The specified theme ${green(template)} was not found as a local directory. Proceeding to fetch it from GitHub repository.`
42589
42799
  );
42590
42800
  }
42591
42801
  }
42592
42802
  if (!projectPath) {
42593
- ({ projectPath } = await askProjectPath());
42803
+ ({ projectPath } = await askProjectPath({ interactiveLogger }));
42594
42804
  }
42595
42805
  const dist = import_upath5.default.join(cwd2, projectPath);
42596
42806
  if (createConfigFileOnly) {
@@ -42601,35 +42811,41 @@ ${dim(import_upath5.default.relative(cwd2, absTemplatePath) || ".")}`
42601
42811
  throw new Error(`Destination ${dist} is not empty.`);
42602
42812
  }
42603
42813
  if (!title2) {
42604
- ({ title: title2 } = createConfigFileOnly ? { title: DEFAULT_PROJECT_TITLE } : await askTitle({ projectPath }));
42814
+ ({ title: title2 } = createConfigFileOnly ? { title: DEFAULT_PROJECT_TITLE } : await askTitle({ projectPath, interactiveLogger }));
42605
42815
  }
42606
42816
  if (!author) {
42607
- ({ author } = createConfigFileOnly ? { author: DEFAULT_PROJECT_AUTHOR } : await askAuthor());
42817
+ ({ author } = createConfigFileOnly ? { author: DEFAULT_PROJECT_AUTHOR } : await askAuthor({ interactiveLogger }));
42608
42818
  }
42609
42819
  if (!language) {
42610
- ({ language } = createConfigFileOnly ? { language: await getOsLocale() } : await askLanguage());
42820
+ ({ language } = createConfigFileOnly ? { language: await getOsLocale() } : await askLanguage({ interactiveLogger }));
42611
42821
  }
42612
42822
  if (!createConfigFileOnly) {
42613
42823
  let presetTemplate;
42614
42824
  if (!template) {
42615
- ({ presetTemplate } = await askPresetTemplate());
42825
+ ({ presetTemplate } = await askPresetTemplate({ interactiveLogger }));
42616
42826
  if (presetTemplate) {
42617
42827
  template = presetTemplate.template;
42618
42828
  }
42619
42829
  }
42620
- if (!theme) {
42830
+ if (!theme && theme !== false) {
42621
42831
  ({ theme, themePackage } = await askTheme({
42622
42832
  presetTemplate,
42623
42833
  template,
42624
- fetch: fetch2
42834
+ fetch: fetch2,
42835
+ interactiveLogger
42625
42836
  }));
42626
42837
  }
42627
42838
  if (!template) {
42628
- ({ template, extraTemplateVariables } = await askThemeTemplate(
42629
- themePackage?.vivliostyle
42630
- ));
42839
+ ({ template, extraTemplateVariables } = await askThemeTemplate({
42840
+ themeMetadata: themePackage?.vivliostyle,
42841
+ interactiveLogger
42842
+ }));
42843
+ }
42844
+ if (typeof installDependencies !== "boolean") {
42845
+ ({ installDependencies } = await askInstallDependencies({
42846
+ interactiveLogger
42847
+ }));
42631
42848
  }
42632
- ({ installDependencies } = await askInstallDependencies());
42633
42849
  }
42634
42850
  const browserType = "chrome";
42635
42851
  const browserTag = getDefaultBrowserTag(browserType);
@@ -42668,7 +42884,11 @@ ${dim(import_upath5.default.relative(cwd2, absTemplatePath) || ".")}`
42668
42884
  } else {
42669
42885
  var _stack2 = [];
42670
42886
  try {
42671
- interactiveLogOutro("All configurations are set! Creating your project...");
42887
+ if (interactiveLogger.messageHistory.length > 0) {
42888
+ interactiveLogger.logOutro(
42889
+ "All configurations are set! Creating your project..."
42890
+ );
42891
+ }
42672
42892
  const _3 = __using(_stack2, Logger.startLogging(
42673
42893
  useLocalTemplate ? "Copying a local template" : "Downloading a template"
42674
42894
  ));
@@ -42718,7 +42938,9 @@ ${dim(import_upath5.default.relative(cwd2, absTemplatePath) || ".")}`
42718
42938
  });
42719
42939
  }
42720
42940
  }
42721
- async function askProjectPath() {
42941
+ async function askProjectPath({
42942
+ interactiveLogger
42943
+ }) {
42722
42944
  return await askQuestion({
42723
42945
  question: {
42724
42946
  projectPath: {
@@ -42730,10 +42952,14 @@ async function askProjectPath() {
42730
42952
  },
42731
42953
  schema: required(
42732
42954
  pick(VivliostyleInlineConfigWithoutChecks, ["projectPath"])
42733
- )
42955
+ ),
42956
+ interactiveLogger
42734
42957
  });
42735
42958
  }
42736
- async function askTitle({ projectPath }) {
42959
+ async function askTitle({
42960
+ projectPath,
42961
+ interactiveLogger
42962
+ }) {
42737
42963
  return await askQuestion({
42738
42964
  question: {
42739
42965
  title: {
@@ -42743,10 +42969,13 @@ async function askTitle({ projectPath }) {
42743
42969
  placeholder: toTitleCase(projectPath) || DEFAULT_PROJECT_TITLE
42744
42970
  }
42745
42971
  },
42746
- schema: required(pick(VivliostyleInlineConfigWithoutChecks, ["title"]))
42972
+ schema: required(pick(VivliostyleInlineConfigWithoutChecks, ["title"])),
42973
+ interactiveLogger
42747
42974
  });
42748
42975
  }
42749
- async function askAuthor() {
42976
+ async function askAuthor({
42977
+ interactiveLogger
42978
+ }) {
42750
42979
  return await askQuestion({
42751
42980
  question: {
42752
42981
  author: {
@@ -42758,10 +42987,13 @@ async function askAuthor() {
42758
42987
  },
42759
42988
  schema: required(
42760
42989
  pick(VivliostyleInlineConfigWithoutChecks, ["author"])
42761
- )
42990
+ ),
42991
+ interactiveLogger
42762
42992
  });
42763
42993
  }
42764
- async function askLanguage() {
42994
+ async function askLanguage({
42995
+ interactiveLogger
42996
+ }) {
42765
42997
  const initialValue = await getOsLocale();
42766
42998
  return await askQuestion({
42767
42999
  question: {
@@ -42778,11 +43010,14 @@ async function askLanguage() {
42778
43010
  },
42779
43011
  schema: required(
42780
43012
  pick(VivliostyleInlineConfigWithoutChecks, ["language"])
42781
- )
43013
+ ),
43014
+ interactiveLogger
42782
43015
  });
42783
43016
  }
42784
43017
  var PRESET_TEMPLATE_NOT_USE = "Use templates from the community theme";
42785
- async function askPresetTemplate() {
43018
+ async function askPresetTemplate({
43019
+ interactiveLogger
43020
+ }) {
42786
43021
  const { presetTemplate } = await askQuestion({
42787
43022
  question: {
42788
43023
  presetTemplate: {
@@ -42805,7 +43040,8 @@ async function askPresetTemplate() {
42805
43040
  (value) => value === PRESET_TEMPLATE_NOT_USE ? void 0 : TEMPLATE_SETTINGS.find((t3) => t3.value === value)
42806
43041
  )
42807
43042
  )
42808
- })
43043
+ }),
43044
+ interactiveLogger
42809
43045
  });
42810
43046
  return { presetTemplate };
42811
43047
  }
@@ -42819,10 +43055,11 @@ var THEME_ANSWER_MANUAL = "Install other themes from npm";
42819
43055
  async function askTheme({
42820
43056
  template,
42821
43057
  presetTemplate,
42822
- fetch: fetch2
43058
+ fetch: fetch2,
43059
+ interactiveLogger
42823
43060
  }) {
42824
43061
  const useCommunityThemes = !presetTemplate && !template;
42825
- const themePackages = await interactiveLogLoading(
43062
+ const themePackages = await interactiveLogger.logLoading(
42826
43063
  "Fetching a list of Vivliostyle themes...",
42827
43064
  async () => {
42828
43065
  let themes = (await listVivliostyleThemes({ fetch: fetch2 })).objects;
@@ -42885,7 +43122,8 @@ async function askTheme({
42885
43122
  }
42886
43123
  },
42887
43124
  schema: objectAsync({ theme: validateThemeMetadataSchema }),
42888
- validateProgressMessage: "Fetching package metadata..."
43125
+ validateProgressMessage: "Fetching package metadata...",
43126
+ interactiveLogger
42889
43127
  });
42890
43128
  if (theme === THEME_ANSWER_NOT_USE) {
42891
43129
  return { theme: void 0, themePackage: void 0 };
@@ -42920,7 +43158,8 @@ async function askTheme({
42920
43158
  validateThemeMetadataSchema
42921
43159
  )
42922
43160
  }),
42923
- validateProgressMessage: "Fetching package metadata..."
43161
+ validateProgressMessage: "Fetching package metadata...",
43162
+ interactiveLogger
42924
43163
  }).then((ret) => ret.themeManualInput);
42925
43164
  }
42926
43165
  return {
@@ -42930,7 +43169,10 @@ async function askTheme({
42930
43169
  themePackage
42931
43170
  };
42932
43171
  }
42933
- async function askThemeTemplate(themeMetadata) {
43172
+ async function askThemeTemplate({
43173
+ interactiveLogger,
43174
+ themeMetadata
43175
+ }) {
42934
43176
  const themeTemplate = themeMetadata?.template;
42935
43177
  const options = Object.entries(themeTemplate || {}).map(([value, tmpl]) => ({
42936
43178
  label: tmpl.name || value,
@@ -42938,7 +43180,7 @@ async function askThemeTemplate(themeMetadata) {
42938
43180
  hint: truncateString(tmpl.description || "")
42939
43181
  }));
42940
43182
  if (!themeTemplate || options.length === 0) {
42941
- interactiveLogWarn(
43183
+ interactiveLogger.logWarn(
42942
43184
  "The chosen theme does not set template settings. Applying the minimal template."
42943
43185
  );
42944
43186
  return {
@@ -42959,19 +43201,23 @@ async function askThemeTemplate(themeMetadata) {
42959
43201
  string(),
42960
43202
  transform((input) => themeTemplate[input])
42961
43203
  )
42962
- })
43204
+ }),
43205
+ interactiveLogger
42963
43206
  });
42964
43207
  let extraTemplateVariables = {};
42965
43208
  if (usingTemplate.prompt?.length) {
42966
43209
  extraTemplateVariables = await askQuestion({
42967
43210
  question: Object.fromEntries(
42968
43211
  usingTemplate.prompt.map((q2) => [q2.name, q2])
42969
- )
43212
+ ),
43213
+ interactiveLogger
42970
43214
  });
42971
43215
  }
42972
43216
  return { template: usingTemplate.source, extraTemplateVariables };
42973
43217
  }
42974
- async function askInstallDependencies() {
43218
+ async function askInstallDependencies({
43219
+ interactiveLogger
43220
+ }) {
42975
43221
  return await askQuestion({
42976
43222
  question: {
42977
43223
  installDependencies: {
@@ -42985,7 +43231,8 @@ async function askInstallDependencies() {
42985
43231
  },
42986
43232
  schema: object({
42987
43233
  installDependencies: boolean()
42988
- })
43234
+ }),
43235
+ interactiveLogger
42989
43236
  });
42990
43237
  }
42991
43238
  async function setupTemplate({
@@ -43123,9 +43370,15 @@ For more information, visit ${terminalLink(yellow("https://docs.vivliostyle.org"
43123
43370
  // ../../dist/commands/create.js
43124
43371
  function setupCreateParserProgram() {
43125
43372
  const program2 = new Command();
43126
- program2.name("vivliostyle create").description("scaffold a new Vivliostyle project").arguments("[projectPath]").option("--title <title>", "title").option("--author <author>", "author").option("-l, --language <language>", "language").option("-s, --size <size>", "paper size").option("-T, --theme <theme>", "theme").option(
43373
+ program2.name("vivliostyle create").description("scaffold a new Vivliostyle project").arguments("[projectPath]").option("--title <title>", "title").option("--author <author>", "author").option("-l, --language <language>", "language").option("-s, --size <size>", "paper size").option("-T, --theme <theme>", "theme").option("--no-theme", "Do not include a theme.").option(
43127
43374
  "--template <template>",
43128
43375
  `Template source in the format of \`[provider]:repo[/subpath][#ref]\` or as a local directory to copy from.`
43376
+ ).option(
43377
+ "--install-dependencies",
43378
+ "Install dependencies after creating a project."
43379
+ ).option(
43380
+ "--no-install-dependencies",
43381
+ "Do not install dependencies after creating a project."
43129
43382
  ).option(
43130
43383
  "--create-config-file-only",
43131
43384
  `Create a Vivliostyle config file without generating project template files.`