create-book 11.0.3 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -22,28 +22,28 @@ import fs$1 from "node:fs/promises";
22
22
  const CONTAINER_URL = "ghcr.io/vivliostyle/cli";
23
23
  const DEFAULT_BROWSER_VERSIONS = {
24
24
  chrome: {
25
- "linux": "150.0.7871.24",
26
- "linux_arm": "150.0.7871.24",
27
- "mac": "150.0.7871.24",
28
- "mac_arm": "150.0.7871.24",
29
- "win32": "150.0.7871.24",
30
- "win64": "150.0.7871.24"
25
+ "linux": "150.0.7871.115",
26
+ "linux_arm": "150.0.7871.115",
27
+ "mac": "150.0.7871.115",
28
+ "mac_arm": "150.0.7871.115",
29
+ "win32": "150.0.7871.115",
30
+ "win64": "150.0.7871.115"
31
31
  },
32
32
  chromium: {
33
- "linux": "1651380",
34
- "linux_arm": "1651380",
35
- "mac": "1651385",
36
- "mac_arm": "1651385",
37
- "win32": "1651280",
38
- "win64": "1651309"
33
+ "linux": "1660895",
34
+ "linux_arm": "1660895",
35
+ "mac": "1660898",
36
+ "mac_arm": "1660899",
37
+ "win32": "1660891",
38
+ "win64": "1660891"
39
39
  },
40
40
  firefox: {
41
- "linux": "stable_152.0.2",
42
- "linux_arm": "stable_152.0.2",
43
- "mac": "stable_152.0.2",
44
- "mac_arm": "stable_152.0.2",
45
- "win32": "stable_152.0.2",
46
- "win64": "stable_152.0.2"
41
+ "linux": "stable_152.0.5",
42
+ "linux_arm": "stable_152.0.5",
43
+ "mac": "stable_152.0.5",
44
+ "mac_arm": "stable_152.0.5",
45
+ "win32": "stable_152.0.5",
46
+ "win64": "stable_152.0.5"
47
47
  }
48
48
  };
49
49
  const DEFAULT_CONFIG_FILENAME = "vivliostyle.config.js";
@@ -10547,6 +10547,7 @@ const defaultSpinner = {
10547
10547
  };
10548
10548
  const SYNCHRONIZED_OUTPUT_ENABLE = "\x1B[?2026h";
10549
10549
  const SYNCHRONIZED_OUTPUT_DISABLE = "\x1B[?2026l";
10550
+ const oscSequenceRegex = /][\s\S]*?(?:|\\)/g;
10550
10551
  const activeHooksPerStream = /* @__PURE__ */ new Set();
10551
10552
  var YoctoSpinner = class {
10552
10553
  #frames;
@@ -10753,7 +10754,7 @@ var YoctoSpinner = class {
10753
10754
  }
10754
10755
  #lineCount(text) {
10755
10756
  const width = this.#stream.columns ?? 80;
10756
- const lines = stripVTControlCharacters(text).split("\n");
10757
+ const lines = stripVTControlCharacters(text.replaceAll(oscSequenceRegex, "")).split("\n");
10757
10758
  let lineCount = 0;
10758
10759
  for (const line of lines) lineCount += Math.max(1, Math.ceil(line.length / width));
10759
10760
  return lineCount;
@@ -10784,7 +10785,7 @@ function yoctoSpinner(options) {
10784
10785
  return new YoctoSpinner(options);
10785
10786
  }
10786
10787
  //#endregion
10787
- //#region ../../dist/util-DRLHkKnG.js
10788
+ //#region ../../dist/util-CsmUMRtR.js
10788
10789
  const isUnicodeSupported = process.platform !== "win32" || Boolean(process.env.WT_SESSION);
10789
10790
  [
10790
10791
  "📕",
@@ -10822,6 +10823,11 @@ var Logger = class Logger {
10822
10823
  static #stdout = process.stdout;
10823
10824
  static #stderr = process.stderr;
10824
10825
  static #signal;
10826
+ /**
10827
+ * True in the forked build subprocess (renderMode: docker),
10828
+ * which logs non-interactively.
10829
+ */
10830
+ static #containerForkMode = false;
10825
10831
  static {
10826
10832
  this.debug = (0, import_src$2.default)("vs-cli");
10827
10833
  }
@@ -10851,7 +10857,7 @@ var Logger = class Logger {
10851
10857
  return this.#signal;
10852
10858
  }
10853
10859
  static get isInteractive() {
10854
- return !this.#customLogger && this.#stderr.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env) && !import.meta.env?.VITEST && !import_src$2.default.enabled("vs-cli") && !isInContainer();
10860
+ return !this.#customLogger && this.#stderr.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env) && !import.meta.env?.VITEST && !import_src$2.default.enabled("vs-cli") && !this.#containerForkMode;
10855
10861
  }
10856
10862
  static startLogging(text) {
10857
10863
  if (this.#logLevel === 0) return;
@@ -10897,6 +10903,16 @@ var Logger = class Logger {
10897
10903
  this.#spinner.start(messages.join(" "));
10898
10904
  this.#nonBlockingLogPrinted = false;
10899
10905
  }
10906
+ /**
10907
+ * Update the text of the running spinner in place without printing a
10908
+ * checkpoint line. Unlike `logUpdate`, this method does nothing when the
10909
+ * output is not interactive, so it is safe to call at a high frequency.
10910
+ */
10911
+ static logUpdateProgress(...messages) {
10912
+ if (this.#logLevel < 1 || !this.#spinner || !this.isInteractive) return;
10913
+ this.#spinner.text = messages.join(" ");
10914
+ this.#nonBlockingLogPrinted = true;
10915
+ }
10900
10916
  static getMessage(message, symbol) {
10901
10917
  return !this.#customLogger && symbol ? `${symbol} ${message}` : message;
10902
10918
  }
@@ -10932,7 +10948,7 @@ var Logger = class Logger {
10932
10948
  if (this.#logLevel < 2) return;
10933
10949
  this.#nonBlockingLog("info", this.getMessage(messages.join(" ")));
10934
10950
  }
10935
- static setLogOptions({ logLevel, logger, stdin, stdout, stderr, signal }) {
10951
+ static setLogOptions({ logLevel, logger, stdin, stdout, stderr, signal, containerForkMode }) {
10936
10952
  if (logLevel) {
10937
10953
  this.#logLevel = {
10938
10954
  silent: 0,
@@ -10947,6 +10963,7 @@ var Logger = class Logger {
10947
10963
  if (stdout) this.#stdout = stdout;
10948
10964
  if (stderr) this.#stderr = stderr;
10949
10965
  if (signal) this.#signal = signal;
10966
+ if (containerForkMode !== void 0) this.#containerForkMode = containerForkMode;
10950
10967
  }
10951
10968
  static setLogPrefix(prefix) {
10952
10969
  this.#logPrefix = prefix;
@@ -11084,9 +11101,6 @@ function cachedFn(fn) {
11084
11101
  let cache = null;
11085
11102
  return () => cache ?? (cache = fn());
11086
11103
  }
11087
- const isInContainer = cachedFn(function isInContainer() {
11088
- return fs.existsSync("/opt/vivliostyle-cli/.vs-cli-version");
11089
- });
11090
11104
  let cachedLocale;
11091
11105
  function getOsLocale() {
11092
11106
  if (import.meta.env?.VITEST) return process.env.TEST_LOCALE || "en";
@@ -79200,7 +79214,7 @@ import_remove.default.removeSync;
79200
79214
  ...import_remove.default
79201
79215
  });
79202
79216
  //#endregion
79203
- //#region ../../dist/asset-BNOhdFXR.js
79217
+ //#region ../../dist/asset-DBj3nifv.js
79204
79218
  function createParserProgram({ setupProgram, parseArgs }) {
79205
79219
  return (argv) => {
79206
79220
  const program = setupProgram();
@@ -79227,6 +79241,60 @@ function locateVivliostyleConfig({ config, cwd: cwd$1$2 = cwd$1 }) {
79227
79241
  ".json"
79228
79242
  ].map((ext) => import_upath.default.join(cwd$1$2, `vivliostyle.config${ext}`)).find((p) => fs.existsSync(p));
79229
79243
  }
79244
+ function _usingCtx() {
79245
+ var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
79246
+ var n = Error();
79247
+ return n.name = "SuppressedError", n.error = r, n.suppressed = e, n;
79248
+ }, e = {}, n = [];
79249
+ function using(r, e) {
79250
+ if (null != e) {
79251
+ if (Object(e) !== e) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
79252
+ if (r) var o = e[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
79253
+ if (void 0 === o && (o = e[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r)) var t = o;
79254
+ if ("function" != typeof o) throw new TypeError("Object is not disposable.");
79255
+ t && (o = function o() {
79256
+ try {
79257
+ t.call(e);
79258
+ } catch (r) {
79259
+ return Promise.reject(r);
79260
+ }
79261
+ }), n.push({
79262
+ v: e,
79263
+ d: o,
79264
+ a: r
79265
+ });
79266
+ } else r && n.push({
79267
+ d: e,
79268
+ a: r
79269
+ });
79270
+ return e;
79271
+ }
79272
+ return {
79273
+ e,
79274
+ u: using.bind(null, !1),
79275
+ a: using.bind(null, !0),
79276
+ d: function d() {
79277
+ var o, t = this.e, s = 0;
79278
+ function next() {
79279
+ for (; o = n.pop();) try {
79280
+ if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
79281
+ if (o.d) {
79282
+ var r = o.d.call(o.v);
79283
+ if (o.a) return s |= 2, Promise.resolve(r).then(next, err);
79284
+ } else s |= 1;
79285
+ } catch (r) {
79286
+ return err(r);
79287
+ }
79288
+ if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
79289
+ if (t !== e) throw t;
79290
+ }
79291
+ function err(n) {
79292
+ return t = t !== e ? new r(n, t) : n, next();
79293
+ }
79294
+ return next();
79295
+ }
79296
+ };
79297
+ }
79230
79298
  var GlobMatcher = class {
79231
79299
  #matchers;
79232
79300
  constructor(matcherConfig) {
@@ -79244,7 +79312,7 @@ var GlobMatcher = class {
79244
79312
  }
79245
79313
  };
79246
79314
  //#endregion
79247
- //#region ../../dist/entry-util-DKwn9x2e.js
79315
+ //#region ../../dist/entry-util-Bh1ksaYK.js
79248
79316
  var CliInterruptError = class extends Error {
79249
79317
  constructor(exitCode) {
79250
79318
  super(exitCode === 130 ? "Interrupted by SIGINT" : `Terminated by signal: ${exitCode}`);
@@ -88636,7 +88704,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
88636
88704
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
88637
88705
  /*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
88638
88706
  //#endregion
88639
- //#region ../../dist/create-CU4x2WXg.js
88707
+ //#region ../../dist/create-BF3vSlSR.js
88640
88708
  var import_proxy = (/* @__PURE__ */ __commonJSMin(((exports) => {
88641
88709
  var Ye = Object.defineProperty;
88642
88710
  var Re = (A) => {
@@ -100816,9 +100884,10 @@ async function create(inlineConfig) {
100816
100884
  ...explicitTemplateVariables
100817
100885
  }
100818
100886
  });
100819
- else {
100887
+ else try {
100888
+ var _usingCtx$1 = _usingCtx();
100820
100889
  if (interactiveLogger.messageHistory.length > 0) interactiveLogger.logOutro("All configurations are set! Creating your project...");
100821
- using _ = Logger.startLogging(useLocalTemplate ? "Copying a local template" : "Downloading a template");
100890
+ _usingCtx$1.u(Logger.startLogging(useLocalTemplate ? "Copying a local template" : "Downloading a template"));
100822
100891
  /* v8 ignore next 3 */
100823
100892
  if (!template) throw new Error("No template is set to create a project.");
100824
100893
  await setupTemplate({
@@ -100832,16 +100901,25 @@ async function create(inlineConfig) {
100832
100901
  },
100833
100902
  useLocalTemplate
100834
100903
  });
100835
- if (installDependencies) {
100904
+ if (installDependencies) try {
100905
+ var _usingCtx3 = _usingCtx();
100836
100906
  const pm = whichPm();
100837
- using _ = Logger.suspendLogging(`Installing dependencies with ${pm}`);
100907
+ _usingCtx3.u(Logger.suspendLogging(`Installing dependencies with ${pm}`));
100838
100908
  await performInstallDependencies({
100839
100909
  projectPath,
100840
100910
  cwd: cwd$1$1,
100841
100911
  pm,
100842
100912
  signal: inlineConfig.signal
100843
100913
  });
100914
+ } catch (_) {
100915
+ _usingCtx3.e = _;
100916
+ } finally {
100917
+ _usingCtx3.d();
100844
100918
  }
100919
+ } catch (_) {
100920
+ _usingCtx$1.e = _;
100921
+ } finally {
100922
+ _usingCtx$1.d();
100845
100923
  }
100846
100924
  const output = createConfigFileOnly ? import_upath.default.join(dist, DEFAULT_CONFIG_FILENAME) : dist;
100847
100925
  const relativeOutput = import_upath.default.relative(cwd$1$1, output) || ".";
@@ -104058,7 +104136,7 @@ const { program, createCommand, createArgument, createOption, CommanderError, In
104058
104136
  exports.InvalidOptionArgumentError = InvalidArgumentError;
104059
104137
  })))(), 1)).default;
104060
104138
  //#endregion
104061
- //#region ../../dist/create.runner-BgNbXj3W.js
104139
+ //#region ../../dist/create.runner-C4VHkWP9.js
104062
104140
  function setupCreateParserProgram() {
104063
104141
  const program = new Command();
104064
104142
  program.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("--template <template>", `Template source in the format of \`[provider]:repo[/subpath][#ref]\` or as a local directory to copy from.`).option("--install-dependencies", "Install dependencies after creating a project.").option("--no-install-dependencies", "Do not install dependencies after creating a project.").option("--create-config-file-only", `Create a Vivliostyle config file without generating project template files.`).addOption(new Option("--proxy-server <proxyServer>", `HTTP/SOCK proxy server url`)).addOption(new Option("--proxy-bypass <proxyBypass>", `optional comma-separated domains to bypass proxy`)).addOption(new Option("--proxy-user <proxyUser>", `optional username for HTTP proxy authentication`)).addOption(new Option("--proxy-pass <proxyPass>", `optional password for HTTP proxy authentication`)).addOption(new Option("--log-level <level>", "specify a log level of console outputs").choices([