@vivliostyle/cli 9.0.0-next.6 → 9.0.0-next.7

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.
@@ -9,7 +9,7 @@ import {
9
9
  vsStaticServePlugin,
10
10
  vsViewerPlugin,
11
11
  warnDeprecatedConfig
12
- } from "./chunk-VBEHGS67.js";
12
+ } from "./chunk-KJ2TDIM3.js";
13
13
  import {
14
14
  VivliostyleInlineConfig
15
15
  } from "./chunk-DMARNPN5.js";
@@ -34,10 +34,9 @@ import {
34
34
  evaluate,
35
35
  parse
36
36
  } from "@humanwhocodes/momoa";
37
- import AjvModule from "ajv";
38
- import AjvFormatsModule from "ajv-formats";
37
+ import { Ajv } from "ajv";
38
+ import formatsPlugin from "ajv-formats";
39
39
  import { XMLParser } from "fast-xml-parser";
40
- import { removeSync } from "fs-extra/esm";
41
40
  import StreamZip from "node-stream-zip";
42
41
  import fs from "node:fs";
43
42
  import readline from "node:readline";
@@ -896,7 +895,7 @@ function useTmpDirectory() {
896
895
  }]);
897
896
  }
898
897
  const callback = () => {
899
- removeSync(path);
898
+ fs.rmSync(path, { force: true, recursive: true });
900
899
  };
901
900
  registerExitHandler(
902
901
  `Removing the temporary directory: ${path}`,
@@ -911,7 +910,7 @@ function touchTmpFile(path) {
911
910
  fs.closeSync(fs.openSync(path, "a"));
912
911
  Logger.debug(`Created the temporary file: ${path}`);
913
912
  const callback = () => {
914
- removeSync(path);
913
+ fs.rmSync(path, { force: true, recursive: true });
915
914
  };
916
915
  registerExitHandler(`Removing the temporary file: ${path}`, callback);
917
916
  return callback;
@@ -929,11 +928,14 @@ function isValidUri(str) {
929
928
  function isInContainer() {
930
929
  return fs.existsSync("/opt/vivliostyle-cli/.vs-cli-version");
931
930
  }
931
+ function isRunningOnWSL() {
932
+ return fs.existsSync("/proc/version") && fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft");
933
+ }
932
934
  async function openEpub(epubPath, tmpDir) {
933
935
  await inflateZip(epubPath, tmpDir);
934
936
  Logger.debug(`Created the temporary EPUB directory: ${tmpDir}`);
935
937
  const deleteEpub = () => {
936
- fs.rmSync(tmpDir, { recursive: true });
938
+ fs.rmSync(tmpDir, { force: true, recursive: true });
937
939
  };
938
940
  registerExitHandler(
939
941
  `Removing the temporary EPUB directory: ${tmpDir}`,
@@ -967,10 +969,9 @@ function getEpubRootDir(epubOpfPath) {
967
969
  }
968
970
  return traverse(upath.dirname(epubOpfPath));
969
971
  }
970
- var Ajv = AjvModule.default;
971
- var addFormats = AjvFormatsModule.default;
972
972
  var getAjvValidatorFunction = (schema, refSchemas) => (obj) => {
973
973
  const ajv = new Ajv({ strict: false });
974
+ const addFormats = formatsPlugin;
974
975
  addFormats(ajv);
975
976
  if (refSchemas) {
976
977
  ajv.addSchema(refSchemas);
@@ -1301,16 +1302,16 @@ async function launchBrowser({
1301
1302
  headless,
1302
1303
  args: [
1303
1304
  "--allow-file-access-from-files",
1304
- disableWebSecurity && "--disable-web-security",
1305
- disableDevShmUsage && "--disable-dev-shm-usage",
1305
+ ...disableWebSecurity ? ["--disable-web-security"] : [],
1306
+ ...disableDevShmUsage ? ["--disable-dev-shm-usage"] : [],
1306
1307
  // #357: Set devicePixelRatio=1 otherwise it causes layout issues in HiDPI displays
1307
- headless && "--force-device-scale-factor=1",
1308
- // set Chromium language to English to avoid locale-dependent issues (e.g. minimum font size)
1309
- "--lang=en"
1310
- // ...(!headless && process.platform === 'darwin'
1311
- // ? ['-AppleLanguages', '(en)']
1312
- // : []),
1313
- ].filter((value) => Boolean(value)),
1308
+ ...headless ? ["--force-device-scale-factor=1"] : [],
1309
+ // #565: Add --disable-gpu option when running on WSL
1310
+ ...isRunningOnWSL() ? ["--disable-gpu"] : [],
1311
+ // set Chromium language to English to avoid locale-dependent issues
1312
+ "--lang=en",
1313
+ ...!headless && process.platform === "darwin" ? ["", "-AppleLanguages", "(en)"] : []
1314
+ ],
1314
1315
  env: { ...process.env, LANG: "en.UTF-8" },
1315
1316
  proxy
1316
1317
  } : (
@@ -2357,7 +2358,7 @@ Maybe you want to set the "output" field instead.`
2357
2358
  }
2358
2359
 
2359
2360
  // src/processor/compile.ts
2360
- import { copy as copy3, move, remove as remove3 } from "fs-extra/esm";
2361
+ import { copy as copy3, move } from "fs-extra/esm";
2361
2362
  import fs9 from "node:fs";
2362
2363
  import picomatch from "picomatch";
2363
2364
  import prettier from "prettier";
@@ -2367,7 +2368,7 @@ import upath9 from "upath";
2367
2368
  import MIMEType2 from "whatwg-mimetype";
2368
2369
 
2369
2370
  // src/output/webbook.ts
2370
- import { copy as copy2, remove as remove2 } from "fs-extra/esm";
2371
+ import { copy as copy2 } from "fs-extra/esm";
2371
2372
  import { lookup as mime3 } from "mime-types";
2372
2373
  import fs7 from "node:fs";
2373
2374
  import { pathToFileURL as pathToFileURL6 } from "node:url";
@@ -2415,7 +2416,10 @@ var createVirtualConsole = (onError) => {
2415
2416
  });
2416
2417
  return virtualConsole;
2417
2418
  };
2418
- var htmlPurify = DOMPurify(new JSDOM("").window);
2419
+ var htmlPurify = DOMPurify(
2420
+ // @ts-expect-error: jsdom.DOMWindow should have trustedTypes property
2421
+ new JSDOM("").window
2422
+ );
2419
2423
  var ResourceLoader = class extends BaseResourceLoader {
2420
2424
  fetcherMap = /* @__PURE__ */ new Map();
2421
2425
  fetch(url, options) {
@@ -2932,7 +2936,7 @@ function parsePageListDocument(dom) {
2932
2936
  import archiver from "archiver";
2933
2937
  import { lookup as lookupLanguage } from "bcp-47-match";
2934
2938
  import { XMLBuilder } from "fast-xml-parser";
2935
- import { copy, remove } from "fs-extra/esm";
2939
+ import { copy } from "fs-extra/esm";
2936
2940
  import GithubSlugger from "github-slugger";
2937
2941
  import { lookup as mime2 } from "mime-types";
2938
2942
  import fs6 from "node:fs";
@@ -3164,7 +3168,10 @@ async function exportEpub({
3164
3168
  });
3165
3169
  }
3166
3170
  if (relManifestPath) {
3167
- await remove(upath7.join(tmpDir, "EPUB", relManifestPath));
3171
+ await fs6.promises.rm(upath7.join(tmpDir, "EPUB", relManifestPath), {
3172
+ force: true,
3173
+ recursive: true
3174
+ });
3168
3175
  delete manifestItem[relManifestPath];
3169
3176
  }
3170
3177
  fs6.writeFileSync(
@@ -3492,7 +3499,7 @@ async function prepareWebPublicationDirectory({
3492
3499
  }) {
3493
3500
  if (fs7.existsSync(outputDir)) {
3494
3501
  Logger.debug("going to remove existing webpub", outputDir);
3495
- await remove2(outputDir);
3502
+ await fs7.promises.rm(outputDir, { force: true, recursive: true });
3496
3503
  }
3497
3504
  fs7.mkdirSync(outputDir, { recursive: true });
3498
3505
  }
@@ -4037,7 +4044,7 @@ async function cleanupWorkspace({
4037
4044
  );
4038
4045
  await move(themesDir, movedThemePath);
4039
4046
  }
4040
- await remove3(workspaceDir);
4047
+ await fs9.promises.rm(workspaceDir, { recursive: true, force: true });
4041
4048
  if (movedWorkspacePath) {
4042
4049
  await move(movedWorkspacePath, workspaceDir);
4043
4050
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveViteConfig
3
- } from "./chunk-QC3BOE2G.js";
3
+ } from "./chunk-NWDF2NRZ.js";
4
4
  import {
5
5
  Logger,
6
6
  createViteServer,
@@ -13,7 +13,7 @@ import {
13
13
  resolveTaskConfig,
14
14
  setupConfigFromFlags,
15
15
  warnDeprecatedConfig
16
- } from "./chunk-VBEHGS67.js";
16
+ } from "./chunk-KJ2TDIM3.js";
17
17
  import {
18
18
  cliVersion
19
19
  } from "./chunk-EX7EA34F.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveViteConfig
3
- } from "./chunk-QC3BOE2G.js";
3
+ } from "./chunk-NWDF2NRZ.js";
4
4
  import {
5
5
  Logger,
6
6
  buildPDFWithContainer,
@@ -28,7 +28,7 @@ import {
28
28
  setupConfigFromFlags,
29
29
  toContainerPath,
30
30
  warnDeprecatedConfig
31
- } from "./chunk-VBEHGS67.js";
31
+ } from "./chunk-KJ2TDIM3.js";
32
32
  import {
33
33
  coreVersion
34
34
  } from "./chunk-EX7EA34F.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Logger
3
- } from "./chunk-VBEHGS67.js";
3
+ } from "./chunk-KJ2TDIM3.js";
4
4
 
5
5
  // src/config/vite.ts
6
6
  import upath from "upath";
@@ -3,7 +3,7 @@ import {
3
3
  Logger,
4
4
  cwd,
5
5
  runExitHandlers
6
- } from "./chunk-VBEHGS67.js";
6
+ } from "./chunk-KJ2TDIM3.js";
7
7
 
8
8
  // src/core/init.ts
9
9
  import fs from "node:fs";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  build
3
- } from "../chunk-DMGAKSPH.js";
4
- import "../chunk-QC3BOE2G.js";
3
+ } from "../chunk-NABNSSUR.js";
4
+ import "../chunk-NWDF2NRZ.js";
5
5
  import {
6
6
  Logger,
7
7
  gracefulError,
8
8
  isInContainer,
9
9
  parseFlagsToInlineConfig
10
- } from "../chunk-VBEHGS67.js";
10
+ } from "../chunk-KJ2TDIM3.js";
11
11
  import "../chunk-EX7EA34F.js";
12
12
  import "../chunk-WX6JHPSL.js";
13
13
  import "../chunk-DMARNPN5.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  init
3
- } from "../chunk-E7QOXL6M.js";
3
+ } from "../chunk-YXEC5ZRK.js";
4
4
  import {
5
5
  gracefulError,
6
6
  parseFlagsToInlineConfig
7
- } from "../chunk-VBEHGS67.js";
7
+ } from "../chunk-KJ2TDIM3.js";
8
8
  import "../chunk-EX7EA34F.js";
9
9
  import "../chunk-WX6JHPSL.js";
10
10
  import "../chunk-DMARNPN5.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  preview
3
- } from "../chunk-LASMQBPP.js";
4
- import "../chunk-QC3BOE2G.js";
3
+ } from "../chunk-LGWCIQSL.js";
4
+ import "../chunk-NWDF2NRZ.js";
5
5
  import {
6
6
  gracefulError,
7
7
  parseFlagsToInlineConfig
8
- } from "../chunk-VBEHGS67.js";
8
+ } from "../chunk-KJ2TDIM3.js";
9
9
  import "../chunk-EX7EA34F.js";
10
10
  import "../chunk-WX6JHPSL.js";
11
11
  import "../chunk-DMARNPN5.js";